cancel
Showing results for 
Search instead for 
Did you mean: 

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

PRedd.5
Associate II

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 ?

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

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".

View solution in original post

4 REPLIES 4
TDK
Guru

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
Associate II

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

TDK
Guru

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.
Evangelist III

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

-- pa