Hi all,
As a test, Receiving two IDs(100, 101) normally with the code below.
#define RX_MAILBOX_0 0x0
#define RX_MAILBOX_1 0x1
#define RX_MSG_ID_0 (100UL)
#define RX_MSG_ID_1 (101UL)
int main(void)
{
................................................
/* Initialize Can0 */
CAN_Init(&can_pal1_instance, &can_pal1_Config0);
/* Configure RX buffer with index RX_MAILBOX */
CAN_ConfigRxBuff(&can_pal1_instance, RX_MAILBOX_0, &buffCfg, RX_MSG_ID_0);
CAN_ConfigRxBuff(&can_pal1_instance, RX_MAILBOX_1, &buffCfg, RX_MSG_ID_1);
CAN_ConfigTxBuff(&can_pal1_instance, TX_MAILBOX_0, &buffCfg);
CAN_ConfigTxBuff(&can_pal1_instance, TX_MAILBOX_1, &buffCfg);
while(1)
{
memset(&recvMsg0, 0, sizeof(can_message_t));
CAN_Receive(&can_pal1_instance, RX_MAILBOX_0, &recvMsg0);
if(recvMsg0.data[0] != 0)
{uartPrintf(&uartStateTX, "CAN id : %x [0] : %d \r\n", recvMsg0.id, recvMsg0.data[0]);}
memset(&recvMsg1, 0, sizeof(can_message_t));
CAN_Receive(&can_pal1_instance, RX_MAILBOX_1, &recvMsg1);
if(recvMsg1.data[0] != 0)
{uartPrintf(&uartStateTX, "CAN id : %x [0] : %d [1] : %d \r\n", recvMsg1.id, recvMsg1.data[0]);}
}
}
But if I want to receive IDs from 100 to 200, do I have to receive 100 mailboxes?
Can you please tell me how to receive in one MailBox?
Please let me know if you have a simple example.