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.

TMS570LS CAN Message Reception Problem

Other Parts Discussed in Thread: HALCOGEN

Hie, 

I am using the TMS570LS HDK, It is receiving many messages on the CAN bus, but I want to turn on an NHET LED when a Message with a particular ID i.e say 650 is received. 

I have generated the code from Halcogen, with the foll conf

1-> Activating the driver for CAN1

2-> Activating the messageBox1 and configuring it to transmit 

3-> changing the ID form default to the reqd Id i.e 650.

I have the foll code in CCS. 

/* USER CODE BEGIN (1) */
#include "can.h"
#include "het.h"
/* Include ESM header file - types, definitions and function declarations for system driver */
#include "esm.h"

#define D_SIZE 9

uint8 tx_data[D_SIZE] = {'H','E','R','C','U','L','E','S','\0'};
uint8 rx_data[D_SIZE] = {0};
uint32 error = 0;
uint8 rec_flag;
/* USER CODE END */


void main(void)
{
/* USER CODE BEGIN (3) */

/* initialize can 1 and 2 */
canInit(); /* can1 -> can2 */
gioInit();
/* transmit on can1 */gioSetDirection(hetPORT1, 0xFFFFFFFF);

/*... wait until message receive on can2 */

while(!canIsRxMessageArrived(canREG1, canMESSAGE_BOX1))

{
gioSetBit(hetPORT1,27,1);
}
rec_flag = canGetData(canREG1, canMESSAGE_BOX1, rx_data); /* receive on can2 */
if (rec_flag ==1)
{
gioSetBit(hetPORT1,00,1);
}
else if (rec_flag ==0)
{
gioSetBit(hetPORT1,05,1);
}
else if(rec_flag ==3)
{
gioSetBit(hetPORT1,31,1);
}/* ... run forever */

while(1);

/* USER CODE END */
}

While doing this, the code goes into the while loop and waits, i.e. it is not recieving any message. 

I would please request you to help me.. please

  • Ishan,

    (1) How do you connect CAN1 to CAN2?

    (2) Is the message from CAN1 recognizable on CAN2? In other words, You need to set up a mailbox on CAN 2 which matches the ID of the message from CAN1. I would suggest you to check the TRM for details.

    Thanks and regards,

    Zhaohong

  • Hie, 

    I am not connecting CAN1 to CAN2, As I Said I have an live CAN Bus which I am connecting to the DCAN1 Port on the HDK i.e The CAN High CAN Low and GND to the corresponding port on the CAN Bus.

    And for matching of the ID's

    I am sending a Message with ID 610 on the CAN Bus and have set the ID on the Message_BOX 1 as 610,

    Also tried keeping the Mask as 0x000000, so as to receive message with any ID on the CAN bus,   but m not able to get it.

  • Ishan,

    I thought that you are doing a CAN1/CAN2 communication because your first  post says that CAN1 is set up for transmission and one comment in your source code says waiting for CAN2 receive.

    There are a couple of thing you need to check if the DCAN module on MCU does not communicate with other terminals on the CAN bus.

    (1) If the board rate is correct. To check it, it can keep other terminals idling, let DCAN module to send a message. You can check if other terminals receive message correctly or check the bit timing with a oscilloscope.

    (2) Check if the software working correct. You can check if the source code has all the needed instructions and if the DCAN registers have the correct value. The following thread contains information about how to set up a DCAN module for communication.

    http://e2e.ti.com/support/microcontrollers/hercules/f/312/t/259769.aspx

    Thanks and regards,

    Zhaohong

  • Ishan,

    Did this response resolve your issue?  If so please click the green "verify answer" button and we will close this thread.

    Thanks!

    Paul