• AVR Freaks

Hot!dsPIC33EV256GM106 _C1Interrupt never being called

Author
FalcioneE
New Member
  • Total Posts : 5
  • Reward points : 0
  • Joined: 2019/10/28 06:42:05
  • Location: 0
  • Status: offline
2019/11/06 10:15:02 (permalink)
0

dsPIC33EV256GM106 _C1Interrupt never being called

Hi all,
 
I am trying to create an interrupt that is triggered by the reception of a CAN bus message. It looks like MCC automatically generates an interrupt called _C1Interrupt with a place for me to put some additional code. However, I can't seem to trigger this interrupt.
 
Any suggestions for how I can trigger this interrupt? Or how I can use MPLAB's debugger to troubleshoot?
 
Thanks
#1

3 Replies Related Threads

    du00000001
    Just Some Member
    • Total Posts : 3314
    • Reward points : 0
    • Joined: 2016/05/03 13:52:42
    • Location: Germany
    • Status: offline
    Re: dsPIC33EV256GM106 _C1Interrupt never being called 2019/11/06 10:36:31 (permalink)
    0
    As I didn't yet fiddle with MCC and CAN on the 'EVs, I'm not sure what the _C1Interrupt() is for. But the comments should tell you that.
    Anyway, CAN interrupts are triggered mainly by the successful reception of a CAN message. Which requires e.g.
    • Setting up the message configuration to match a message to be sent by an external tool
    • Enabling the RX interrupt for this message
    • ...
    CAN has historically been a means to communicate without using communications-related interrupts - just checking the RX buffers every x ms. Considering the message buffers a dual-ported (distributed) RAM is not wrong: the message (including some info elements) will just sit and wait for "you" coming by and inspecting these.
    No need to hurry...

    PEBKAC / EBKAC / POBCAK / PICNIC (eventually see en.wikipedia.org)
    #2
    JPortici
    Super Member
    • Total Posts : 876
    • Reward points : 0
    • Joined: 2012/11/17 06:27:45
    • Location: Grappaland
    • Status: offline
    Re: dsPIC33EV256GM106 _C1Interrupt never being called 2019/11/06 12:14:46 (permalink)
    0
    The reference manual chapter on the CAN module MUST be read because the peripheral is not simple, at all. The manual has an entire section just for interrupts which describe the logic and how to configure the interrupt.
     
    To get an interrupt for reception, more or less..
    while the module is in configuration mode,
    set up the filters
    set up the fifos
    set up the interrupt conditions for the filters and the fifo
    enable the interrupt contidions for reception
    enable the general interrupt in the can module
    enable the interrupt in the interrupt controller
     
    then you can't force clear the interrupt flags in the can module, the only way to clear them is to remove the cause of interrupt, so in your case you will have to for example clear the rx fifo by reading and handling all frames
     
    but read the manual. read the manual. read the manual. Can't help you if you don't know how the module works
    #3
    FalcioneE
    New Member
    • Total Posts : 5
    • Reward points : 0
    • Joined: 2019/10/28 06:42:05
    • Location: 0
    • Status: offline
    Re: dsPIC33EV256GM106 _C1Interrupt never being called 2019/11/06 14:02:39 (permalink)
    0
    Can you link to the manual please? I've got an ECAN manual but can't seem to find one for the CAN module.
    #4
    Jump to:
    © 2020 APG vNext Commercial Version 4.5