Send a message via serial driver within SysTick handler

Discussions and support about ChibiOS/HAL, the MCU Hardware Abstraction Layer.
Post Reply
neums
Posts: 137
Joined: Fri May 08, 2015 1:09 pm
Has thanked: 10 times
Been thanked: 5 times

Send a message via serial driver within SysTick handler

Post by neums »

Hi,
in my application the SysTick handler checks an error condition on which the controller runs into an endless loop and waits for the watchdog to reset. In the error case i want to send an error message via the serial driver with sdWrite. The problem i see is that at this point of time the controller is in the SysTick Interrupt state which is high priorised. So the serial driver can not send the data because it is block by the SysTick handler. Is this right so far?

Is there a way to use the SysTick and send a serial message within the SysTick handler via the serial driver? Is it possible to decreased the SysTick priority within the SysTick handler?

Or do i have to use a GPT as system tick to have a lower priority?

Thanks
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Send a message via serial driver within SysTick handler

Post by Giovanni »

Serial driver functions cannot be called by ISR context, you have 2 possible solutions:

1) Use a thread for I/O and wakeup it from your ISRs.

2) Use the UART driver that also has I-class functions.

Giovanni
Post Reply