All of lore.kernel.org
 help / color / mirror / Atom feed
* canfd through slcan via SocketCAN
@ 2020-02-16 13:43 Chris Morgan
  2020-02-17 20:16 ` Oliver Hartkopp
  0 siblings, 1 reply; 4+ messages in thread
From: Chris Morgan @ 2020-02-16 13:43 UTC (permalink / raw)
  To: linux-can

Hello.

I’m looking at options to add canfd support to embedded processors via serial using slcan. I’d like the devices to be available via socketcan. Looking at the slcan driver it looks like the MTU is something around 30 bytes and there isn’t any mention of canfd in the driver or in the userspace utilities. Am I missing something with this support? If slcan doesn’t support canfd yet is anyone working to add any?

Regards,
Chris

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: canfd through slcan via SocketCAN
  2020-02-16 13:43 canfd through slcan via SocketCAN Chris Morgan
@ 2020-02-17 20:16 ` Oliver Hartkopp
  2020-02-18  0:01   ` Chris Morgan
  0 siblings, 1 reply; 4+ messages in thread
From: Oliver Hartkopp @ 2020-02-17 20:16 UTC (permalink / raw)
  To: Chris Morgan, linux-can

Hi Chris,

On 16/02/2020 14.43, Chris Morgan wrote:

> I’m looking at options to add canfd support to embedded processors via serial using slcan. I’d like the devices to be available via socketcan. Looking at the slcan driver it looks like the MTU is something around 30 bytes and there isn’t any mention of canfd in the driver or in the userspace utilities. Am I missing something with this support? If slcan doesn’t support canfd yet is anyone working to add any?

The slcan driver implements the SLCAN aka Lawicel protocol, originally 
provided by http://www.can232.com/

See documentation at:
http://www.can232.com/docs/can232_v3.pdf

Other low cost serial CAN adapters adopted this simple protocol, see 
this overview:

https://github.com/linux-can/can-misc/blob/master/docs/SLCAN-API.pdf

By today there is no CAN FD capable CAN interface using the SLCAN 
protocol on the market!!

You would need to set a second bitrate (data bitrate) and you would need 
a separated data frame identifier for CAN FD frames.

Today:

t/T -> Classic CAN data frame
r/R -> Classic CAN rtr frame (not in CAN FD)

According to the above documents we would been able to use:

d/D -> CAN FD data frame (with BRS/ESI flags!)
k/K -> set FD data bitrates (analogue to s/S)

The biggest problem with defining these values/characters and adding 
them to the slcan driver in the Linux kernel, is that WE DO NOT KNOW 
whether future serial CAN FD interfaces will follow our suggestion.

Usually you have a hardware providing an API/protocol and THEN the 
driver developers write the driver - and not the other way around ;-)

Regards,
Oliver

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: canfd through slcan via SocketCAN
  2020-02-17 20:16 ` Oliver Hartkopp
@ 2020-02-18  0:01   ` Chris Morgan
  2020-02-18  7:11     ` Oliver Hartkopp
  0 siblings, 1 reply; 4+ messages in thread
From: Chris Morgan @ 2020-02-18  0:01 UTC (permalink / raw)
  To: Oliver Hartkopp; +Cc: linux-can

HI Oliver.

> On Feb 17, 2020, at 3:16 PM, Oliver Hartkopp <socketcan@hartkopp.net> wrote:
> 
> Hi Chris,
> 
> On 16/02/2020 14.43, Chris Morgan wrote:
> 
>> I’m looking at options to add canfd support to embedded processors via serial using slcan. I’d like the devices to be available via socketcan. Looking at the slcan driver it looks like the MTU is something around 30 bytes and there isn’t any mention of canfd in the driver or in the userspace utilities. Am I missing something with this support? If slcan doesn’t support canfd yet is anyone working to add any?
> 
> The slcan driver implements the SLCAN aka Lawicel protocol, originally provided by http://www.can232.com/
> 
> See documentation at:
> http://www.can232.com/docs/can232_v3.pdf
> 

This is super helpful, thanks for the pointer there. I didn’t realize so many letters were already in use but it looks like there are some openings in the protocol.


> Other low cost serial CAN adapters adopted this simple protocol, see this overview:
> 
> https://github.com/linux-can/can-misc/blob/master/docs/SLCAN-API.pdf
> 
> By today there is no CAN FD capable CAN interface using the SLCAN protocol on the market!!
> 
> You would need to set a second bitrate (data bitrate) and you would need a separated data frame identifier for CAN FD frames.
> 
> Today:
> 
> t/T -> Classic CAN data frame
> r/R -> Classic CAN rtr frame (not in CAN FD)
> 
> According to the above documents we would been able to use:
> 
> d/D -> CAN FD data frame (with BRS/ESI flags!)
> k/K -> set FD data bitrates (analogue to s/S)
> 
> The biggest problem with defining these values/characters and adding them to the slcan driver in the Linux kernel, is that WE DO NOT KNOW whether future serial CAN FD interfaces will follow our suggestion.
> 
> Usually you have a hardware providing an API/protocol and THEN the driver developers write the driver - and not the other way around ;-)
> 

