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.

TDA4VM: I2C XRDY flag is always 0 after sending out a byte

Part Number: TDA4VM

Device: TDA4

SDK Vesion: sdk7_03

mcu2_0 I2C works in master polling mode. The I2C waveform is as follows.

After mcu2_0 sends out the first byte, the slave device has given a response signal.

But the XRDY bit of the I2C_IRQSTATUS_RAW register is always 0, and mcu2_0 cannot send out the second byte of data.

Please give me some help.  Thanks!

  

  • Is this on an EVM or your own board?  If it's not an EVM, can you share the i2c schematics?  Also, it's hard to know what's going on without seeing the registers.  What values are you writing to the i2c registers before the transfer, and what are you doing to start the transfer?  When you're in the polling XRDY state, can you dump all of the i2c registers?  If you're using MCU_I2C0, that would be registers 0x40B00000 to 0x40B000D8.

    Regards,

    Zack

  • This is our own board. I2C slave device is max96722.The schematic of i2c is as follows. R4910 and R4911 are 0 ohms.

    i2c schematic on tda4 side

    i2c schematic on max96722 side

    The i2c function I call is Board_i2c16BitRegWr in the Iss_sensors.c file,it hang at line 1036 of I2C_v1.c about 17 seconds because I2C_INT_TRANSMIT_READY is always 0, finally it's timeout.

    The file iss_sensors.c and I2C_v1.c are in the attachment. All of the i2c registers dumped  as follow

    The attached file log0514.txt is the full log

    [MCU2_0] 38.076217 s: register 0x02010000 is 0x80c
    [MCU2_0] 38.076269 s: register 0x02010004 is 0x5040
    [MCU2_0] 38.076308 s: register 0x02010008 is 0x0
    [MCU2_0] 38.076344 s: register 0x0201000C is 0x0
    [MCU2_0] 38.076378 s: register 0x02010010 is 0x214
    [MCU2_0] 38.076416 s: register 0x02010014 is 0x0
    [MCU2_0] 38.076467 s: register 0x02010018 is 0x0
    [MCU2_0] 38.076504 s: register 0x0201001C is 0x0
    [MCU2_0] 38.076539 s: register 0x02010020 is 0x0
    [MCU2_0] 38.076574 s: register 0x02010024 is 0x5400
    [MCU2_0] 38.076614 s: register 0x02010028 is 0x1400
    [MCU2_0] 38.076650 s: register 0x0201002C is 0x0
    [MCU2_0] 38.076687 s: register 0x02010030 is 0x0
    [MCU2_0] 38.076723 s: register 0x02010034 is 0x6f6f
    [MCU2_0] 38.076759 s: register 0x02010038 is 0x0
    [MCU2_0] 38.076794 s: register 0x0201003C is 0x0
    [MCU2_0] 38.076830 s: register 0x02010040 is 0x0
    [MCU2_0] 38.076866 s: register 0x02010044 is 0x0
    [MCU2_0] 38.076900 s: register 0x02010048 is 0x0
    [MCU2_0] 38.076935 s: register 0x0201004C is 0x0
    [MCU2_0] 38.076972 s: register 0x02010050 is 0x0
    [MCU2_0] 38.077006 s: register 0x02010054 is 0x0
    [MCU2_0] 38.077041 s: register 0x02010058 is 0x0
    [MCU2_0] 38.077078 s: register 0x0201005C is 0x0
    [MCU2_0] 38.077113 s: register 0x02010060 is 0x0
    [MCU2_0] 38.077149 s: register 0x02010064 is 0x0
    [MCU2_0] 38.077183 s: register 0x02010068 is 0x0
    [MCU2_0] 38.077218 s: register 0x0201006C is 0x0
    [MCU2_0] 38.077255 s: register 0x02010070 is 0x0
    [MCU2_0] 38.077291 s: register 0x02010074 is 0x0
    [MCU2_0] 38.077327 s: register 0x02010078 is 0x0
    [MCU2_0] 38.077363 s: register 0x0201007C is 0x0
    [MCU2_0] 38.077399 s: register 0x02010080 is 0x0
    [MCU2_0] 38.077446 s: register 0x02010084 is 0x0
    [MCU2_0] 38.077486 s: register 0x02010088 is 0x5400
    [MCU2_0] 38.077524 s: register 0x0201008C is 0x0
    [MCU2_0] 38.077563 s: register 0x02010090 is 0x1
    [MCU2_0] 38.077597 s: register 0x02010094 is 0xf0f
    [MCU2_0] 38.077632 s: register 0x02010098 is 0x3
    [MCU2_0] 38.077669 s: register 0x0201009C is 0x3f
    [MCU2_0] 38.077706 s: register 0x020100A0 is 0x0
    [MCU2_0] 38.077742 s: register 0x020100A4 is 0x8600
    [MCU2_0] 38.077779 s: register 0x020100A8 is 0x1
    [MCU2_0] 38.077813 s: register 0x020100AC is 0x29
    [MCU2_0] 38.077851 s: register 0x020100B0 is 0x7
    [MCU2_0] 38.077884 s: register 0x020100B4 is 0x8
    [MCU2_0] 38.077922 s: register 0x020100B8 is 0xa
    [MCU2_0] 38.077960 s: register 0x020100BC is 0x4060
    [MCU2_0] 38.077996 s: register 0x020100C0 is 0x8003
    [MCU2_0] 38.078032 s: register 0x020100C4 is 0x0
    [MCU2_0] 38.078069 s: register 0x020100C8 is 0x0
    [MCU2_0] 38.078104 s: register 0x020100CC is 0x0
    [MCU2_0] 38.078139 s: register 0x020100D0 is 0x0
    [MCU2_0] 38.078174 s: register 0x020100D4 is 0x0

    iss_sensors.c

    I2C_v1.c

    log0514.txt
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    U-Boot SPL 2020.01-svn2210 (May 11 2021 - 10:51:16 +0800)
    SYSFW ABI: 3.1 (firmware rev 0x0015 '21.1.1--v2021.01a (Terrific Lla')
    Reading on-board EEPROM at 0x50 failed -1
    Trying to boot from MMC2
    Loading Environment from MMC... *** Warning - No MMC card found, using default environment
    Starting ATF on ARM64 core...
    NOTICE: BL31: v2.4(release):07.03.00.005-dirty
    NOTICE: BL31: Built : 00:15:40, Apr 10 2021
    U-Boot SPL 2020.01-svn2210 (May 12 2021 - 18:31:56 +0800)
    SYSFW ABI: 3.1 (firmware rev 0x0015 '21.1.1--v2021.01a (Terrific Lla')
    Reading on-board EEPROM at 0x50 failed -1
    Trying to boot from MMC2
    i2c_write: error waiting for data ACK (status=0x116)
    Error reading output register
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Based on this flowchart from the TRM:

    You should be first polling the XDR bit (which is 1 according to your register dump).  This means that you need to write to I2C_DATA 3 times. 

    Based on my reading of the TRM, I agree that the XRDY bit should be set as well, since the TX FIFO is empty.  But the behavior seems to be that if the number of bytes left in the transfer is less than the threshold amount, then only XDR will be set.  I would try the following two fixes:

    Add some logic to your code which first polls XDR and handles the XDR=1 situation accordingly.

    OR

    Try changing your threshold to 1.

    Regards,

    Zack

  • Thank you for your reply.

    The current threshold of 16 is an error value. After I changed the threshold to 1, it can work well