2021-10-25 08:23 AM
Dear all,
In my system, STM32L412 is between MCU_B and Dev_S. The role of the STM32L412 is a bit like I2C bridge.
That means MCU_B does any I2C read/write command from/to Dev_S must by the help of STM32L412.
It is simple for STM32L412 receives I2C write command from MCU_B
1. For I2C write command issued from MCU_B , STM32L412 will do the following
a. STM32L412 receives I2C write command, I2C_Wr_Cmd
b. Pass the I2C_Wr_Cmd to Dev_S.
And it is a bit complicated for STM32L412 to do I2C read command from MCU_B .
2. For I2C read command issued from MCU_B , MCU will do the following,
a. STM32L412 receives I2C read command, says I2C_Rd_Cmd
b. STM32L412 needs to know how many bytes MCU_B needs to read back
c. STM32L412 pulls the clock low (stretch the clock) because Dev_S data not read.
d. STM32L412 send I2C read command to Dev_S
e. STM32L412 get data from Dev_S
f. STM32L412 send data to MCU_B
Because termination of I2C read operation is determined by I2C master sending an NACK with a following STOP when getting last data byte from i2c slave.
My question is, how many byte will be read is unknown in advanced in this system, How to pass the i2c read command from MCB_B to Dev_S.
Thanks,
E-John
i2c bridge in my system
2021-10-25 09:27 AM
Is there a question?
JW