Description
Hello and thank you for great work and tutorial !
Your code is working well with CubeIDE, even with release optimisation (Os) and with Keil without compiler optimization (O0) but as soon as I try other optimization (O1,... Os) on Keil µVision, it doesn't work.
I managed to get it work using "volatile" keyword before variables declaration in uartRingBufDMA.c but I'm not sure what's going on ^^.
Regarding TIMEOUT variable wouldn't it be better managed this way:
in uartRingBufDMA.h:
extern volatile int32_t TIMEOUT;
in uartRingBufDMA.c:
volatile int32_t TIMEOUT = 0;
in stm32xxxx_it.c:
#include uartRingBufDMA.h:
/* USER CODE BEGIN SysTick_IRQn 1 /
TIMEOUT--;
/ USER CODE END SysTick_IRQn 1 */
volatile int isOK = 0; seems nice, otherwise it will be optimize and it will kill usage of isConfirmed() same for isDataAvailable
Regarding others variable I'm not quite sure, seems it's working with only Head and Tail set as volatile ...
Another unrelated question : can you explain what's the purpose of HAL_Delay(100) in your uartRingBufDMA.c functions ?
Again, thank you so much for great content sharing !
Have a good day,
Thomas