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.

TCA6416A input registor read data problem

Other Parts Discussed in Thread: TCA6416A

 Hello guys,

 I need your help.

 My customer is evaluationg TCA6416A with I2C port of Runesus CPU.

 But they have a problem.

 They wrote "slave address + 06h (as command data) + F0h (for P00 to P07)

+ 0Fh (for P10 to P17)  to set configuration registor.

 These data would define P04 to P07 and P10 to P13 to as input port.

After that they wrote FFh(All"1") to output register for P00 to 07 and P10 and 17 with command 02h.

But after that, they couldn't read the correct set input data and output data which they wrote previous.

We don't know why we can not read the input data and output data with commmand "00h".

 If anyone knows the reason, could you please let me know?

 If you know correct data to write for getting correct input data, could you please let me know?

 Or should we send data like one slave address + one command data + one write data as 

one packet?

 Your reply would be much appreciated.

 Best regards,    

      

 

  • Hello Nakai-san,

    First question I have is, what are they using to evaluate the IO expander? Are they using the IO expander EVM and connecting their own processor to it?

    This is an issue I have seen a few times when a customer wants to evaluate the IO expander on our EVM with their own processor.
  • Hello Jonathan,

    They are evaluation TCA6416A, IO expander on their own designed board.
    They conncted some I2C device same I2C bus as the TCA6416A. There is not any problem except TCA6416A.
    And I got a new information. They couldn't get correct input data at P00-P07 but they could get
    at P10-P17.
    If you have any question, could you please let me know?

    Thank you and best regards,
    Kazuya Nakai.
  • Nakai-san,

    Would it be possible to let me know what exact bytes of data they are sending, please check the following, as it is what I think they are sending:
    <Start> 0x40, 0x06, 0xF0, 0xF0 <Stop> - This will setup P04-P07 and P14-P17 to Inputs.
    <Start> 0x40, 0x02, 0xFF, 0xFF <Stop> - This will set output for P00-03 and P10-P13 to high.
    <Start> 0x40, 0x00 <Repeated Start> 0x41, [0xZF, 0xZF] <Stop> - For the read command from the slave, the upper nibble should not be known since I do not know what the state of their inputs is.

    [0xZF] is data sent from slave to master, where 'Z' is for some random value.

    Have they checked to make sure that no slaves have the same address? This issue I have seen when there are 2 or more slaves with the same I2C address.
  • Hello Jonathan,

    Thank you for your prompt reply.

    The customer wrote the I2C data as the following.

    <Start> 0x42+A(Acknowledge), 0x06+A, 0xF0+A, 0x0F+A <Stop>
    - This will setup input/output configuration for P07-P00 and P17-P10.
    <Start> 0x42+A, 0x04+A, 0x00+A, 0x00+A <Stop>
    - This will setup input polarity for P07-P00 and P17-P10 to non inverting mode.
    <Start> 0x42+A, 0x02+A , 0xFF+A, 0xFF+A<stop>
    - This will setup output polarity for P07-P00 and P17-P10 to "1" for only port set to output mode.
    After that, they will send the follwoing.
    <Start> 0x42+A, 0x00+A, 0x43+A, 8clock+A(for reading data of P00 to P07)
    +8clock+NA(for reading data of P10 to P17)<stop>

    The result of the reading data in their case was not "xxxx1111b"
    as the input data of P-07 to P-00 and "1111xxxxb" as the input data of p-17 to P10".

    Could you please correct if the sending data is wrong?

    Thank you again and best regards.

    Kazuya Nakai.
  • Nakai-san,

    Can you tell me what values they get when they read from the slave? Does it change every read? Is it stuck at 0xFF?

    One thing I would like to confirm with their read sequence, is that I do not see a repeated start condition (or a stop and start) during the read function, which is crucial.

    <Start> 0x42+A, 0x00+A, 0x43+A, 8clock+A(for reading data of P00 to P07)
    +8clock+NA(for reading data of P10 to P17)<stop>

    It should be:
    <Start> 0x42+A, 0x00+A,<Repeated Start or Stop and Start> 0x43+A, 8clock+A(for reading data of P00 to P07)
    +8clock+NA(for reading data of P10 to P17)<stop>
  • Hi Jonathan,

    Thank you for your reply.

    The input register data of P07-P00 is always "00h". But the input register data of P17-P10 can be read correctly.
    The data of P07-P00 is wronf only.

    I will confirm the customer sending data for the input data reading with the customer whether the restart or stop bit is inserted or not.

    Thank you again and best regards,
    Kazuya Nakai.
  • Hi Jonathan,

    Our customer sends data to set each register as the followings.

    Thier sending data(In ADDR=L case, A=Acknowledge、NA= No Acknowledge)


    1. Configuration register writing(0:defined to output, 1:defined to input, Default=FFh)
    <Start> 0x40+A(Slave address), 0x06+A(Configuration 0 register select),
    0xF0+A(for P07-00),0x0F+A(For P17-10),<Stop>。 

    2. Polarity Inversion register writing(0:set non invert mode, 1:set invert mode, Default=00h)
    <Start> 0x40+A(Slave address), 0x04+A(Polarity Inversion 0 register select),
    0x00+A(for P07-00),0x00+A(For P17-10),<Stop>。 

    3. Output Port register writing(0:L level output、1:H level output, Default=FFh)
    <Start> 0x40+A(Slave address), 0x02+A(Output Port 0 select),
    0xFF+A(For P07-P00), 0xFF+A(For P17-10)<stop> 

    4. Input Port register writing(0:L level input、1:H level input、Polarity=0 case)
    < Start> 0x40+A(Slave address), 0x00+A(Input Port 0 select),
    ,<Repeated Start or Stop and Start> 0x41+A(slave addres, red mode),
     8clock+A(reading from P07-00)、8clock+NA(reading from P10-17)<stop>

     Their read data by input port register reading is all "0" though all input data

    are "H" level.

     Do you have any idea what the misreading reason is? 

     Thank you and best regards,

     Kazuay Nakai.

  • Hi Jonathan,

    I mistook to write their problem point.

    In case that when they send < Start> 0x40+A(Slave address), 0x00+A(Input Port 0 select), ,<Repeated Start or Stop and Start> 0x41+A(slave addres, red mode),
    8clock+A(reading from P07-00)、8clock+NA(reading from P17-10)<stop>,
    they can get the data of P17-10 correctly but can not get the data of P07-00 correctly.
    Not all data is wrong.

    The follwings are additional information.
    Our customer also tried to write data one by one as the follow.

    <Start> 0x40+A(slave address), 0x06+A(Configuration 0 select),
    0xF0+A(For port 07-00),<Stop>。

    <Start> 0x40+A(slave address), 0x07+A(Configuration 1 select),
    0x0F+A(For port 17-10), <Stop>。

    They used same method for Polarity/Output/Input port register writing
    as the previous(not above).
    At the result, they could read correct input data of P17-10 but could not read
    the data of P07-00.

    In case of another order like the follow,
    <Start> 0x40+A(slave address), 0x07+A(Configuration 1 select),
    0xF0+A(For port 17-10),<Stop>。

    <Start> 0x40+A(slave address), 0x06+A(Configuration 0 select),
    0x0F+A(For port 07-00), <Stop>。

    Then, They could read the data of port 07-00 correctly but the data of P17-10 was
    not correct.

    Could you tell me what the misreading reason if you know?

    Thank you and best regards,
    Kazuya Nakai.
  • Hi Jonathan,

    I'm sorry to send many reply.

    I have an additional question. I found the following sentence on page22 of TCA6416A datasheet.
    "For example, if the first byte is send to Output Port 1 (register 3), the next byte is stored in Output Port 0 (register 2)."

    I think this sentence meaning is different from the data order on figure29 and 30.

    Could you tell me which correct is, if you know?

    Thank you very much and best regards,
    Kazuya Nakai.
  • Nakai-san,

    There is a lot of information here, thank you.

    First I will answer your question: What that sentence on page 22 means is that if you write to the 2nd of the pair (IE write to configuration 1, instead of configuration 0), and write 2 bytes, it will loop around and the 2nd byte will get placed into configuration 0 (in the above example).


    Back to their problem:
    To verify, When they are trying to read, do all the ports that are setup as inputs have a high signal applied to them (not floating)?

    Do the ports that are set as outputs read correctly (you should read the same value that the output register is set to)?

    I am trying to replicate this issue on my own TCA6416A device.

    Do you have any i2c scope shots.
  • Hello Jonathan,

    Thank you very much for your support.

    Today, the customer found the cause of the input data read problem.
    It was their fault. They sent un-neccesary 1bit data to write the data to the configuration register.
    When they remove the 1 bit data, they could read input register data correctly.

    I'm very sorry to bother you and I appreciate for your strong support.

    Thank you very much again and best regards,
    Kazuya Nakai.
  • Nakai-San,

    This is good news. Thank you for letting me know.