Closed xucheng5 closed 1 month ago
I had a SocketLIN in my personal backlog for at least half a year ;) Let me see if I can prioritize this activity and get some expected dates.
I had a SocketLIN in my personal backlog for at least half a year ;) Let me see if I can prioritize this activity and get some expected dates.
SocketLIN will also be a good choice !
@pkarashchenko it's good that you can upstream SocketLIN, we help review the change and develop a real driver to test it.
I have LIN on my custom board, and a CAN/LIN sniffer/analyser so I will certainly be able to help with testing.
@pkarashchenko could you spend some time to provide the SocketLIN driver? Thanks. We want to develop a LIN driver base on your work.
Hi. I need to build here a schedule a bit as I will be most probably able to handle this activity only at the second part of October.
@pkarashchenko could you send out a draft PR? so we can polish your work.
@pkarashchenko do you have any update about SocketLIN?
@pkarashchenko do you have time to look at this issue?
Hi. Sorry for the late response. I plan to push draft PR till Oct 25 (may happen earlier)
Thanks.
@xiaoxiang781216 I'm not sure if that is what you expected, but here is what I've been able to conduct till now: https://github.com/apache/nuttx/pull/11002
Similar to Linux this code relies on the SocketCAN upper layer infrastructure. I've backported that from the kind of "selfmade" LIN driver and going to verify that SocketLIN driver will still be working as expected after backport. Till now I just verified that LIN interfaces are registered and I can configure it via ifup linX
. I hope to pass send/recv messages test till the end of the week.
There are few differences to discuss about SocketLIN:
#define LIN_CANFR_FLAGS_OFFS 6 /* Lower 6 bits in can_id correspond to LIN ID */
as well as for error reporting
/ Error flags /
while currently in my draft I used `CAN_EFF_FLAG` for selection of extended vs classical checksum,
2. slin uses `CAN_EFF_FLAG` flag for configure frame cache
and in my PR I use TX frames as a regular frames while RX frames are always done via RTR.
I suppose that frame caching is needed for LIN slave mode as https://github.com/apache/nuttx/pull/11002 adds only LIN master support. Adding a LIN slave may require slight rework as all TX data should be cached until master requests with a proper LIN-ID, so in CAN language "we will need COB (communication object)" to be allocated for each TX ID in case of LIN slave.
refer to https://www.mail-archive.com/dev@nuttx.apache.org/msg06818.html & https://github.com/apache/nuttx/pull/5043
a LIN upper-half character driver : will do :
use a lin_frame as a uint of transmit Send :
LIN master task : header send & repsonse send is necessary ; LIN slave task : only repoonse send . Recv : both master & slave always recv frame from lin bus.
for Send & Recv reponse, because uart use char as u uint of transmit , so use struct lin_frame_s as a uint of transmit could be good choice
`struct lin_frame_s { u8 pid; u8 data[MAX_LIN_LEN] ; // MAX_LIN_LEN = 8; }
need a LIN filter which apps can catch specific PID - LIN frame, like can characterdriver.
A SW implementation for State Machine ,break check, frame error, crc check ( like sllin.c - Pavel Pisa).