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