Page 1 of 1
Fast interrupt with OS-Less
Posted: Thu Oct 13, 2016 10:23 am
by Jack666
Hi,
I would like to use a fast interrupt to use with the GPT driver without OS (os-less).
I can't declare a fast interrupt with CH_FAST_INTERRUPT_HANDLER as it belong to RT kernel.
I can declare a "normal" interrupt with OSAL_IRQ_HANDLER() (defined in osal.h), but there is no OSAL_FAST_IRQ_HANDLER().
or maybe, i missed somting ?
Thanks
Re: Fast interrupt with OS-Less
Posted: Thu Oct 13, 2016 10:32 am
by Giovanni
Hi,
The macro is missing in OSAL but a fast interrupt handler is a normal void function, declare it as:
BTW, it is missing because it is not required by HAL.
Giovanni
Re: Fast interrupt with OS-Less
Posted: Thu Oct 13, 2016 1:56 pm
by Jack666
Thank you Giovanni.
And for readers who want to write their own interrupt handler with ChibiOS drivers, like me:
- Don't forget to declare the SUPPRESS_ISR macro. (in my case, the timer4: STM32_TIM4_SUPPRESS_ISR)
- Don't forget to clear the status register flag in your ISR
- Don't forget to not put NULL in callback driver declaration!
So, in my case, i need a timer4 fast interrupt for stm32 platform:
(i put this in my osalconf.h, as in main.c it makes compilation warnings)
My fast ISR:
Code: Select all
void VectorB8(void) // STM32_TIM4_HANDLER
{
(&GPTD4)->tim->SR = 0; // clear interrupt flag
// your code here
}
My GPTConfig declaration for TIM4:
Code: Select all
static const GPTConfig gpt4cfg = {
1000000, // frequency
1, // callback func. Don't put NULL here!
0,
0
};