Closed JacobCrabill closed 3 years ago
Is CAN FD enabled on the SocketCAN interface? It can be done by setting the MTU = 72 (64 bytes of payload + 8 bytes of the kernel overhead).
If you don't want CAN FD, use register uavcan.can.mtu
(the corresponding environment variable is UAVCAN__CAN__MTU
).
I'm not trying to use CAN-FD though, so I have that disabled on the socket... I take it by this you're saying that yakut
expects CAN-FD is eanbled by default?
Yes. This is documented in the PyUAVCAN API documentation linked from the Yakut manual. I expect that most systems that adopt UAVCAN/CAN v1 will be FD-capable, so it makes sense to default to that.
On Thu, Apr 22, 2021, 06:30 Jacob Crabill @.***> wrote:
I'm not trying to use CAN-FD though, so I have that disabled on the socket... I take it by this you're saying that yakut expects CAN-FD is eanbled by default?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/UAVCAN/yakut/issues/21#issuecomment-824511668, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZFIZFIHEBK7UML6BTI6IDTJ6J7FANCNFSM43LSBHZQ .
@JacobCrabill should I close this issue?
I believe that worked - it runs without errors, but gives me no data now - I'm going to assume for now that's an issue with my setup and worry about it later.
For other's reference:
sudo ip link set can0 up type can bitrate 1000000 dbitrate 1000000 fd on
export YAKUT_TRANSPORT="CAN(can.media.socketcan.SocketCANMedia('can0',16),3)"
export UAVCAN__CAN__BITRATE=1000000
export UAVCAN__CAN__MTU=16
For the purposes of testing a non-FD network (and assuming I were to use a non-FD-compatible adapter such as a Babel), how would I get this to work in that case?
Actually, I'm not quite following how to configure this - I've been using yakut
successfully to pub/sub messages with FD disabled; it's purely the monitor
function that is requiring CAN-FD - but then enabling CAN-FD breaks the normal pub/sub of messages.
Wait, this isn't right. The docs say (in a slightly roundabout way but nevertheless) that if you use a transport initialization expression, the environment variables are ignored. Also, my fault here is that above I spoke about the Linux kernel MTU setting, not Yakut/PyUAVCAN:
It can be done by setting the MTU = 72 (64 bytes of payload + 8 bytes of the kernel overhead).
When configuring Yakut, you just set the MTU as-is without any overheads included. So, in your case, the configuration to disable FD is:
export UAVCAN__CAN__IFACE=socketcan:can0
export UAVCAN__CAN__BITRATE=1000000 1000000
export UAVCAN__CAN__MTU=8
If you want FD:
export UAVCAN__CAN__IFACE=socketcan:can0
export UAVCAN__CAN__IFACE=socketcan:can0 export UAVCAN__CAN__BITRATE=1000000 1000000 export UAVCAN__CAN__MTU=8
Ok, I simply had the MTU wrong - I've been a little confused as to whether the MTU refers to the overall message size (including header), or the payload alone (so 8 or 16). I think I've seen references online to both variants. In this case for non-FD, setting the Yakut / PyUAVCAN MTU to 8 solved the issue.
So the updated environment variable to make these systems all play happily together is:
export YAKUT_TRANSPORT="CAN(can.media.socketcan.SocketCANMedia('can0',8),3)"
Or to use your UAVCAN_CAN_*
variables above.
@JacobCrabill fyi #22
Cool. Thanks @pavel-kirienko!
Any ideas? I just upgraded pyuavcan, yakut, nunavut, and a number of other dependent packages tonight.
Using a PCAN-USB CAN adapter (shows up as a socketcan interface; works fine with can-utils and
yakut {pub|sub}
).Python 3.9.1 Yakut 0.5.2 pyuavcan 1.2.4