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.

Compiler/AWR1443: can

Part Number: AWR1443
Other Parts Discussed in Thread: AWR1642,

Tool/software: TI C/C++ Compiler

Hi,

I want send data to two boards awr1642 from awr1443 DCAN.  below is the code. 

Second tx ID is not working.  

Two data are transmitting to the one board.  data might be over riding in RAM.  If I change the DCAN_TX_MSG_OBJ , the program is terminating. 

I am not understanding where the mistake is . please can you go through the below code and guide me.

DCANAppInitParams(&appDcanCfgParams,

&appDcanRxCfgParams,
&appDcanTxData);*/


DCANAppInitParams(&appDcanCfgParams,

&appDcanRxCfgParams);
// &appDcanTxData);


appDcanTxCfgParams.xIdFlagMask = 0x1;
appDcanTxCfgParams.dirMask = 0x1;
appDcanTxCfgParams.msgIdentifierMask = 0x1FFFFFFF;

appDcanTxCfgParams.msgValid = 1;
appDcanTxCfgParams.xIdFlag = CAN_DCANXidType_11_BIT;
appDcanTxCfgParams.direction = CAN_Direction_TX;
appDcanTxCfgParams.msgIdentifier = 0x24;

appDcanTxCfgParams.uMaskUsed = 1;
if (testSelection == DCAN_APP_TEST_PARITY)
appDcanTxCfgParams.intEnable = 0;
else
appDcanTxCfgParams.intEnable = 1;

appDcanTxCfgParams.remoteEnable = 0;
appDcanTxCfgParams.fifoEOBFlag = 1;
appDcanTxCfgParams.appCallBack = DCANAppCallback;

appDcanTxData.dataLength = DCAN_MAX_MSG_LENGTH;
appDcanTxData.msgData[0] = 0xA5;
appDcanTxData.msgData[1] = 0x5A;
appDcanTxData.msgData[2] = 0xFF;
appDcanTxData.msgData[3] = 0xFF;
appDcanTxData.msgData[4] = 0xC3;
appDcanTxData.msgData[5] = 0x3C;
appDcanTxData.msgData[6] = 0xB4;
appDcanTxData.msgData[7] = 0x4B;


appDcanTxCfgParams1.xIdFlagMask = 0x1;
appDcanTxCfgParams1.dirMask = 0x1;
appDcanTxCfgParams1.msgIdentifierMask = 0x1FFFFFFF;

appDcanTxCfgParams1.msgValid = 1;
appDcanTxCfgParams1.xIdFlag = CAN_DCANXidType_11_BIT;
appDcanTxCfgParams1.direction = CAN_Direction_TX;
appDcanTxCfgParams1.msgIdentifier = 0x32;

appDcanTxCfgParams1.uMaskUsed = 1;
if (testSelection == DCAN_APP_TEST_PARITY)
appDcanTxCfgParams1.intEnable = 0;
else
appDcanTxCfgParams1.intEnable = 1;

appDcanTxCfgParams1.remoteEnable = 0;
appDcanTxCfgParams1.fifoEOBFlag = 1;
appDcanTxCfgParams1.appCallBack = DCANAppCallback;


appDcanTxData1.dataLength = DCAN_MAX_MSG_LENGTH;
appDcanTxData1.msgData[0] = 0x11;
appDcanTxData1.msgData[1] = 0x22;
appDcanTxData1.msgData[2] = 0x33;
appDcanTxData1.msgData[3] = 0x44;
appDcanTxData1.msgData[4] = 0x55;
appDcanTxData1.msgData[5] = 0x66;
appDcanTxData1.msgData[6] = 0x77;
appDcanTxData1.msgData[7] = 0x88;

/* Initialize the CAN driver */
canHandle = CAN_init(&appDcanCfgParams, &errCode);
if (canHandle == NULL)
{
System_printf ("Error: CAN Module Initialization failed [Error code %d]\n", errCode);
return -1;
}

/* Set the desired bit rate based on input clock */
retVal = DCANAppCalcBitTimeParams(DCAN_APP_INPUT_CLK / 1000000,
DCAN_APP_BIT_RATE / 1000,
DCAN_APP_SAMP_PT,
DCAN_APP_PROP_DELAY,
&appDcanBitTimeParams);
if (retVal < 0)
{
System_printf ("Error: CAN Module bit time parameters are incorrect \n");
return -1;
}

/* Configure the CAN driver */
retVal = CAN_configBitTime (canHandle, &appDcanBitTimeParams, &errCode);
if (retVal < 0)
{
System_printf ("Error: CAN Module configure bit time failed [Error code %d]\n", errCode);
return -1;
}

/* Setup the transmit message object */

txMsgObjHandle1 = CAN_createMsgObject (canHandle, DCAN_TX_MSG_OBJ, &appDcanTxCfgParams1, &errCode);
if (txMsgObjHandle1 == NULL)
{
System_printf ("Error: CAN create Tx message object failed [Error code %d]\n", errCode);
return -1;
}

txMsgObjHandle = CAN_createMsgObject (canHandle, DCAN_TX_MSG_OBJ, &appDcanTxCfgParams, &errCode);
if (txMsgObjHandle == NULL)
{
System_printf ("Error: CAN create Tx message object failed [Error code %d]\n", errCode);
return -1;
}

/* Setup the receive message object */
rxMsgObjHandle = CAN_createMsgObject (canHandle, DCAN_RX_MSG_OBJ, &appDcanRxCfgParams, &errCode);
if (rxMsgObjHandle == NULL)
{
System_printf ("Error: CAN create Rx message object failed [Error code %d]\n", errCode);
return -1;
}


while (1)
{
/* Send data over Tx message object */
// System_printf("Data 1 Transmitting\n");
Task_sleep(1);
retVal = CAN_transmitData (txMsgObjHandle, &appDcanTxData, &errCode);
if (retVal < 0)
{
System_printf ("Error: CAN transmit data for iteration %d failed [Error code %d]\n", iterationCount, errCode);
return -1;
}

// by me
Task_sleep(1);
//System_printf("Data 2 Transmitting\n");
retVal = CAN_transmitData (txMsgObjHandle1, &appDcanTxData1, &errCode);
if (retVal < 0)
{
System_printf ("Error: CAN transmit data for iteration %d failed [Error code %d]\n", iterationCount, errCode);
return -1;
}
// Task_sleep(2);

Thanks and regards,

K Subrahmaniam