This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to disable CAN interrupts?

Other Parts Discussed in Thread: HALCOGEN

I am using CAN libraries and referring the example code in Halcogen for CAN interrupt communication.

The function "_enable_interrupt_();" will enable the interrupts and triggers the Interrupt handler "canMessageNotification(canBASE_t *node, uint32 messageBox);"

However, I need to do some computations once the interrupt occurs. Therefore, I need to disable interrupt. But the function _disable_interrupt_(); is not working.

What is the issue or which function should I call to disable the CAN interrupt?

Also," _enable_interrupt_();" is not defined anywhere. How is this function mapped to interrupt handler which is "canMessageNotification()"?

_enable_interrupt_();

  • Hi Dino,

    There are multiple levels of interrupt enable/disable gating. The path will be CAN Msg Object -> DCAN -> VIM -> CPU.

    The _enable_interrupt_() is used to enable interrupt in the CPU. To enable IRQ and FIQ interrupt in the CPU you need to clear the I and F bits in the CPU's CPSR register. The _enable_interrupt_() will clear both the bits. Once you disable interrupt at the CPU levet it can no longer service any interrupts from any modules, not just DCAN.

    By defaut, after CPU enters the interrupt, it automatically disable IRQ interrupt. This is to prevent nested interrupts. User can change this behavior if you want.

    If you want to specifially disable interrupt only for CAN then you can use the IE0 and IE1 bits in the DCAN CTL register or you can disable the CAN interrupt at the VIM level. At the lowest level, you can disable a specific CAN message object from generating interrupt by using either FxIE orTxIE bits in the message object.
  • Hi David,
    Do you have any more questions on the interrupt? If your question is answered can you please click the Verify Answer button? Thanks.
  • Sorry for the late reply..

    I used vimInterruptEnable to disable the interrupt at the ISR in the baremetal.

    However, when tried with Micrium OSIII, the interrupt does not occur. I tried the following things

    	vimInit();
    	vimChannelMap(16, 16, &can1HighLevelInterrupt );
    	vimEnableInterrupt(16, SYS_IRQ);
    

    No interrupt occurs??

    Please help me figure out why there is no interrupt??