- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm experimenting with the auto RTR function. I have it working in the sense that when node A sends msg ID 0x001 with the RTR bit set, I have node B automatically sending a response that A picks up.
What is not working is that I get no data. Node B initializes rx buffer 0 with a DLC of 8 and DH/DL set to 0x1122334455667788. I can verify this by looking at CAN_RX[0] in the memory view of the debugger:
0x4000a0a0: 0080001a 00200000 44332211 88776655 0x4000a0b0: 001ffff9 00200002 ffffffff 00000000
The message returned by node B is correct except that the DH/DL registers are zeroed. I have rx buffer 1 set up to match the message ID (without RTR set):
0x4000a0c0: 00000029 003ffff8 00000000 00000000 0x4000a0d0: 001ffff9 00200000 ffffffff 00000000
(note that the received DLC is 0). I thought perhaps node A had to set the desired DLC on the outgoing RTR frame, but that did not help.
Is it not possible to send back data in an automatic RTR response? I am setting this data before I ever receive a message, and it does not change during the life of the program. The auto-RTR reply section in the TRM states that the contents of the buffer which received the RTR frame will be sent, but I am not seeing this.
- Labels:
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The RTR example projects 3 and 4 given along with the Application note (http://www.cypress.com/?rID=37766) shows how to get payload data with RTR.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is an error in the example project, the command has to be send to the corresponding mailbox (might work for MB 0, but not if you want to use a different one).
Step 1:
Set up the receive mailbox with RTR and RTR reply set in the module. IRQ is not required.
Step 2:
-----------------------
Byte1 => Reserved,
Byte 2 => last four bits used to specify datalength, (what about the first nibble?)
Byte 3 => Reserved,
Byte 4 => (bit 5 = receive interrupt enable),bit 4 = RTR reply, bit 3 = Buffer Enable (what about the other bits?)
#define CAN_RX_ID_SHIFT 21 //shift required for the id reg.
#define SHIFTED_ID ID<<CAN_RX_ID_SHIFT
CY_SET_REG32((reg32 *)&CAN_RX[<mailboxid>].rxid, (SHIFTED_ID));