Skip to main content
Visitor II
December 29, 2025
Question

I2C with repeated start.

  • December 29, 2025
  • 2 replies
  • 46 views

I have seen the question asked many times, references made but the question never gets answered with precision.  So, once again...

I want to use HAL_I2C_Master_Seq_Transmit_IT along with receive to read an I2C device register.

1. START SLAVEADDRESSWR (N-Byte RegAddress)

2. REPEATEDSART SLAVEADDRESSRD (N-Byte returned data) STOP

Step 1 would us HAL_I2C_Master_Seq_Transmit_IT 

Step 2 would use HAL_I2C_Master_Seq_Receive_IT

What are the "Option" parameters such as I2C_FIRST_FRAME, etc. for each of these calls to avoid a STOP between the sequences and make the REPEATEDSTART occur, and of course finish up with a STOP?

And using the memory read/write calls does not work because the register memory address cannot be of arbitrary length.  Don't have a scope handy to see the protocol generated, so I won't know things are working until my device actually returns correct default register values.

 

 

 

    This topic has been closed for replies.

    2 replies

    Super User
    December 29, 2025

    Here is a working example of these functions for both the master side and the slave side:

    STM32CubeU3/Projects/NUCLEO-U385RG-Q/Examples/I2C/I2C_TwoBoards_RestartComIT/Src/main.c at a88e56ca9916e3f93679559ecd9b17dc9e7a7a80 · STMicroelectronics/STM32CubeU3

    The syntax is the same regardless of chip family.

    HAL_I2C_Master_Seq_Transmit_IT(..., I2C_FIRST_FRAME);
    ...
    HAL_I2C_Master_Seq_Receive_IT(..., I2C_LAST_FRAME);