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.

TMDX570LC43HDK: CANTX

Part Number: TMDX570LC43HDK
Other Parts Discussed in Thread: HALCOGEN, TMS570LC4357

Hi Team,

I have tried the CANTx program which is given in  Hercules Tutorial : CAN Communication in TI using TMDX570LC43HDK board I used CAN1 driver. 

I have configured as per this tutorial "Hercules Tutorial : CAN Communication . 

Tried to receive data in CAN BUS Analyzer tool. But It doesn't came. 

I need a help to solve this issue. 

 

 

  • Hello,

    It should work.

    1. Your setup has only two CAN nodes, so a pull-up resistor is also required in Analyzer side. I think the analyzer has the capability to pull-up the bus.

    2. Both node should use the same baudrate

    3. Check the Analyzer's ID filter, and the ID of the message you transmitted

  • Hi Wang,

    Thank you for your fast response.

    Can you share me the HALCoGen Configuration for CAN TX and CAN RX.

    CAN1 General

    CAN TX

    CAN RX

    Any other configuration Did I need to make.

    Please share if you have any example configuration and code.

    Please check and confirm.

    Thanks and regards,

    Santhosh

  • Hi Wang,

    Please confirm the CAN1 General

    Calculated CAN1 timing  in "Hercules Tutorial : CAN Communication":

    Which I have configurated as below

    Please confirm this below setting also give example in HALCoGen.

    Thanks

    Santhosh.

  • Can you please repost the pictures or screenshots?

  • Hi Wang,

    I need a support on the CAN Rx Interrupt method, I have created the CAN TX in CAN1 and CAN RX in CAN2 

    CAN2 : node is always not equal to the canREG2  

    /* node 2 - receive complete */
    if(node==canREG2)
    {
    while(!canIsRxMessageArrived(canREG2, canMESSAGE_BOX1));
    canGetData(canREG2, canMESSAGE_BOX1, rx_ptr); /* copy to RAM */
    }

    I couldn't receive any data in this above reception CAN ID 0x300.

    CAN1 TX:

    CAN ID is 0x200

    CAN RX: 

    CAN ID is 0x300

    CAN Analyzer i sends the data but not hit the breakpoint also. Please check and confirm the CAN interrupt code is correct for TMS570LC4357. with the 

    TMDX570LC43HDK.

    and the code is 

    /* Include Files */

    #include "HL_sys_common.h"

    /* USER CODE BEGIN (1) */

    #include "HL_can.h"
    #include "HL_sci.h"

    #include "HL_esm.h"
    #include "HL_sys_core.h"

    #define UART sciREG1
    #define D_COUNT 8
    #define RX_COUNT 63
    #define SIZE 8

    typedef struct
    {
    uint8 R1;
    uint8 R2;
    uint8 R3;
    uint8 R3;
    uint8 R4;
    uint8 R5;
    uint8 R6;
    uint8 R7;
    }HX;

    uint32 cnt=0, error =0, tx_done =0;
    uint8 tx_data[D_COUNT] = {0};
    uint8 rx_data[D_COUNT] = {0};
    uint8 *tx_ptr = &tx_data[0];
    uint8 *rx_ptr = &rx_data[0];
    uint8 d1[D_COUNT] = {0};
    uint8 *dptr=0;
    HX Tx_data;
    void sciDisplayText(sciBASE_t *sci, uint8 *text, uint32 length);
    void wait(uint32 time);
    void dumpdata();

    int main(void)
    {
    _enable_interrupt_();


    sciInit();


    canInit();

    canEnableErrorNotification(canREG1);
    canEnableErrorNotification(canREG2);


    dumpdata();

    while(1)
    {


    canTransmit(canREG1, canMESSAGE_BOX1, &tx_data[0]);

    /* USER CODE END */
    }

    void dumpCMPRdata()
    {
    Tx_data.R1= 0xC8;
    Tx_data.R2=0x01;
    Tx_data.R3= 0xFA;
    Tx_data.R3 =0x05;
    Tx_data.R4 =0x10;
    Tx_data.R5 =0x20;
    Tx_data.R6 =0x30;
    Tx_data.R7 =0x88;

    /*for(i=0;i<8;i++)*/

    tx_data[0] = Tx_data.R1;
    tx_data[1] = Tx_data.R2;
    tx_data[2] = Tx_data.R3;
    tx_data[3] = Tx_data.R3;
    tx_data[4] = Tx_data.R4;
    tx_data[5] = Tx_data.R5;
    tx_data[6] = Tx_data.R6;
    tx_data[7] = Tx_data.R7;

    }

    void canMessageNotification(canBASE_t *node, uint32 messageBox)
    {
    /* node 1 - transfer request */
    if(node==canREG1)
    {
    tx_done=1; /* confirm transfer request */
    }

    /* node 2 - receive complete */
    if(node==canREG2)
    {
    while(!canIsRxMessageArrived(canREG2, canMESSAGE_BOX1));
    canGetData(canREG2, canMESSAGE_BOX1, rx_ptr); /* copy to RAM */


    }

    /* Note: since only message box 1 is used on both nodes we dont check it here.*/
    }

  • Just read your code, I guess you didn't enable the CAN interrupt in VIM module:

    If low priority is selected in CAN configuration, please enable VIM channel 42