6 years, 5 months ago.  This question has been closed. Reason: Duplicate question

Cannot disable CAN receive interrupt (LPC1768)

I am receiving CAN messages via an interrupt routine. This is working as expected and is initiated as follows:

can2.attach(&canRcvInterrupt, CAN::RxIrq);

My application requires that the user enables or disables the CAN bus, so I have used the following statement to stop the receive interrupt:

can2.attach(NULL, CAN::RxIrq);

The API states: / Attach a function to call whenever a CAN frame received interrupt is generated.

  • @param func A pointer to a void function, or 0 to set as none
  • @param event Which CAN interrupt to attach the member function to (CAN::RxIrq for message received, CAN::TxIrq for transmitted or aborted, CAN::EwIrq for error warning, CAN::DoIrq for data overrun, CAN::WuIrq for wake-up, CAN::EpIrq for error passive, CAN::AlIrq for arbitration lost, CAN::BeIrq for bus error)
  • / void attach(Callback<void()> func, IrqType type=RxIrq);

I find that the receive interrupt is still executed despite setting the pointer to NULL.

Am I doing something wrong?

Thanks, Chris.

Fixed - isolated bug elsewhere!

posted by Chris Mabey 31 Oct 2017