This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

HD3SS3220: Problem with INT_N pin

Part Number: HD3SS3220

Tool/software:

Hi,

I am trying to deal with INT_N pin of HD3SS3220RNHR , but no luck. May be you could help me. Here is my case:

I connect INT_N via pull to 5V and then use divider to get 3v3 and then connect this to a microcontroller (RP2040) GPIO14, please see an image down below. I also have I2C connected to the RP2040 and I can read / write the data without any problem.

My concern is the low state of INT_N pin regardless what I write into a control register:

#define HD3SS3220_ADDR 0x67
#define HD3SS3220_INTERRUPT_PIN 14
... 
bool state = gpio_get(HD3SS3220_INTERRUPT_PIN);
  while (!state) {
    reg_read(i2c_default, HD3SS3220_ADDR, REGISTER_CONNECTION_STATUS, data, 1);
    printf("REGISTER_CONNECTION_STATUS: %X\r\n", data[0]);

    reg_read(i2c_default, HD3SS3220_ADDR, REGISTER_CONNECTION_STATUS_AND_CONTROL, data, 1);
    printf("REGISTER_CONNECTION_STATUS_AND_CONTROL: %X\r\n", data[0]);    
    data[0] = (data[0] & 0xC0) | 0x01;

    reg_write(i2c_default, HD3SS3220_ADDR, REGISTER_CONNECTION_STATUS_AND_CONTROL, &data[0], 1);
    sleep_ms(10);
    state = gpio_get(HD3SS3220_INTERRUPT_PIN);
    printf("interrupt pin: %d\r\n", state);
    sleep_ms(5000);
}

and the output of the code:

REGISTER_CONNECTION_STATUS: 10
REGISTER_CONNECTION_STATUS_AND_CONTROL: 90
Write operation: 2

interrupt pin: 0
REGISTER_CONNECTION_STATUS: 10
REGISTER_CONNECTION_STATUS_AND_CONTROL: 91
Write operation: 2

interrupt pin: 0
REGISTER_CONNECTION_STATUS: 10
REGISTER_CONNECTION_STATUS_AND_CONTROL: 91
Write operation: 2

interrupt pin: 0



