Strictly necessary cookies are on by default and cannot be turned off. Functional, Performance and Tracking/targeting/sharing cookies can be turned on below based on your preferences (this banner will remain available for you to accept cookies). You may change your cookie settings by deleting cookies from your browser. Then this banner will appear again. You can learn more details about cookies HERE.
Strictly necessary (always on)
Functional, Performance and Tracking/targeting/sharing (default off)
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 in the memory view of the debugger:
(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.
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).
Set up the receive mailbox with RTR and RTR reply set in the module. IRQ is not required.
#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