Skip to main content
bhargava
Associate II
July 24, 2015
Question

Disabling a particular IRQ in code

  • July 24, 2015
  • 1 reply
  • 637 views
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
This topic has been closed for replies.

1 reply

Tesla DeLorean
Guru
July 25, 2015
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 (See Profile) Up vote any posts that you find helpful, it shows what's working..