Hi,
I need to run an interrupt as fast as possible, if only for just a test, so I want to see disable anything that may preempt it. How can I achieve this? Right now I removed the prologue and epilogue and typed this directly:
#undef port_lock
#undef port_unlock
#define port_lock() asm volatile ("cpsid i" : : : "memory")
#define port_unlock() asm volatile ("cpsie i" : : : "memory")
port_lock();
/* interrupt code */
port_unlock();
but still have a lot of variation (I'm toggling a pin).
Is there a way to ensure this interrupt is not preempted at all?
T
fastest possible interrupt
Moderators: RoccoMarco, lbednarz, tfAteba
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: fastest possible interrupt
Hi,
You don't need to change anything. It is possible to have interrupts that are never preempted, you have to assign them a priority higher than CORTEX_BASEPRI_KERNEL (just priority zero, the highest, using the default settings).
Also, the interrupt handler then is assumed to be "fast" and must use a slightly different declaration, see the article:
http://www.chibios.org/dokuwiki/doku.ph ... interrupts
There are no prologue and epilogue.
Fast interrupts are never preempted except from other fast interrupts with higher priority however fast interrupts cannot interact with the kernel directly, if needed you can perform an indirect communication by triggering a PENDSV software interrupt which is executed at kernel priority (this is often called segmented interrupts handling).
Giovanni
You don't need to change anything. It is possible to have interrupts that are never preempted, you have to assign them a priority higher than CORTEX_BASEPRI_KERNEL (just priority zero, the highest, using the default settings).
Also, the interrupt handler then is assumed to be "fast" and must use a slightly different declaration, see the article:
http://www.chibios.org/dokuwiki/doku.ph ... interrupts
There are no prologue and epilogue.
Fast interrupts are never preempted except from other fast interrupts with higher priority however fast interrupts cannot interact with the kernel directly, if needed you can perform an indirect communication by triggering a PENDSV software interrupt which is executed at kernel priority (this is often called segmented interrupts handling).
Giovanni
Re: fastest possible interrupt
Thanks! I hadn't realized you had foreseen this need already.
I should probably re-read the documentation periodically
I got an SPI slave working at 4.5 megabits/s! (without DMA, the type of SPI protocol that responds immediately)
I should probably re-read the documentation periodically
I got an SPI slave working at 4.5 megabits/s! (without DMA, the type of SPI protocol that responds immediately)