You are here

CAN RTR auto-reply not sending DLC | Cypress Semiconductor

CAN RTR auto-reply not sending DLC

Summary: 2 Replies, Latest post by Borstenhorst on 27 Jan 2016 03:26 PM PST
Verified Answers: 0
Last post
Log in to post new comments.
user_193124556's picture
128 posts

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.

SmartPSoC's picture
Cypress Employee
68 posts

 The RTR example projects 3 and 4 given along with the Application note ( shows how to get payload data with RTR.

Borstenhorst's picture
15 posts

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:


#define RXCMD 0x00820038   /*Starting from MSB, 
                            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 ID                  0x1        //Id or the responce
#define CAN_RX_ID_SHIFT     21 //shift required for the id reg.
#define SHIFTED_ID          ID<<CAN_RX_ID_SHIFT
//Update the CMD and ID registers of our mailbox
CY_SET_REG32((reg32 *)&CAN_RX[<mailboxid>].rxcmd, (RXCMD));
CY_SET_REG32((reg32 *)&CAN_RX[<mailboxid>].rxid, (SHIFTED_ID)); 
Log in to post new comments.