2017-10-25 5:13 AM
Hi,
I try to implement I2C slave communication based on HAL Library (STM32F070) with another MCU. All functions that interest me include as argument
uint16_t Size parameter, for example:
HAL_StatusTypeDef HAL_I2C_Slave_Transmit_IT(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size);
HAL_StatusTypeDef HAL_I2C_Slave_Receive_IT(I2C_HandleTypeDef *hi2c, uint8_t *pData, uint16_t Size);
When I set the maximum buffer size in parameter uint16_t Size, the library stuck in:
/* All data are not transferred, so set error code accordingly */
if(hi2c->XferCount != 0U) { /* Set ErrorCode corresponding to a Non-Acknowledge */ hi2c->ErrorCode |= HAL_I2C_ERROR_AF; }So if I receive less data the HAL Library return HAL_I2C_ERROR_AF. It looks like the library functions work only for communication with fixed data frame lengths.
It is possible to use HAL libraries when data frame length may vary?
Thanks, Adrian
We’re moving the ST Community to a new platform to give you a better and more reliable community experience.