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.
Hello everybody,
i am searching for a possibility to check, if a can.message was lost during the communication. In order to test these case,
i send 4 messages with the same messageID and i only configure one Messagebox with the same messageID as the four tx-messageboxes.
i configured the messageboxes like:
-messagebox[1-4] are Tx-messageboxes with the same messageID 1
-messagebox[33-36] are Rx-messageboxes with respectively messageID 1 - 4
i observed the the MsgLst-bit in the IF2MCTL register to check, if any change happened. but nothing change. it remains all the time 0.
Does someone know, how i can find out a lost message.
Below my code
char Data[8] = "Hello"; char Data2[8] = "world!"; uint8 MsgID = 1, a = 0; uint8 DataArray[4][8]; uint32 i; canInit(); canEnableloopback(canREG1, Internal_Lbk); memcpy(&DataArray[0][0], Data, 8); memcpy(&DataArray[1][0], Data2, 8); memcpy(&DataArray[2][0], Data, 8); memcpy(&DataArray[3][0], Data2, 8); for (i = 1; i<= 4; i++){ canUpdateID(canREG1, i , 0x40000000U | 0x20000000U | (MsgID & 0x1FFFFFFFU)); ResultOfTransmission = canTransmit(canREG1, i, DataArray[i-1]); canUpdateID(canREG1, i + 32, 0x40000000U | (i & 0x1FFFFFFFU)); } while(1){ static UINT32 j = 33; UINT8 i; uint32 ValueOfMsgLst = 0, ValueOfNewdata = 0; printf("**** Round nr %d*******\n", j); ValueOfMsgLst = (uint32)(canREG1->IF2MCTL & (1 << 14)); ValueOfNewdata = (uint32)(canREG1->IF2MCTL & (1 << 15)); if (a < 4){ ResultOfTransmission = canGetData(canREG1, j , &data[a][0]); } a++; }
Hello,
The CAN message handler stores the message from the CAN core shift register into the message object in the message RAM. The NewData bit is set to indicate that the new data is received. The CPU should reset the NewDat bit when it reads the message object through IFx. If at the time of the reception the NewDat bit was already set, MsgLst is set to indicate that the previous data is lost.
Can you please check if the NewData bit of Message Object 33 is SET after you receive the new message?