Hi,
I use flexio_iic to read the eeprom. and I found a issue when the reading length is over 13 using flexio_i2c.
I traced the code. i found there's a overflow in function <FLEXIO_I2C_DRV_MasterSetBytesNo>.
static void FLEXIO_I2C_DRV_MasterSetBytesNo(FLEXIO_Type *baseAddr, const flexio_i2c_master_state_t *master)
{
1 uint16_t timerCmp;
2 uint32_t bytesNo;
3 uint8_t resourceIndex; /* Index of first used internal resource instance (shifter and timer) */
4 resourceIndex = master->flexioCommon.resourceIndex;
5 /* Compute number of SCL ticks, including address */
6 bytesNo = master->txRemainingBytes;
7 bytesNo = (bytesNo * 18U) + 1U;
8 /* Set number of ticks in low part of timer compare register */
9 timerCmp = FLEXIO_HAL_GetTimerCompare(baseAddr, SCL_TIMER(resourceIndex));
10 timerCmp = (uint16_t)((timerCmp & 0x00FFU) | (uint16_t)((bytesNo & 0xFFU) << 8U));
11 FLEXIO_HAL_SetTimerCompare(baseAddr, SCL_TIMER(resourceIndex), timerCmp);
}
According to the reading length 14, the master->txRemainingBytes is 15 and we can calculate the final bytesNo 0x10f(271).But after excute the line 10, we can see the higher 8 bits of bytesNo is ignored.And it leads to a error execution.
So how can i read bytes over 13?
Solved! Go to Solution.
Hi,
This is a known limitation of FlexIO I2C driver, it cannot handle transfers larger than 13 bytes.
In order to transfer data larger than 13 bytes you can perform multiple transfers with data size <= 13 in order to send/receive the desired amount of payload.
If there are constraints of the slave device that restricts the transfer to be performed only once with the whole data you can use the LPI2C driver.
Best regards,
Rares
32个赞
Hi,
This is a known limitation of FlexIO I2C driver, it cannot handle transfers larger than 13 bytes.
In order to transfer data larger than 13 bytes you can perform multiple transfers with data size <= 13 in order to send/receive the desired amount of payload.
If there are constraints of the slave device that restricts the transfer to be performed only once with the whole data you can use the LPI2C driver.
Best regards,
Rares
Get it.
Thanks a lot.
32个赞