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.

Using DCAN Interrupts

Other Parts Discussed in Thread: HALCOGEN

I need to work with TMS570 DCAN module in interrupt mode. As I understand, it is nessessary to set EIE and SIE bits for enabling 'Error' and  'Status Change' interrupts accordingly in the DCAN CTL register. Also I have set bits IE0 and IE1 in the DCAN CTL register for enabling both interrupt lines. After that I have assigned VIM channel 16 (can1HighLevelInterrupt) to IRQ, and also have enabled interrupts for corresponding message boxes for TX and RX in HALCoGen. I have configured Message Box 1-8 for TX and Message Box 9-16 for RX.

I can transmit and recieve messages, using canTransmit() and canGetData(), but i can't get the interrupt functionality when transmitting or recieving messages. Interrupt Handler for 'can1HighLevelInterrupt' just didn't work (I also cheked other handlers, for 'high' and 'low' level - with the same results), though the corresponding interrupt flag in the INTPNDx[12] register is set to '1' (its value, in my case, is '0x00000001' for transmittion and '0x00000100' for recieving). I also read the DCAN ES register during operation, and it shows '0x00000008' when transmitting a message (box 1), and '0x00000010' when recieving a message (box 9), so TxOK and RxOK flags shows the right values.

As I understand, the value '0x00010000' in the DCAN INT during transmittion shows that the interrupt from Message Box 1 is routed to DCAN1INT line (now I use only Message Box 1 for TX), and the value '0x00090000' in the DCAN INT during recieving shows that the interrupt from Message Box 9 is also routed to DCAN1INT line (now I use only Message Box 9 for RX). These values remains unchanged after the first transmittion or recieving. Is it right that they must be cleared in the DCAN interrupt handler or in another way?

In TRM document (spnu489a) I found that "Status Change interrupts can only be routed to interrupt line DCAN0INT", but as i see from the values of DCAN INT register these interrupts are routed to DCAN1INT. The value in the INTMUXx[12] register is '0x0000FFFF', as I set all interrupt priorities to 'High Priority' for Message Box 1-16 in the HALCoGen.

Thanks,

Evgenyy

  • Hi Evgenyy,

    Your query has been forwarded to our expert team members, will get back to asap

    Regards

    Hari

  • Evgenyy,

    From what you described, your CAN message setup generates the Rx and Tx interrupt to DCAN1INT. But your VIM settings only service the interrupt DCAN0INT. This might explain why you can not get any interrupt.

    Could you please remap the interrupt to 29 (DCAN1INT) to see if it works or not?

    Could you please check whether your program modify the INTMUX register somewhere?

    Thanks,

    Haixiao

  • Thank you,

    Haixiao.

    I have changed CAN interrupt channel to 29 and it works fine.

    My program didn't modify the INTMUX register anywhere. As I understand, if I want to map message interrupts to DCAN0INT I need to write '0' to appropriate channel value in INTMUX, which I want to map to DCAN0INT?

    Another question is... if I want to write my own interrupt handlers for TX and RX CAN frames, I must check the value of the DCAN INT register or just the value of INTPNDX and NWDATX registers?

    Thanks,

    Evgenyy.

  • Eegenyy,

    Yes, by default, the Rx and Tx interrupt will be mapped to DCAN0INT because INTMUX=0 after reset.

    The figure 16-9 in TRM explains this well. If IE0 or IE1 is set, DCAN INT will show the highest pending INTPNDx. If IE0 and IE1 are cleared, DCAN INT will never be set by Message Rx and Tx.

    Thanks,

    Haixiao

     

     

  • Thank you, Haixiao.

    Everything is clear.