-
Notifications
You must be signed in to change notification settings - Fork 8.1k
CANBUS driver for native_posix board #14196
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
CANBUS driver for native_posix board #14196
Conversation
Codecov Report
@@ Coverage Diff @@
## master #14196 +/- ##
==========================================
- Coverage 52.68% 52.67% -0.01%
==========================================
Files 307 307
Lines 45473 45473
Branches 10530 10530
==========================================
- Hits 23956 23955 -1
Misses 16640 16640
- Partials 4877 4878 +1
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would you like to add a paragraph or two of documentation?
Otherwise just a couple of very minor comments after a quick lock
drivers/can/Kconfig.native_posix
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: name in +the+ host system.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would a #warning or #error under an #else make sense here?
drivers/can/Kconfig.native_posix
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sidecomment: If you want you can add a command line option to set it, similarly to:
https://github.com/zephyrproject-rtos/zephyr/blob/master/drivers/bluetooth/hci/userchan.c#L239
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the hint. That looks like a way to go.
Yes, I will create documentation for this. I just didn't had time to create one today. This is probably not going to 1.14 anyway. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for looking into this. Wouldn't have a chance to play with this soon, so just approving.
This initial version supports SocketCAN. The driver passes CANBUS data between Linux vcan virtual CAN driver and Zephyr. You also need to use can-setup.sh script from the net-tools project in order to make communication work with Linux vcan driver. Signed-off-by: Jukka Rissanen <[email protected]>
Add native_posix board support to socket-can sample application. Signed-off-by: Jukka Rissanen <[email protected]>
1f57d35 to
1814682
Compare
|
Rebased against latest master. |
|
This is not ready yet as I need to still solve the issues @aescolar mentioned. |
|
@jukkar Note that this PR is getting stale |
|
It is stale already and would need more TLC. Let's see if I have time to work more with it. |
|
Storing this to jukkar#21 in order to cleanup the upstream list of PRs. |
|
hi @jukkar can this issue be reopened? We have rebased your previous work and hope it can go upstream. |
|
@pllee4-weston Please create a new pull request with your changes, it is not possible to reopen this PR as the underlying branch has been deleted from github. |
|
@jukkar Alright thanks for the information. |
Edit: I am now able to receive and send CAN packets in Zephyr. The Linux vcan virtual interface is the peer in this case. My earlier problems were because filters were not set properly. Currently this only supports Socket-CAN interface in Zephyr, we can add support for Zephyr native API later.
In Linux one can use cansend to send CAN packets like this:
To receive CAN packets do this:
The candump and cansend are part of the can-utils package https://github.com/linux-can/can-utils
You also need the can-setup.sh script from Zephyr net-tools repo, I will send new version for it shortly.
This PR contains two extra commits (padding and const ones) that I already sent separately, just ignore them.