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.

TMS320F280025C: CAN RX interrupt doesn't fire

Part Number: TMS320F280025C

Tool/software:

I'm trying to get the example "can_ex2_loopback_interrupts" working in non-test mode.

I've referenced sprace5a, but I still can't figure out what I'm doing wrong.

I have 2 physical CAN nodes connected with a T connection to the launchpad's J14 H/L pins.  And I changed the CAN ROUTE S4 toggle to "XCVR".

I updated the example project to use the default CAN GPIO pins 32/33:

#define DEVICE_GPIO_PIN_CANTXA      32U             // GPIO number for CANTXA
#define DEVICE_GPIO_PIN_CANRXA      33U             // GPIO number for CANRXA
#define DEVICE_GPIO_CFG_CANTXA      GPIO_32_CANA_TX  // "pinConfig" for CANA TX
#define DEVICE_GPIO_CFG_CANRXA      GPIO_33_CANA_RX  // "pinConfig" for CANA RX

I commented out the CAN_enableTestMode() call.

I left all of the clock settings as is, with the default values.

I can transmit/receive CAN msgs fine by polling.  But the CAN interrupt only ever fires with status = CAN_INT_INT0ID_STATUS and TX_MSG_OBJ_ID, never RX_MSG_OBJ_ID.

Thank you,

Diane

  • I see similar behavior when I try to run "can_ex5_transmit_receive" in receive mode.

    I generate CAN traffic with an external, 3rd-party tool (ESD CANreal).

    The ISR only fires with status = CAN_INT_INT0ID_STATUS.

    Inside the ISR I can see the CAN_ES register indicates an RxOk:

  • Hi,

    Seems like the CAN frame has been received on both of your tests that fact that you can monitor the "status" variable inside the ISR.  On the host, can you match the message ID to 0x1 and see if you can receive the frame?

    Regards,

    Joseph

  • Joseph,

    Seems like I had 2 different problems going on.  In both "can_ex5_transmit_receive" and "can_ex2_loopback_interrupts" I forgot to add the RX msg mask:

        CAN_setupMessageObject(CANA_BASE, RX_MSG_OBJ_ID, 0x15555555,
                               CAN_MSG_FRAME_EXT, CAN_MSG_OBJ_TYPE_RX, 0xFFFFFFFF,
                               CAN_MSG_OBJ_RX_INT_ENABLE | CAN_MSG_OBJ_USE_ID_FILTER, MSG_DATA_LENGTH);

    But in my actual application (which is too long to attach), I was setting the RX_INT_ENABLE flag like this, which doesn't seem to work:

        //
        // Enable receive interrupts if they should be enabled.
        //
        msgCtrl |= (flags & CAN_MSG_OBJ_RX_INT_ENABLE);
        
        //
        // Set the Control, Arb, and Mask bit so that they get transferred to the
        // Message object.
        //
        cmdMaskReg |= CAN_IF1CMD_ARB;
        cmdMaskReg |= CAN_IF1CMD_CONTROL;
        cmdMaskReg |= CAN_IF1CMD_MASK;
        cmdMaskReg |= CAN_IF1CMD_DIR;
    
        //
        // Write out the registers to program the message object.
        //
        HWREG_BP(base + CAN_O_IF1MSK) = maskReg;
        HWREG_BP(base + CAN_O_IF1ARB) = arbReg;
        HWREG_BP(base + CAN_O_IF1MCTL) = msgCtrl;
        
        //
        // Transfer data to message object RAM
        //
        HWREG_BP(base + CAN_O_IF1CMD) =
        cmdMaskReg | (objID & CAN_IF1CMD_MSG_NUM_M);

    Instead setting it via CAN_setupMessageObject() works:

        // Setup mbox 2 for RX
        CAN_setupMessageObject(CANA_BASE,
                               2,
                               0x80,
                               CAN_MSG_FRAME_STD,
                               CAN_MSG_OBJ_TYPE_RX,
                               0x1FFC0000,                       // msg id mask to accept all msg ids
                               CAN_MSG_OBJ_RX_INT_ENABLE | CAN_MSG_OBJ_USE_ID_FILTER,        // enable RX msg mask
                               8);

    Now the interrupt is firing as expected.

    Thank you,

    Diane