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.

CCS/TMS320F280049C: CAN reading, DLC, arbid

Part Number: TMS320F280049C

Tool/software: Code Composer Studio

Hi,

I have read the the can message using interrupt 

after this function 

CAN_readMessage(CANB_BASE, RX_MSG_OBJ_ID, rxMsgData);

i can see the data. similarly i wanted to read the arbid and dlc 

so i put like this 

rx_id = HWREG_BP(CANB_MSG_RAM_BASE + RX_MSG_OBJ_ID * 0x20 + 0x08); 

still i read 0 only after that code.

Regards

LT

  • Hi Lakshmi,

           Not sure that will work but you can try reading CAN_IF2ARB register for the arbid:

                         rx_id = HWREG(CANB_BASE + CAN_O_IF2ARB) & 0x1FFFFFF; // [28:0] 29 bits arb id

           For DLC, try reading CAN_IF2MCTL register:

                           dlc = HWREG(CANB_BASE + CAN_O_IF2MCTL) & 0xF; // [3:0] 4 bits DLC

    Regards,

    Joseph

                        

  • Hello Joseph,

    I tried 

    rx_id = HWREG(CANB_BASE + CAN_O_IF2ARB) & 0x1FFFFFF; 

    rx_id stays at 0, while data is updated. I am using std_id still i need to see some junk in rx_id.

    Some doubts:

    1. in the above equation i don't see any macro or variable corresponding to obj_id, because i am using no 17.
    2. During debug mode, the Message RAM cannot be accessed via the IFx register sets says in sprui33c.pdf

    Regards
    LT

  • Hi Lakshmi,

    Couple of questions:

            - Which IF register were you using reading out the CAN message, is it IF1 or IF2?

            - For the ID that you are interested to read out, is it the message object ID (1 to 32) or the arbitration ID (unique ID from transmitting node, 11-bit std or 29-bit extended)?

    Thanks,

    Joseph

  • Hi,

     - Which IF register were you using reading out the CAN message, is it IF1 or IF2?

    I am using this function from diverlib

    CAN_readMessage(CANB_BASE, 17, rxMsgData);

    - For the ID that you are interested to read out, is it the message object ID (1 to 32) or the arbitration ID (unique ID from transmitting node, 11-bit std or 29-bit extended)?

    • Yes i am using message obj id 17, 
    • I am receivng all messages and 

    CAN_setupMessageObject(CANB_BASE, 17, 0x00,
    CAN_MSG_FRAME_STD, CAN_MSG_OBJ_TYPE_RX, 0,
    CAN_MSG_OBJ_RX_INT_ENABLE | CAN_MSG_OBJ_USE_ID_FILTER, 8);

    Regards,
    LT

  • Hi Lakshmi,

    If you are using driverlib, then it is IF2.  Sorry, I omitted one step.  Do this first before reading arbID and DLC.  The function below would transfer the data from message RAM to IF2 register (you can also look at possible values of the arguments to the function in driverlib):

    CAN_transferMessage(CANB_BASE, 2, 17, false, false);

    then:

    rx_id = HWREG(CANB_BASE + CAN_O_IF2ARB) & 0x1FFFFFF; // [28:0] 29 bits arb id

    dlc = HWREG(CANB_BASE + CAN_O_IF2MCTL) & 0xF; // [3:0] 4 bits DLC

    Regards,

    Joseph