lkml.org 
[lkml]   [2022]   [Nov]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [RFC][PATCH 0/2] LIN support for Linux
From
Hi Christoph, all,

On 28.11.22 11:16, Christoph Fritz wrote:

>> IIRC the implementation of the master/slave timings was the biggest
>
> Currently sllin only supports master mode, I guess because of the tight
> timing constraints.

I think this has to be corrected.

In the master mode the SocketCAN Broadcast Manager (BCM) is configured
to periodically send LIN headers
(according to LIN schedule table).

https://www.kernel.org/doc/html/latest/networking/can.html#broadcast-manager-protocol-sockets-sock-dgram

This is a very easy approach to precisely send the the LIN frames from
kernel space and also atomically change the content of (all) the
configured LIN frames while the schedule table is continuously processed.

Sending LIN frames directly from *userspace* (and handling timers there)
was *never* intended for real LIN communication - although the examples
(with cangen) in the document look like this.

Same applies to the slave mode:

If you check out
https://raw.githubusercontent.com/wiki/lin-bus/linux-lin/sllin-doc.pdf
on page 11 you are able to enable the slave mode with

insmod ./sllin.ko master=0

The 'trick' about this mode is that the RTR-functionality of the BCM is
able process the incoming CAN/LIN identifier and *instantly* send back
some pre-defined data for that specific LIN-ID, so that the SLLIN driver
sends/answers the 'data' section of the received LIN-ID within the
required timing constrains for LIN slaves.

Not sure if the info about this concept got lost somehow, but the
CAN_BCM is the key for handling the LIN protocol and offload the LIN
scheduling (master/slave) to the kernel for the comparably dumb tty
interfaces.

Best regards,
Oliver

\
 
 \ /
  Last update: 2022-11-30 22:04    [W:0.046 / U:3.308 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site