Skip to main content
ricardomiguel
Associate II
December 3, 2025
Question

Sequential I2C problems on STM32F030

  • December 3, 2025
  • 2 replies
  • 128 views

I'm re-using a sequential I2C library that worked on a couple other ST devices with different I2C devices, but it doesn't work on a STM32F030.

They are functions for I2C register operations, where we always start with a write with the register address and then a write/read, depending on the operation:

 
// Read register
HAL_I2C_Master_Seq_Transmit_IT(peripheral, address, &registerAddress,1, I2C_OTHER_FRAME);
HAL_I2C_Master_Seq_Receive_IT(peripheral, address, data,size, I2C_OTHER_AND_LAST_FRAME);

// Write register
HAL_I2C_Master_Seq_Transmit_IT(peripheral, address, &registerAddress,1, I2C_OTHER_FRAME);
HAL_I2C_Master_Seq_Transmit_IT(peripheral, address, data,size, I2C_OTHER_AND_LAST_FRAME);

The write doesn't work (read works fine). The first call to HAL_I2C_Master_Seq_Transmit_IT is successful, but not the second.

I've tried the write with different I2C transfer options, but none seem to work. I don't have a scope on me so I don't know what frame is being produced.

Anyone has other recommendations of what I can try?

 

2 replies

Technical Moderator
December 3, 2025

Hello @ricardomiguel 

Could you try with option below:

HAL_I2C_Master_Seq_Transmit_IT(peripheral, address, &registerAddress, 1, I2C_FIRST_FRAME);
HAL_I2C_Master_Seq_Transmit_IT(peripheral, address, data, size, I2C_LAST_FRAME);
"To give better visibility on the answered topics, please click on ""Accept as Solution"" on the reply which solved your issue or answered your question.Saket_Om"
TDK
Super User
December 3, 2025

You can also use HAL_I2C_Mem_Read_IT and HAL_I2C_Mem_Write_IT which were designed for this.

"If you feel a post has answered your question, please click ""Accept as Solution""."