cancel
Showing results for 
Search instead for 
Did you mean: 

I2C with repeated start condition example

DS.4
Senior II

HI

Got an I2C device connected to my p nucleo wb 55 board. currently no luck communicating.

I've been instructed to to use a  repeated start condition in I2C   https://www.i2c-bus.org/repeated-start-condition/

Not sure if my current   HAL functions work for an I2C repeated start condition device? they are :

HAL_I2C_Mem_Write XXX

HAL_I2C_Master_Transmit XXX 

 

Any other example I can use ?

 

need to achieve this :

DS4_0-1723014680800.png

 

S start

R restart

 

THNAKS

1 REPLY 1
Saket_Om
ST Employee

Hello @DS.4 

 

To achieve a repeated start condition with your I2C device, you will need to use specific HAL functions that support repeated start conditions. The functions you mentioned (HAL_I2C_Mem_Write and HAL_I2C_Master_Transmit) do not support repeated start conditions.

For repeated start conditions, you should use the following HAL functions:

  • HAL_I2C_Master_Sequential_Transmit_IT
  • HAL_I2C_Master_Sequential_Receive_IT

These functions are designed to handle sequential transmit and receive operations, which include the capability to perform repeated start conditions.

Please refer to these examples for farther more details:

If your question is answered, please close this topic by clicking "Accept as Solution".

Thanks
Omar