Could you point me what did I do wrong? 

  • Hi Sergei,

    If anything is being written to the I2C registers, or if anything is happen in the USB-C connection that causes a change to an I2C register, then the INT_N pin should be low, as that indicates a change to an I2C register. The interrupt pin/register will only be cleared by writing 1 to the relevant bit:

    Are you expecting the bit to read high after being read? Have you tried writing to that bit to clear it? The device is setup for I2C mode and not GPIO mode, correct?

    Thanks,

    Ryan

  • Hi Ryan,
    Thanks for the response!

    The interrupt pin/register will only be cleared by writing 1 to the relevant bit:

    Do I understand you right - I need to write 1 , not into INTERRUPT_STATUS field to reset it? (cause I am trying to write 0)

    Have you tried writing to that bit to clear it?

    here is the part from the code above that writes into register:

    data[0] = (data[0] & 0xC0) | 0x01;

    reg_write(i2c_default, HD3SS3220_ADDR, REGISTER_CONNECTION_STATUS_AND_CONTROL, &data[0], 1);

    The device is setup for I2C mode and not GPIO mode, correct?

    The device is in i2c mode and it is working, i can read / write all the registers. 

    Are you expecting the bit to read high after being read?

    I am expecting the pin INT_N to be high again, after I wrote 0 into REGISTER_CONNECTION_STATUS_AND_CONTROL for INTERRUPT_STATUS

  • Hi Sergei,

    Do I understand you right - I need to write 1 , not into INTERRUPT_STATUS field to reset it? (cause I am trying to write 0)

    Sorry, yes, it should be 0 thats being written to that register, that's my bad.

    Going by your code and the values you're getting, it looks like the value for that register isn't changing (Bit 4 always stays 1, indicating an interrupt). 

    data[0] = (data[0] & 0xC0) | 0x01;

    I believe this is comparing the value of the data at register 0x09 to 0xC0, and then using an Or comparator, correct? If thats the case, from what I can tell, the value of data[0] will still have that fourth bit of 0x09 set as 1, which is then written into register 0x09, not changing the bit to 0.

    If possible, could you check the value of data[0] at that fourth bit before it is written, just to ensure that it will write 0 to bit 4?

    Thanks,

    Ryan

  • Ok, Ryan, here is the very minimal code, I wrote to play with the I2C:

      bool state = gpio_get(HD3SS3220_INTERRUPT_PIN);
      printf("HD3SS3220_INTERRUPT_PIN pin: %d\r\n", state);
      while (!state) {
        reg_read(i2c_default, HD3SS3220_ADDR, REGISTER_CONNECTION_STATUS, data, 1);
        printf("REGISTER_CONNECTION_STATUS: %X\r\n", data[0]);
        reg_read(i2c_default, HD3SS3220_ADDR, REGISTER_CONNECTION_STATUS_AND_CONTROL, data, 1);
        printf("REGISTER_CONNECTION_STATUS_AND_CONTROL: %X\r\n", data[0]);    
        data[0] = data[0] & 0b11101111;
        printf("Reset command: %#04X\r\n", data[0]);    
        reg_write(i2c_default, HD3SS3220_ADDR, REGISTER_CONNECTION_STATUS_AND_CONTROL, &data[0], 1);
        sleep_ms(10);
        state = gpio_get(HD3SS3220_INTERRUPT_PIN);
        printf("HD3SS3220_INTERRUPT_PIN pin: %d\r\n", state);
      }

    and here is the output:

    --------------
    HD3SS3220_INTERRUPT_PIN pin: 0
    REGISTER_CONNECTION_STATUS: 10
    REGISTER_CONNECTION_STATUS_AND_CONTROL: 90
    Reset command: 0X80
    Write operation: 2
    HD3SS3220_INTERRUPT_PIN pin: 0
    REGISTER_CONNECTION_STATUS: 10
    REGISTER_CONNECTION_STATUS_AND_CONTROL: 90
    Reset command: 0X80
    Write operation: 2
    HD3SS3220_INTERRUPT_PIN pin: 0
    REGISTER_CONNECTION_STATUS: 10
    REGISTER_CONNECTION_STATUS_AND_CONTROL: 90
    Reset command: 0X80
    Write operation: 2
    HD3SS3220_INTERRUPT_PIN pin: 0

    I use the mask 0b11101111 to clear the INTERRUPT_STATE bit , then I print reset command 0x80 (0b10000000) 
    Then command is being sent , and I got 2 bytes written from I2C request (1 address + 1 register). Then I sample PIN after 10 ms and it is sitll 0 (i.e. low). 
    then everything repeats. And you see every time I read the register back , I get 0x90 (10010000) , it indicates that interrupt is still there. 

    This cycle repeats indefinitely. 

  • For clarity, here is the constants used in the code above:

    #define HD3SS3220_ADDR 0x67
    #define HD3SS3220_INTERRUPT_PIN 14
    #define REGISTER_DEVICE_IDENTIFICATION 0x00
    #define REGISTER_CONNECTION_STATUS 0x08
    #define REGISTER_CONNECTION_STATUS_AND_CONTROL 0x09
    #define REGISTER_GENERAL_CONTROL 0x0A
    #define REGISTER_DEVICE_REVISION 0xA0
  • Hi Sergei,

    Got it, yeah, I believe it should be reset then. I'll double check internally that this is how it's meant to be reset, or if maybe there's another way to do this, though I believe this should work.

    And just to double check, the INTERRUPT_PIN variable refers to the pin of the HD3SS3220 itself, with a 0 meaning there is an interrupt, correct?

    Thanks,

    Ryan

  • Thank you, Ryan!

    Answering your question - 
    bool state = gpio_get(HD3SS3220_INTERRUPT_PIN); << here HD3SS3220_INTERRUPT_PIN is pin GPIO14 on RP2040 , that is being sampled. (Low or High)  

    here:

    printf("HD3SS3220_INTERRUPT_PIN pin: %d\r\n", state); <<< I got output down below, and the state is always 0 (i.e. low) regardless what I write into the register

    HD3SS3220_INTERRUPT_PIN pin: 0

    you can see this GPIO14 connection to HD3SS3220 in the schematic in the initial post. 

  • Hi Sergei,

    Could you try writing 1 to bit 3 of register 0x0A? This should cause the digital logic to reset, I would be interested to see if that affects it.

    Also, could you try writing a 1 to the INTERRUPT_STATUS bit, just to see if it does have any effect? 

    Thanks,

    Ryan

  • I have tried , but no success. I believe I have a design problem in schematic. Can I somehow privately share the schematic and you suggest me - what is wrong there? In my setup I use two usb-c ports, one is handled by HD3SS3220 and second is by TUSB320LA. both of these chips are having incorrect behavior. 

  • Hi Sergei,

    I sent you a friend request over E2E. You can accept that, and then send me a PM of your schematic so its not available publicly. Sounds like there may be something in the schematic.

    Thanks,

    Ryan