Set CANbus RTR bit

I’m trying to use one of the call & response commands over CANbus (specifically “Get Encoder Estimates”) with an Arduino and one of the notes at the bottom of the message chart mentions needing to set an RTR bit. What is this bit and where/how do I set it? The docs for the CAN protocol don’t mention the RTR bit anywhere else.

I’m using the due_can library.

RTR (Remote Transmission Request) is a special deconfliction bit, basically. I did a quick google, the RTR bit isn’t supported by the due_can library.

Yeah, this is one of the problems with odrive’s CANsimple protocol IMO. It makes use of RTR as if it was just an extra bit in the arbitration ID. But really it has a special meaning and is implementation specific.
In some controllers it is handled in hardware - the CAN controller can automatically respond to an RTR message without bothering the CPU, a bit like DMA.

That said, I think it’s unlikely that due_can doesn’t support sending the RTR bit. More likely, it doesn’t support configuring the CAN hardware to reply DMA style to RTR messages.

I originally wrote CANsimple without RTR, because I don’t know anyone who uses it, but a bunch of people complained and I got overruled lol

1 Like

I believe @towen is correct. Looking into the source code and according to this merged pull request, due_can has support for sending the RTR bit. Not sure about reading the RTR bit but I don’t need that functionality. Now I just need to figure out how to correctly setup the request frame to get a response. Thank you for the clarifications on RTR.

2 Likes

What bit do you need to set to get the response?
Is that a bit in the CAN message you send?

Sent 0x037 LEN: 8 DATA: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
Which of the data bits needs to be set?

It’s not part of the ID or the data, it’s a special bit. Usually there is an API function to set it.
e.g. in python-can:

msg.id = 0x037
msg.rtr = True

Or with cansend:
cansend can0 037#R

1 Like

Thank you sir!

Thats what I needed.
I am using FlexCAN on a Teensy 4.1 (Arduino IDE).
Simply adding the line TxMsg.flags.remote = 2; fixed it.

Cheers!

2 Likes