2025-12-03 1:47 AM
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, ®isterAddress,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, ®isterAddress,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?
2025-12-03 5:08 AM
Hello @ricardomiguel
Could you try with option below:
HAL_I2C_Master_Seq_Transmit_IT(peripheral, address, ®isterAddress, 1, I2C_FIRST_FRAME);
HAL_I2C_Master_Seq_Transmit_IT(peripheral, address, data, size, I2C_LAST_FRAME);
2025-12-03 6:26 AM
You can also use HAL_I2C_Mem_Read_IT and HAL_I2C_Mem_Write_IT which were designed for this.