Robots are revolutionizing our lives in many ways. Join our webinar to learn about Infineon’s broad portfolio of robot building blocks.
Click here to register.

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

AURIX™ Forum Discussions

Level 3
Level 3
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

#8042000 13432
1 Reply
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
This widget could not be displayed.