Description
Hello,
I'm trying to connect to the MMA8451 accelerometer. This chip requires an I2C driver with repeated-start feature enabled to discuss with.
I've a NUCLEO-F411RE, lib 1.6.1 and no repeated start is generated due to some low level limitations.
Let me explain:
XferOptions variable is always set to I2C_NO_OPTION_FRAME
in the HAL_I2C_Transmit_IT
. So, once the Xfer is completed, it fires I2C_MasterTransmit_TXE
. As the following condition is always false (stm32f4xx_hal_i2c.c):
if ((CurrentXferOptions != I2C_FIRST_AND_LAST_FRAME) && (CurrentXferOptions != I2C_LAST_FRAME) && (CurrentXferOptions != I2C_NO_OPTION_FRAME))
a STOP will be generated (line 5025):
/* Disable EVT, BUF and ERR interrupt */
__HAL_I2C_DISABLE_IT(hi2c, I2C_IT_EVT | I2C_IT_BUF | I2C_IT_ERR);
/* Generate Stop */
SET_BIT(hi2c->Instance->CR1, I2C_CR1_STOP);
Does someone can confirm ?
How could we override XferOptions by setting to I2C_LAST_FRAME_NO_STOP
?
Ok, I understand that it's not directly related to the framework by itself, but I observed that I2C driver is really different regarding the variant.
In other word, by using TwoWire::endTransmission(false)
, it should not send a STOP condition (instead of UNUSED(endStop) ).
Thank you,
jean-marc