Why do my CAN messages have a recieve pending flag set with nothing connected?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User18151
Level 3
Level 3
First like received First solution authored
Hi all,

On AURIX TC27x I am setting a number of message objects but when I debug the code, as soon as I set the message valid (MSGVAL) flag in the message control register the RXPND Flag becomes set even if there is nothing connected.

This does not happen to all message objects - at the moment odd message objects are OK but even objects show this problem.

This is the code:

CAN_MOCTR0.B.RESRXPND = 1; // Clear RxPND Flag
CAN_MOCTR0.B.SETMSGVAL = 1; // Set Message Valid Flag

Do you know why is this?

Thank you for your help!

Best regards
Christine


#8042000 13432
0 Likes
2 Replies
User18237
Level 5
Level 5
First solution authored First like received
Hi Christine,


The issue here is that the Message Object Control Register {MOCTR) is write only and the Message Object Status Register (MOSTAT) is read only at the same address.
Your code above is performing a read modify write command and although you are expecting the value to be read from the MOCTR register, the MSGVAL flag to be set and the new value written back, what is actually happening is that the value is read from the (read only) Status Register, bit 24 (MSGVAL) is set then the new values is written to the (write only) Control Register.
The value of the upper bits in the Status Register (PNEXT and PPREV) ill determine what is written to the Control Register and if bit 16 was set then the RXPND bit will become set.

So, instead of trying to bit address the control register, you should just write the new value directly.


Best regards
Mr. AURIX™
0 Likes
almedbatlex
Level 1
Level 1
First reply posted Welcome!
  1. The CAN messages might have a receive pending flag set due to a default configuration in the CAN controller.
  2. Check if there are any internal or external pull-up resistors affecting the CAN bus lines.
  3. Ensure there are no loose connections or short circuits on the CAN bus lines.
  4. Verify that the CAN controller and transceiver are properly initialized and configured.
  5. Check for any interference or noise on the CAN bus click here, as it could trigger false receive pending flags.
  6. Inspect the termination resistors to ensure they match the bus specifications.
  7. Confirm that the bit rate settings on both ends of the CAN bus match.
  8. Examine the wiring for proper insulation and shielding to minimize electromagnetic interference.
  9. Review the CAN message filtering and acceptance mask settings to avoid unintended message receptions.
  10. Test with a termination resistor at only one end of the bus to eliminate potential reflection issues.
  11. Check the power supply voltage to the CAN controller and transceiver for stability.
  12. For further troubleshooting, click here to refer to the manufacturer's documentation or community forums for insights into specific hardware or software issues.
0 Likes