2015-01-22 12:44 AM
Hi
How can I send and receive word data in I2c bus. ( in new HAL LIBRARY STM32F1cube) some sensor need word data. thanks.2015-02-26 07:16 AM
Hi askari.nima,
If you need to send word data to slave a device, you can use these interfaces : 1- No need repeated start condition, prefer to use one of these interfaces with a size equal to “2�? mean “2 bytes to send�? :HAL_I2C_Master_Transmit(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t Timeout)HAL_I2C_Master_Transmit_IT(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size)HAL_I2C_Master_Transmit_DMA(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size) 2- Need a repeated start condition, prefer to use one of these interfaces with a size equal to “2�? mean “2 bytes to send�? :HAL_I2C_Mem_Write(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size, uint32_t Timeout)HAL_I2C_Mem_Write_IT(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size)HAL_I2C_Mem_Write_DMA(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size)Hope that help,Regards,Heisenberg.