Nov 06, 2019
02:35 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Nov 06, 2019
02:35 AM
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
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
- Tags:
- IFX
1 Reply
Nov 06, 2019
03:03 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Nov 06, 2019
03:03 AM
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™
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™
This widget could not be displayed.