I am a beginner, and i followed the youtube tutorial on how to use CAN messaging on a TMS570LS37X HDK that i have. I have CAN1 and CAN2 connected together, so that i can send from CAN1 and recieve from CAN2 on same board. There is no response on terminal. I tried to monitor bus using a Kvaser Leaf lite, but blank bus is displayed here as well.
my code:
#include "sys_common.h"
#include "system.h"
#include "can.h"
#include "sci.h"
#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;
uint32 checkPackets(uint8 *src_packet,uint8 *dst_packet,uint32 psize);
void main(void)
{
canInit(); /* can1 -> can2 */
sciInit();
canTransmit(canREG1, canMESSAGE_BOX1, tx_data);
while(!canIsRxMessageArrived(canREG2, canMESSAGE_BOX1));
canGetData(canREG2, canMESSAGE_BOX1, rx_data); /* receive on can2 */
sciSend(scilinREG, D_SIZE, rx_data);
error = checkPackets(&tx_data[0],&rx_data[0],D_SIZE);
while(1);
}
uint32 checkPackets(uint8 *src_packet,uint8 *dst_packet,uint32 psize)
{
uint32 err=0;
uint32 cnt=psize;
while(cnt--)
{
if((*src_packet++) != (*dst_packet++))
{
err++;
}
}
return (err);
}