Skip to content
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

TransmitFrame hanging sometimes #101

Closed
johnnyb opened this issue Dec 12, 2022 · 4 comments
Closed

TransmitFrame hanging sometimes #101

johnnyb opened this issue Dec 12, 2022 · 4 comments

Comments

@johnnyb
Copy link

johnnyb commented Dec 12, 2022

This is probably a problem with Linux Socketcan (running on a Pi 4), but I thought I would note it in case anyone knew an easy answer. It's not a huge problem, but one I've found in testing. Essentially, on occasion, TransmitFrame doesn't return UNTIL I receive a frame on the bus. It's hard to replicate. But, in any case, when bus traffic is empty, then the TransmitFrame will, only sometimes, fail to return. When incoming traffic returns to the bus, TransmitFrame will finally complete.

@johnnyb
Copy link
Author

johnnyb commented Dec 12, 2022

Note that writing multiple frames doesn't help. If I attach a timeout to the write call, I get a continual stream of "transmit frame: write can0: I/o timeout" until a frame is transmitted by another device on the bus, and then everything starts working again.

@johnnyb
Copy link
Author

johnnyb commented Dec 12, 2022

This is possibly due to a "bus off" condition. If the bus is completely disconnected, it will hang, but if I even have a device monitoring the bus, it seems to turn back on.

@hashemmm96
Copy link

Hi @johnnyb,

One of the prerequisites of the CAN protocol is that there must be at least two devices listening on the bus for correct communication (i.e. two devices must be "bus on"). Trying to transmit on a bus with only one device is not possible.

@johnnyb
Copy link
Author

johnnyb commented Feb 14, 2023

I would think there would need to be something that happened besides "hang indefinitely" but since this is known and I have found a workaround for myself I'll close this out.

@johnnyb johnnyb closed this as completed Feb 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants