cancel
Showing results for 
Search instead for 
Did you mean: 

Disabling a particular IRQ in code

bhargava
Associate II
Posted on July 25, 2015 at 01:10

I'm developing a custom CAN bridge with the stm3210c-eval board, such that I can hook up the board's CAN port to a car's CAN bus and the USART port to a computer and read in received frames over a serial terminal. In the CAN interrupt handler I populate a CANRx struct that is shared with my main.c. I want to put in a flag so that the main program knows when to do a printf (which is redirected over USART), which requires that I disable the CAN interrupt (to do a flag check and printf). However, I can't find any exposed interface to block an irq. Does it exist, and if so, what do I need to import?

#irq-handling-stm32
1 REPLY 1
Posted on July 25, 2015 at 03:26

You have the NVIC and the peripheral level.

Consider however if you can just buffer things more effectively so you're not writing to a singular common buffer.

If you have a single writer, you can have multiple readers without requiring an atomic write. ie you can increment a sequence count in the interrupt, and then observe that change in the main loop.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..