I use another TMS570LC43x launchpad with transceivers connected.
DCAN 3 as transmitter to transmit data and DCAN 4 as receiver to receive data, but receiver doesn't get the data.
DCAN 3 transmits data to the registers DCAN IF1DATA and DCAN IF1DATB. How to make sure that data are go to pin Tx?
For Receiver only check register NWDATx? The code hang on
while(!canIsRxMessageArrived(canREG4, canMESSAGE_BOX1));
Have neve get change in register NWDATx.
Two of below are connected via P1 connectors. the up one is CAN4 as receiver, down one is CAN3 as transimitter.
The codes:
uint32 canTransmit(canBASE_t *node, uint32 messageBox, const uint8 * data)
{
node->IF1DATx[i] = *data;
}
DCAN 4 receives data from
uint32 canIsRxMessageArrived(canBASE_t *node, uint32 messageBox)
{
flag = node->NWDATx[regIndex] & bitIndex;
}
flag has never be set, so codes are loop here infinitely in while loop in main().
uint32 canGetData(canBASE_t *node, uint32 messageBox, uint8 * const data)
{
*pData = node->IF2DATx[s_canByteOrder[i]];
}
int main(void)
{
/* USER CODE BEGIN (3) */
canInit(canREG3); // Initialize the CAN Module Channel3
canInit(canREG4); // Initialize the CAN Module Channel4
canTransmit(canREG3, canMESSAGE_BOX1, tx_data); // Transmit data through Msg Box1 of CAN3
while(!canIsRxMessageArrived(canREG4, canMESSAGE_BOX1)); // Wait till a message is received on CAN4, Msg Box1
canGetData(canREG4, canMESSAGE_BOX1, rx_data); // Store the received data in rx_data
error = checkPackets(&tx_data[0], &rx_data[0], D_SIZE); // Check if the message received is same as expected
while(1); // Infinite Loop
/* USER CODE END */
}
Thanks,