Other Parts Discussed in Thread: HALCOGEN
Hi,
I am trying to implement the CAN messages interrupt. I have two Hercules RM57Lx kits. I have successfully implemented the CAN messages on both of them. I created following CAN setting using HALCOGEN
One KIT is working as the TX and other is as the RX. However, I am facing issues with interrupt-based communication. The issue is I am able to get the interrupt for the canMESSAGE_BOX1 but I fail to get interrupt when I just send the canMESSAGE_BOX2 message from TX controller to RX. Both messages are sent to RX controller which can read them but interrupt occurs for just the canMESSAGE_BOX1 controller. Also this function
canIsRxMessageArrived(canREG1, canMESSAGE_BOX1)
works fine for canMESSAGE_BOX1 and the controller can learn if there is a message in the canMESSAGE_BOX1, but when I call the function canIsRxMessageArrived(canREG1, canMESSAGE_BOX2), it always returns false. However, if I ignore it, just call
canGetData(canREG1, canMESSAGE_BOX2, rxData);
function to read the data in MessagBox2, it reads the data which I have send from TX controller perfectly fine. Code is given below. What I am missing here?
My TX code main file is
int main(void)
{
/* USER CODE BEGIN (3) */
unsigned long int index;
canInit();
while (1)
{
canTransmit(canREG1, canMESSAGE_BOX1, (const uint8 *) &txData[0]);
for (index = 0; index < 4967000; index++)
{}
canTransmit(canREG1, canMESSAGE_BOX2, (const uint8 *) &LEDOn[0]);
for (index = 0; index < 4967000; index++)
{}
}
}
RX Code :
int main(void)
{
/* USER CODE BEGIN (3) */
canInit();
sciInit();
vimInit();
_enable_interrupt_();
sciSend(sciREG1, 15, "Prgram starting\r");
while (1)
{
// while(!canIsRxMessageArrived(canREG1, canMESSAGE_BOX1));
while (isCANInterruptOccured == 0); //
if (canIsRxMessageArrived(canREG1, canMESSAGE_BOX1) == true)
{
canGetData(canREG1, canMESSAGE_BOX1, rxData);
sciSend(sciREG1, D_SIZE, &rxData[0]);
}
if (canIsRxMessageArrived(canREG1, canMESSAGE_BOX2) == true)
{
canGetData(canREG1, canMESSAGE_BOX2, rxData);
sciSend(sciREG1, D_SIZE, &rxData[0]);
}
isCANInterruptOccured = 0;
}
/* USER CODE END */
return 0;
}
