Fast interrupt with OS-Less

Discussions and support about ChibiOS/HAL, the MCU Hardware Abstraction Layer.
Jack666
Posts: 5
Joined: Mon Oct 03, 2016 10:38 am
Been thanked: 1 time

Fast interrupt with OS-Less

Postby Jack666 » Thu Oct 13, 2016 10:23 am

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

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: Fast interrupt with OS-Less

Postby Giovanni » Thu Oct 13, 2016 10:32 am

Hi,

The macro is missing in OSAL but a fast interrupt handler is a normal void function, declare it as:

Code: Select all

void VectorXX(void) {

}


BTW, it is missing because it is not required by HAL.

Giovanni

Jack666
Posts: 5
Joined: Mon Oct 03, 2016 10:38 am
Been thanked: 1 time

Re: Fast interrupt with OS-Less

Postby Jack666 » Thu Oct 13, 2016 1:56 pm

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)

Code: Select all

#define STM32_TIM4_SUPPRESS_ISR



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
};


Return to “ChibiOS/HAL”

Who is online

Users browsing this forum: No registered users and 12 guests