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

Canny to support CAN FD #3

Open
ghubmlafontaine opened this issue Mar 14, 2023 · 6 comments
Open

Canny to support CAN FD #3

ghubmlafontaine opened this issue Mar 14, 2023 · 6 comments
Assignees

Comments

@ghubmlafontaine
Copy link

In relation to the CAN bus speed ajustment functionality there is a new CAN FD protocol that deals with faster network and capacity.

It would be nice that canny be able to extend CAN FD over tcp/ip like is does for regular CAN bus

Thanks for your consideration on this feature.

@m10k
Copy link
Owner

m10k commented Mar 17, 2023

Hello @ghubmlafontaine,

thank you for the feature request. I completely agree that CAN-FD is something that canny should support in the future.
I put this on my list to implement after the bus rate detection. In the meanwhile I'll try to get a CAN-FD adapter. :)

Best regards

@m10k m10k self-assigned this Mar 20, 2023
@m10k
Copy link
Owner

m10k commented Apr 8, 2023

Hey there,

I have just merged a set of commits into the unstable branch that enable CAN-FD support in canny. It seemed to work correctly in tests with virtual interfaces, but I'll do some more testing with physical interfaces in a bit.

The change comes with a big caveat, though: because there are two different types of CAN frames sent over the network, and canny would not be able to distinguish between a normal CAN2.0B frame and a short CAN-FD frame, I had to modify the format of messages that are sent over the network. This means that CANFD-enabled canny versions are incompatible with non-CANFD canny versions. Also, applications that talk to canny over the network will need to be modified to handle the message format correctly.
I understand this is not ideal, so please let me know if this change is acceptable for you. In the meanwhile, I'll have a look if there's an easier way to distinguish between frames.

Best regards

@ghubmlafontaine
Copy link
Author

This means that CANFD-enabled canny versions are incompatible with non-CANFD canny versions.

That is a fair limitation. But I would say going forward, it is the CAN-FD flavor that will drag interest. Because thanks to you, the canny "CAN-to-CAN" app you created foot the bill perfectly well.

For the CAN-FD flavor of canny the ideal would be that a CAN-FD-to-CAN-FD app and adapter be able to both find and detect whether the other side is CAN or CAN-FD and adapt.

It would be nice If we could find a white paper that covers the CAN / CAN-FD switch back and forth similar to the one you found for the auto speed detection. I will start searching on my side.

early in may, I will set up a lab to allow me to test the CAN-FD to CAN-FD flavor. I look forward to this.

Thanks to you!

@m10k
Copy link
Owner

m10k commented Apr 20, 2023

Hey @ghubmlafontaine,

thank you for your feedback! And sorry, I think my explanation might have been a bit misleading.
So the way I implemented CAN-FD support, canny can talk to traditional CAN-2.0B interfaces and CAN-FD interfaces at the same time. However, because the message format on IP-connections has changed, other the canny on the other side of the network needs to be updated.
If your setup has only cannys talking to each other, there should be no problems. However, if you have other software that talks directly to canny over an IP-connection, that software would need to be modified to support the new message format.

The other (obvious) limitation is, that canny won't be able to forward CAN-FD frames to a CAN-2.0B interface. So for example, if you have a setup like the following, the CAN-FD frames will received frames from the CAN-2.0B network, but not the other way around.

+------------------+     +-------+   IP-network   +-------+     +----------------+
| CAN-2.0B network |<--->| canny |<==============>| canny |<--->| CAN-FD network |
+------------------+     +-------+                +-------+     +----------------+
     ^                                                                       ^
     |                                                                       |
    Will not receive messages from the other network                         |
                                   Will receive messages from the other network

So I guess my question is, do you have any custom software that talks to canny over the IP-network? And if so, is there something I can implement to help you port software to the new message format? I'm thinking maybe a small library or something that can be used to establish connections and exchange messages with canny servers would be a worthwhile addition.

Best regards

@ghubmlafontaine
Copy link
Author

Hello Mr Kruk,

Thanks for the additional informations. It actually meets all the forseen requirements. Our proof of concept lab connects two CAN network together with only one device on each side. We expect that each device will eventually be upgraded to CAN-FD to improve the speed. We don't have custom code or special addition to the generic canny.

I look forward to be able to test it with CAN-FD somewhere in may. I won't miss updating you on the results.

Thanks again for this update. It's well appreciated

M.L.

@ghubmlafontaine
Copy link
Author

Good morning,
Finally, I I was Ible to get a minilab back in place. I dont have yet a CAN-FD to CAN-FD set up in place. We are still searching to find two CAN-FD systems that would fit our lab environment.
I downloaded the canfd-support branch and I wasn't able to have it running ok. here is what I found:
1- First I saw the new -v option... which I liked a lot. It is wery usefull thanks for this addition.

2-I am starting canny in a bash sh, keeping the window opent (option -d). I notice in this version that while in wait state, if I type in that window, it immediately fails canny. That wasn't the case with the previous version.

3- When connecting, everything seems ok but when we start communicating, ( from the caller side) we get the following error (see picture) [ERR] send: Socekt oeration on non-socket

This is happening on a
Raspberry Pi 4 with Pican3

Is it because I am on a PICAN3?

I have ordered Pican FD cards so I will be able to test Pican 3 to Pican FD cards soon. I'll do that while waiting for a real CAN-FD test environment.

Regards

Marc L.

Screenshot 2023-06-24 071621

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