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.

TMS570: DCAN transmitting empty messages

Other Parts Discussed in Thread: HALCOGEN

Hello,

I'm trying to transmit a CAN message with the DCAN module of a TMS570LS31x HDK board. I'm using DCAN drivers generated from HalCoGen together with FreeRTOS. The board is indeed transmitting CAN messages, but the problem is that everything in the messages is set to zero. Identifier = 0x00, DLC = 0, and there's no data in the data fields. I've tried to configure the mailbox to get a different identifier, but the identifier is zero regardless of my settings. 

The mailbox I'm using has the following configuration:

    canREG1->IF1MSK = 0x40000000U | ((0x000007FFU & 0x1FFFFFFFU) << 0U);

    canREG1->IF1ARB = 0x80000000U | 0x40000000 | 0x20000000U | ((1U & 0x1FFFFFFFU) << 0U);

    canREG1->IF1MCTL = 0x00001080U | 0x00000000U | 8U;

    canREG1->IF1CMD = 0xF8;

    canREG1->IF1NO = 1;

What may be the problem?

Thanks for your help!

Regards,

Alexandra

 

  • Alexandra,

    I am attaching some example code for setting the DCAN module. Please let me know if provides the information you need.

    2055.CAN Communication.zip

    Thanks and regards,

    Zhaohong

  • I tried to compile the example code, but it gave me some errors and warnings. I corrected them and was able to compile the code, but I couldn't see that any messages was transmitted when I executed it on the MCU.

     

    However, after I tried the example code I switched back to my own code (without changing it from last time). Now, messages are transmitted, and the ID has changed from 0x00 to 0xBCDE9E (extended), and DLC has changed from 0 to 115. Maybe the problem is with the CAN RAM?

     

    Thanks and regards,

    Alexandra

  • Alexandra,

    The test I sent is a code example about how to set up DCAN module. It is not a complete CCS project but they are the codes we used in our testing. In our test, MCU communicates with a PC via CAN bus. If you follow the steps in the example code, you should be able to establish the CAN communication link. Please ay attention that you need to set up the interface registers correctly in order to pass information to DCAN RAM. Write to the mailbox number in the IF command register triggers a transfer between IF registers and DCAN RAM. You need to poll the busy bit to wait for the transfer to complete. You should write to IF command register once in 32 bit. If you set individual bits, the assembly code generated by the EABI library performs at 32 bit read-modify-write operation which will trigger a transfer between If registers and some mailbox (may be unintended ones) in the DCAN RAM. The DCAN module has passed intensive testing.

    Thanks and regards,

    Zhaohong

  • Hi,

    I connected CAN1 pins located on DRV8301-LS31-KIT to kvaser-usbcanII(HS/HS). and running code created by HCG . I have Frame Error. would you please put a CCS working example for this combination in this forum, or guide me to solution. Thanks very much. Ali Riza