Heh. I can appreciate that.

I’m working with a MT7688 platform that only supports half duplex spi and looking for a low cost canfd solution for that platform. I’m not sure exactly if that prevents me from using an existing MCP251x driver or not but I’ve heard this is the case. There is also a software spi driver, spi-gpio-custom in openwrt that is an option.

The idea with slcan would be to use a SAM21 microcontroller with dual canfd controllers to provide canfd functionality, implementing the slcan client in the SAM21 firmware.

I’m still not sure what the best approach might be. I am hesitating to use a usb based adapter but that’s another option as well.

Thoughts?

Regards,
Chris

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: canfd through slcan via SocketCAN
  2020-02-18  0:01   ` Chris Morgan
@ 2020-02-18  7:11     ` Oliver Hartkopp
  0 siblings, 0 replies; 4+ messages in thread
From: Oliver Hartkopp @ 2020-02-18  7:11 UTC (permalink / raw)
  To: Chris Morgan; +Cc: linux-can



On 18/02/2020 01.01, Chris Morgan wrote:
> HI Oliver.
> 
>> On Feb 17, 2020, at 3:16 PM, Oliver Hartkopp <socketcan@hartkopp.net> wrote:
>>
>> Hi Chris,
>>
>> On 16/02/2020 14.43, Chris Morgan wrote:
>>
>>> I’m looking at options to add canfd support to embedded processors via serial using slcan. I’d like the devices to be available via socketcan. Looking at the slcan driver it looks like the MTU is something around 30 bytes and there isn’t any mention of canfd in the driver or in the userspace utilities. Am I missing something with this support? If slcan doesn’t support canfd yet is anyone working to add any?
>>
>> The slcan driver implements the SLCAN aka Lawicel protocol, originally provided by http://www.can232.com/
>>
>> See documentation at:
>> http://www.can232.com/docs/can232_v3.pdf
>>
> 
> This is super helpful, thanks for the pointer there. I didn’t realize so many letters were already in use but it looks like there are some openings in the protocol.
> 
> 
>> Other low cost serial CAN adapters adopted this simple protocol, see this overview:
>>
>> https://github.com/linux-can/can-misc/blob/master/docs/SLCAN-API.pdf
>>
>> By today there is no CAN FD capable CAN interface using the SLCAN protocol on the market!!
>>
>> You would need to set a second bitrate (data bitrate) and you would need a separated data frame identifier for CAN FD frames.
>>
>> Today:
>>
>> t/T -> Classic CAN data frame
>> r/R -> Classic CAN rtr frame (not in CAN FD)
>>
>> According to the above documents we would been able to use:
>>
>> d/D -> CAN FD data frame (with BRS/ESI flags!)
>> k/K -> set FD data bitrates (analogue to s/S)
>>
>> The biggest problem with defining these values/characters and adding them to the slcan driver in the Linux kernel, is that WE DO NOT KNOW whether future serial CAN FD interfaces will follow our suggestion.
>>
>> Usually you have a hardware providing an API/protocol and THEN the driver developers write the driver - and not the other way around ;-)
>>
> 
> Heh. I can appreciate that.
> 
> I’m working with a MT7688 platform that only supports half duplex spi and looking for a low cost canfd solution for that platform. I’m not sure exactly if that prevents me from using an existing MCP251x driver or not but I’ve heard this is the case. There is also a software spi driver, spi-gpio-custom in openwrt that is an option.
> 
> The idea with slcan would be to use a SAM21 microcontroller with dual canfd controllers to provide canfd functionality, implementing the slcan client in the SAM21 firmware.
> 
> I’m still not sure what the best approach might be. I am hesitating to use a usb based adapter but that’s another option as well.

IMO the SLCAN protocol is a simple but not that reliable, efficient and 
fast protocol.

I would not recommend to take it as a basis for a new design. Therefore 
I would either try to make the SPI working or to go with an USB 
solution, which handles CAN frames directly (meaning without a SLCAN 
protocol).

Regards,
Oliver

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-02-18  7:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-16 13:43 canfd through slcan via SocketCAN Chris Morgan
2020-02-17 20:16 ` Oliver Hartkopp
2020-02-18  0:01   ` Chris Morgan
2020-02-18  7:11     ` Oliver Hartkopp

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.