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.
Hi there,
I understand that the NewDat bit can only be reset when the message object is read via the interface registers. When transmitting, the SW can poll the message object and get the actual TX data without issue.
However, even when the external CAN simulator stops TX data, and this can be confirmed that no message is actually on the bus, polling the MCTL register NewDat bit returns always '1', so the SW ends up always reading the same message contents.
This goes always only when I restart the target.
The following is how the SW poll the MCTL register NewDat bit, which is supposed to clear the corresponding bit in the actual CAN message RAM (DCANxNWDATxx), but it didn't:
while (DCAN1IF2CMD_bit.Busy) continue; dcan1if2cmd_bit.WR_RD = 0; // 0 = IFx register set<-message object dcan1if2cmd_bit.Arb = 1; // transfer arbitration details dcan1if2cmd_bit.Control = 1; // transfer message control details dcan1if2cmd_bit.DataA = 1; // update data set A dcan1if2cmd_bit.MessageNumber = CAN_MSG_BARO_SET; DCAN1IF2CMD = dcan1if2cmd; while (DCAN1IF2CMD_bit.Busy) continue; if (DCAN1IF2MCTL_bit.NewDat) // baro-setting message RX { baroSet.Int32 = (u32) DCAN1IF2DATA_bit.Data0 << 24 | (u32) DCAN1IF2DATA_bit.Data1 << 16 | (u32) DCAN1IF2DATA_bit.Data2 << 8 | (u32) DCAN1IF2DATA_bit.Data3; }
Thank you for any suggestion to make the NwDat bit clearing effective.
Hi
The newDat bit is cleared by reading the message object if TxRqst/NewDat =1.