STM32F030CC I2C master needs a long delay for interrupt based transmit
Program code all generated with STM32CubeIDE 1.3.1 Build 6291_20200406_0752 (with STMCube F0 v 1.11)
Program uses I2C1 on STM32030CC using AF1 GPIOB pin 6 and 7 and reads data from an HTU2X via interrupt based transfer.
First it select the register :
HAL_I2C_Master_Transmit_IT(&hi2c1, 0x40 << 1, aTxBuffer, 1);
after that a wait loop seems needed to wait for
HAL_I2C_MasterTxCpltCallback
to be called. The wait loop is
HAL_Delay(40);
After that
HAL_I2C_Master_Receive_IT(&hi2c1, 0x40 << 1, aRxBuffer, 3);
which waits for
HAL_I2C_MasterRxCpltCallback()
to be called. After that no additional delay seems to be needed.
The issue is, going below 40msec the HAL_I2C_Master_Receive_IT( fails (no IRQ) and going even lower to about 20msec, HAL_I2C_MasterTxCpltCallback does not get called, This is all very consistent and reproducable. Above about 40msec there are no such issues.
Running this with 40msec result in about 22 successful transactions per second which is quite slow
Why is such a long delay time needed and why is the TX CB not called when shorter time is used and is there a way to speed this up ?
One a side note: It seems that the HAL library functions for the same MCU changes over time, (example I2C1_IRQHandler) so it's hard to reference other code on the web using the exact same function calls especially when using the newer HAL libraries.
