2022-11-01 11:58 AM
Hello together,
I'm using Nucleo-32 board (with a STM32G431KBTx) and have got some problems...
In my project I'm using:
-> UART (here I'm using RX-DMA and interrupt with an IDLE-flag)
-> ADC, one channel
-> I²C with an EEPROM (no DMA, no Interrupt)
Problems and attempted solutions
Problem 1: if I write some bytes to EEPROM (I'm using HAL_I2C_Mem_Write(...) for that), and wait 5ms after the writing a page, the MCU stucks in HAL_Delay forever. After some googling I found a solution for this, increase interrupt priority for SysTick_Handler. Okay, all my interrupts have 0 as "preemption priority", so I've configured priorities like this:
After that fix, reading/writing from/to EEPROM runs like a charm.
BUT:
The uart communication broke. That means, I request some data (exactly 70 Bytes) from MCU by sending a character (i.e. an V), but I get just 65 bytes, or 67 bytes, or 70 bytes, or 64 bytes... so it's not deterministic, but in 98% the requests I get less then 70bytes...
If I set all the priorities to 0, the uart communication is fine, but HAL_Delay stuck...
Any ideas? I've attached the whole project (STM32CubeIDE 1.10.1)
Thank you very much & kind regards,
Heinrich
Solved! Go to Solution.
2022-11-01 12:07 PM
Primary dont use haldelay in interrupt routines.NEVER
2022-11-01 12:07 PM
Primary dont use haldelay in interrupt routines.NEVER
2022-11-01 12:16 PM
I'm using HAL_Delay in a function, which is called from interrupt routine, after clearing the IDLE flag.
Regards,
Heinrich
2022-11-01 12:25 PM
And that's exactly what you should NOT do.
2022-11-01 01:20 PM
Okay, my mistake...
After I reimplemented the UART stuff, I²C seems to run fine.
Thank you guys!