Waking up a thread from a fast irq?

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
Tinker
Posts: 14
Joined: Tue Feb 28, 2012 6:55 pm

Waking up a thread from a fast irq?

Post by Tinker »

Hi,

I am using a "fast irq" for comm and inserting data into a lock-free queue as it comes in. So far so good...

I would like to signal a sleeping thread that there is data available, from inside the "fast irq". I know of two ways: (1) having the thread busy-waiting checking on the queue, or (2) trigger a regular EXTI irq from the "fast irq" and have the handler wake up the thread. Is there another way?

~T
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Waking up a thread from a fast irq?

Post by Giovanni »

Hi,

The recommended way is to trigger a normal IRQ to wake up the thread. This can be done using EXTI but there is a dedicated Cortex-M interrupt for that: "PendSVVector". Note that this vector is not available in the simplified kernel mode (the option CORTEX_SIMPLIFIED_PRIORITY which is not the default anyway).

Giovanni
Tinker
Posts: 14
Joined: Tue Feb 28, 2012 6:55 pm

Re: Waking up a thread from a fast irq?

Post by Tinker »

Awesome! That's the kind of solution I was hoping for. Thanks a lot,

~t
Post Reply