Recently, I have been using the I2C function of the S32K116 chip, and I would like to know how to obtain the FIFO size of I2C. I can only know my FIFO from the debug_ Count=1, FIFO_ Size=4. How can I determine the maximum number of bytes that I2C can transmit at once.
已解决! 转到解答。
Hi @Embedded_novice,
The I2C bus specification (I2C-bus specification) defines the byte format by the following:
Every byte put on the SDA line must be eight bits long. The number of bytes that can be transmitted per transfer is unrestricted.
Hardware itself doesn't limit the read transfer size, but just requires the software to queue multiple read data commands. Currently, the driver can only receive 1-256 bytes of data (can also be configured to discard receive data and not store in receive FIFO).
I hope you find this useful!
Hi @Embedded_novice,
The size of the TX & RX FIFO is 4 words, as described in the S32K1xRM:
The default value is: RXFIFO = 0x02, TXFIFO = 0x02, that means the maximum number of words in the receive/transmit FIFO is 4(2^0x02).
Best regards,
Julián
When I was checking the source code, I found that there seems to be no limit on the maximum number of bytes sent, but the maximum number of bytes received is only 256 bytes.
I would like to ask if this means that the maximum number of bytes sent depends on the maximum number of bytes received. Another question is how is the maximum number of bytes received, 256 bytes, calculated?
Hi @Embedded_novice,
The I2C bus specification (I2C-bus specification) defines the byte format by the following:
Every byte put on the SDA line must be eight bits long. The number of bytes that can be transmitted per transfer is unrestricted.
Hardware itself doesn't limit the read transfer size, but just requires the software to queue multiple read data commands. Currently, the driver can only receive 1-256 bytes of data (can also be configured to discard receive data and not store in receive FIFO).
I hope you find this useful!
hello@Julián_AragónM
Does this mean that I can only transfer up to 8 bytes on the I2C bus at a time? When I try to call LPI2C_ DRV_ MasterSendDataBlocking(), I found that in the example program of S32DS, 64 bytes were transferred at once. I attempted to transfer more than 70 bytes once in my code, but was still able to transfer (I read and write EEPROM through I2C) and successfully read all incoming bytes.
My question is, if I transfer more than the maximum depth of the FIFO at once, what will be done to the bytes that exceed the depth?Will it trigger a certain event or will it truncate the excess and retransmit it?