functions (e.g. printf) not working in timer callback function (Systick, Timer)
Hello,
I usually make a code based on the timer callback function to handle multiple tasks.
However, I don't know why functions like printf in the systick callback function don't work at all if the flag switching is in the same function.
It works If I put the same code in the main loop, but not in the callback function.
These kinds of problems sometimes happen with other functions, not only with printf.
I kindly wonder which point makes these results from the controller.
For example (flag is a global variable with 0 initial value),
void HAL_SYSTICK_Callback(void)
{
if(flag == 0){
printf("Check\r\n");
}
}
==> This gives tons of UART messages through printf func.
void HAL_SYSTICK_Callback(void)
{
if(flag == 0){
flag = 1;
printf("Check\r\n");
}
}
==> This never give any UART messages.
If it is done in the main function,
int main(void)
{
... init functions ...
while(1)
{
if(flag == 0){
flag = 1;
printf("Check\r\n");
}
}
==> This correctly gives UART message only once.
