Skip to main content
PRedd.5
Associate II
Oct 15, 2019 5:41 PM UTC
Solved

Is the HAL IRQ callback function running outside of irq context ? Is this a good place for some string processing ?

I am currently working with UART in DMA mode for CLI implimentation. I would like to do some string parsing as part of the HAL_UART_RxCpltCallback.

Is this callback running in IRQ context or outside of IRQ context ? Is this the correct place for post processing IRQ data ? What would you recommend ?

This topic has been closed for replies.
TDK
TDKBest answer
Oct 15, 2019 5:57 PM UTC

That runs from within an IRQ. As for if that’s the right place to process data or not, it really depends on how long processing takes. If it’s heavy, transfer data, set a flag and do it in the main thread. Otherwise, in the IRQ is fine.

"If you feel a post has answered your question, please click ""Accept as Solution""."

4 replies

TDK
TDKBest answer
Oct 15, 2019 5:57 PM UTC

That runs from within an IRQ. As for if that’s the right place to process data or not, it really depends on how long processing takes. If it’s heavy, transfer data, set a flag and do it in the main thread. Otherwise, in the IRQ is fine.

"If you feel a post has answered your question, please click ""Accept as Solution""."
PRedd.5
PRedd.5Author
Associate II
Oct 15, 2019 6:00 PM UTC

the processing is basically string compares to about 2 dozen commands and tokenizing command and arguement.

TDK
Oct 15, 2019 6:02 PM UTC

String compares are quick. Try it in the irq and if you get overrun issues you’ll have to do something else.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Pavel A.
Oct 15, 2019 6:05 PM UTC

The HAL interrupt callbacks run in IRQ context. Not a good place for lengthy processing.

-- pa