mirror of https://github.com/ARMmbed/mbed-os.git
Driver: I2C: STM32F4: Fix for every alternate i2c read failure in F2, F4 & L1 families.
This commit fixes the i2c driver issue reported in the below link: https://github.com/ARMmbed/mbed-os/issues/13967 on STM32F4xx platform. The data type of XferOperation has been changed from uint8_t to uint32_t so that it can hold a 32bit value (for example: I2C_OTHER_FRAME or I2C_OTHER_AND_LAST_FRAME). Signed-off-by: Krishna Mohan Dani <krishnamohan.d@hcl.com>pull/14668/head
parent
14e5d307bb
commit
8f2c45c5af
|
@ -122,7 +122,7 @@ struct i2c_s {
|
||||||
PinName scl;
|
PinName scl;
|
||||||
IRQn_Type event_i2cIRQ;
|
IRQn_Type event_i2cIRQ;
|
||||||
IRQn_Type error_i2cIRQ;
|
IRQn_Type error_i2cIRQ;
|
||||||
uint8_t XferOperation;
|
uint32_t XferOperation;
|
||||||
volatile uint8_t event;
|
volatile uint8_t event;
|
||||||
#if DEVICE_I2CSLAVE
|
#if DEVICE_I2CSLAVE
|
||||||
uint8_t slave;
|
uint8_t slave;
|
||||||
|
|
|
@ -106,7 +106,7 @@ struct i2c_s {
|
||||||
int scl_func;
|
int scl_func;
|
||||||
IRQn_Type event_i2cIRQ;
|
IRQn_Type event_i2cIRQ;
|
||||||
IRQn_Type error_i2cIRQ;
|
IRQn_Type error_i2cIRQ;
|
||||||
uint8_t XferOperation;
|
uint32_t XferOperation;
|
||||||
volatile uint8_t event;
|
volatile uint8_t event;
|
||||||
#if DEVICE_I2CSLAVE
|
#if DEVICE_I2CSLAVE
|
||||||
uint8_t slave;
|
uint8_t slave;
|
||||||
|
|
|
@ -86,6 +86,10 @@ static I2C_HandleTypeDef *i2c_handles[I2C_NUM];
|
||||||
#define FLAG_TIMEOUT ((int)0x1000)
|
#define FLAG_TIMEOUT ((int)0x1000)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef I2C_IP_VERSION_V1
|
||||||
|
#define I2C_STATE_NONE ((uint32_t)(HAL_I2C_MODE_NONE))
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Declare i2c_init_internal to be used in this file */
|
/* Declare i2c_init_internal to be used in this file */
|
||||||
void i2c_init_internal(i2c_t *obj, const i2c_pinmap_t *pinmap);
|
void i2c_init_internal(i2c_t *obj, const i2c_pinmap_t *pinmap);
|
||||||
|
|
||||||
|
@ -1057,7 +1061,9 @@ void HAL_I2C_MasterRxCpltCallback(I2C_HandleTypeDef *hi2c)
|
||||||
/* Get object ptr based on handler ptr */
|
/* Get object ptr based on handler ptr */
|
||||||
i2c_t *obj = get_i2c_obj(hi2c);
|
i2c_t *obj = get_i2c_obj(hi2c);
|
||||||
struct i2c_s *obj_s = I2C_S(obj);
|
struct i2c_s *obj_s = I2C_S(obj);
|
||||||
|
#ifdef I2C_IP_VERSION_V1
|
||||||
|
hi2c->PreviousState = I2C_STATE_NONE;
|
||||||
|
#endif
|
||||||
/* Set event flag */
|
/* Set event flag */
|
||||||
obj_s->event = I2C_EVENT_TRANSFER_COMPLETE;
|
obj_s->event = I2C_EVENT_TRANSFER_COMPLETE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue