-
Notifications
You must be signed in to change notification settings - Fork 714
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cansend remote request only works every other time #405
Comments
well... that formatted badly... |
fixed formatting - use 3 backticks instead of 1 for multi line code |
Use Looking at your output: # cansend can0 001#R
# cansend can0 001#R
can0 001 [0] remote request
can0 001 [0] remote request You sent 2 remote requests.... can0 001 [2] 00 01 ...but only receive 1 answer. But you expect 2 answers - is this the problem? Who is sending the answer to the RTR messages? Can you add a 2nd CAN adapter to the bus to see if |
Thanks for the reply. Yes, I was expecting an answer for each request. I have an Arduino based device connected to the CAN bus that receives the message and answers. It is only seeing the 2nd message. I also have a logic analyzer connected to the CAN TX/RX signals going to the transceiver and a oscilloscope connected to the CANH/CANL output of the transceiver. On the first RTR message I see no activity. For the second RTR I see expected activity n both the LA and scope. The weird thing is it only happens for the RTR messages...
|
Your two sent RTR frames are sent with nearly no time gap - definitely much faster than you can invoke the second cansend on the terminal. Is it possible that the Arduino ot its CAN transceiver is in some sleep mode? What happens if you send some other CAN frame right before the RTR frames? |
Same result. My Arduino code does not sleep. It just loops checking for can messages and then processes them. The Arduino board is a simple CAN connected GPIO expander with 16 outputs and 8 inputs. 001#R is a "version" request, expected response is 001 [2] 00 01 (0x0100 = 1.0) The Arduino board works fine with another system (PowerPC based, not sure what driver is used off hand). I'm trying to test the CAN interface on a Xilinx Zynq based system using the xilinx_can driver. It seems to be working other than needing two 'sendcan' messages for every remote request. It seems like the first 'sendcan' doesn't actually do anything. 'ifconfig' does not show any increase in the TX or RX bytes for the first request. On the second request I see the TX and RX bytes increment. Confused... |
Also, if I do the first 'cansend', which does not do anything, and then wait a couple minutes before doing the second 'cansend' I still get the candump output showing the two RTR frames with nearly no time gap.
|
Maybe this will help.
The fist cansend does not show any TX packets in the ifconfig output. |
Ok, let's check systematically. Can you get some rough timestamps with a 2nd system, maybe with the Arduino? In one terminal start
You should see 64 CAN frames, 1 about every 200ms (data is random):
Then 64 RTR CAN Frames:
Compare the output of |
I will need to modify my Arduino code to produce some kind of timestamp. I the mean time I did notice this:
Is there some kind of buffering of the remote requests? |
Seems so - but that's a bug. Can you send a bug report to |
Never actually submitted a bug report. What is supposed to be included? |
|
The text only is a problem. My work has seriously screwed up our mail server. Everything gets converted to HTML. I'll try to figure it out. |
Hmmm... Non RTR messages work fine:
Is the |
Yes, you can send messages without data. Seems the other side doesn't care if it's a RTR or not? |
@marckleinebudde would it make sense for one of us to simply write this bug report and put Hartley and his e-mail in CC? |
@hartkopp Good idea, feel free to forward the bug report, include a link to this issue. |
Must not. The Arduino board is a Teensy 3.2 and I'm just using the can libraries provided by the Teensyduino support for that board. My PowerPC code that uses the board always sent the RTR message so I assumed it was needed. |
If you handle all messages on the Teensy in software you can check if the RTR bit is set in you RX-Handler and decide to handle it somehow "special". With some controllers you can "pre-load" a message into the controller. It's send automatically by the CAN controller hardware once it receives a certain CAN-ID + RTR bit set. |
Ah, I'm not doing that on the Teensy. Basically it's just doing:
Simple, stupid, but it works... |
so no one's looking at the RTR bit :) |
Guess not. But still probably a bug in the xilinx driver. Thanks for all your help! |
For the reference: https://lore.kernel.org/all/[email protected] |
This could be either a bug in the driver - or even in the xilinx CAN IP core. |
@bigguiness are you using a hardware xilinx CAN core or one in the FPGA? |
The hardware CAN. Also, this is with a kernel/rootfs created using Petalinux 2020.2.
|
FYI: opening and closing backticks go into separate lines. |
Hi, Thanks for letting us know, Thanks |
I am trying to test a CAN interface on a Zynq board and have problems with cansend remote requests.
But, non remote requests always work:
Any ideas?
The text was updated successfully, but these errors were encountered: