Hardware: TMS570LC43x / RM57Lx 337 7WT Launchpad XL2
Code: code example DCAN_RX
int main(void)
{
/* USER CODE BEGIN (3) */
canInit(); // Initialize the CAN Module
sciInit(); // Initialize the SCI (UART) Module
while(!canIsRxMessageArrived(canREG1, canMESSAGE_BOX1)); // Wait till a message is received on CAN1, Msg Box1
canGetData(canREG1, 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
sciSend(sciREG1, D_SIZE, rx_data); // Send the received message through UART
while(1); // Infinite Loop
/* USER CODE END */
}
uint32 canIsRxMessageArrived(canBASE_t *node, uint32 messageBox)
{
uint32 flag;
uint32 regIndex = (messageBox - 1U) >> 5U;
uint32 bitIndex = 1U << ((messageBox - 1U) & 0x1FU);
/* USER CODE BEGIN (16) */
/* USER CODE END */
/** - Read Tx request register */
flag = node->NWDATx[regIndex] & bitIndex;
/* USER CODE BEGIN (17) */
/* USER CODE END */
return flag;
}
Issues:
The code run while loop at canIsRxMessageArrived() and stuck here.
It means that DCAN has never received data.
My question is where the application note for this codes example?
Are there any wired in at RX pin of DCAN1 port?
Thanks,
F