cancel
Showing results for 
Search instead for 
Did you mean: 

I2C HAL driver and Word data

askari.nima
Associate II
Posted on January 22, 2015 at 09:44

Hi

How can I send and receive  word data  in I2c bus. ( in new  HAL LIBRARY   STM32F1cube)

some sensor need word data.

thanks.
1 REPLY 1
Posted on February 26, 2015 at 16:16

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.