Re: Status of CAN API?

2023-08-22 Thread Pavel Pisa
Hello Philip, Gedare and others interested in RTEMS CAN/CAN FD API,

On Tuesday 22 of August 2023 14:11:22 Philip Kirkpatrick wrote:
> Thank you for your input on this.  I'm still digesting LinCAN, but it looks
> like a good way to go.  On our end, we will likely have some resources to
> throw at this in a few weeks.

LinCAN has been designed as full featured, vendor neutral character driver
API based CAN stack for Linux and RTOS RT Linux kernel with ability
to be accessed from Linux user-land and RT Linux modules in the second case.

  https://ortcan.sourceforge.net/lincan/

But SocketCAN is the choice for Linux kernel CAN support today.
It has nicer API but has it problems on real-time side etc...
Even from our experience with NuttX CAN drivers development
I tend to stay with character driver API for RTEMS in the current
iteration...

Potability of LinCAN to RTEMS and even bare metal HW without scheduler
has been taken in mind. There is a branch can-usb1 which used slightly
modified SJA1000 LinCAN chip driver together with LinCAN infrastructure
to provide low level API (only FIFOs, no POSIX read/write call) in system
less mode to implement USB to CAN converter on old NXP LPC21xx and SJA1000
or newer LPC17xx targets

 https://sourceforge.net/p/ortcan/lincan/ci/can-usb1/tree/embedded/app/usbcan/

We have implemented the companion Linux kernel LinCAN and SocketCAN drivers
which allowed to use even USB converter in addition to ISA and PCI
bus connected CAN controllers... 

> On Thu, Aug 17, 2023 at 4:26 PM Gedare Bloom  wrote:
> > Hi Phil,
> >
> > On Wed, Aug 9, 2023 at 6:38 AM Philip Kirkpatrick
> >
> >  wrote:
> > > Hello,
> > >
> > > Some people on our team here at Reflex are preparing to implement some
> >
> > CAN drivers.  Specifically for TMS570 and for ZynqMP-RPU (side note my
> > latest patch for that on Jun 29th is still sitting there unreviewed).  I
> > was wondering what the current status of the CAN API is.
> > Feel free to ping the patch. At the moment, this email based system is
> > all we have, and sometimes patches may not get a lot of attention
> > especially if no one "owns" it -- such as new BSPs.
> >
> > > I saw in August of last year and API was added and then last month was
> >
> > reverted with this patch:
> > > https://lists.rtems.org/pipermail/devel/2023-July/076013.html
> > > The comment on the patch says the API isn't mature enough for release.
> >
> > What deficiencies need to be resolved in the API, is this being actively
> > worked on, and should we design against this API or is there a different
> > API we should target?

We plan keeping CAN/CAN FD structure (discussed and agreed upon with
Oliver Hartkopp) and keep barely the same read/write code as is in already
included CAN solution. I consider deep redesign of the rest as a must.

> > The implementation of that API was deficient. It did not support
> > multiple read/write transactions, it had a custom-built ring buffer
> > that was not fully vetted, and some other problems related to
> > threads+priorities. I expect to have some time to look at how to
> > provide better CAN support inside of RTEMS. This has been an ongoing
> > discussion I've been having with Pavel Pisa and others for many years
> > now (a decade?). The direction that I will prefer to go is to port
> > LinCAN
> > https://cmp.felk.cvut.cz/~pisa/can/doc/lincandoc-0.3.5.pdf
> >
> > Both Pavel and I are interested in seeing this come through. So far,
> > we mostly do it on volunteer time or as side pieces of other work.
> > Pavel's group has good experience with CAN and CAN FD, and with both
> > TMS570 and the Zynq (non-MP) boards, with Linux, RTEMS, and NuttX. We
> > would be open to collaborating, subject to whatever time or resource
> > constraints everyone has :) Michal Lenc has been working on this topic
> > as a thesis, "CAN FD Support for Space Grade Real-Time RTEMS
> > Executive"

Or initial panned target is our own CTU CAN FD IP Core

  https://canbus.pages.fel.cvut.cz/

which we can test on our MZ_APO Zynq 7k based kits
and have emulation for it in QEMU mainline etc...

There has been James Holley working on Zynq 7k XCAN support
during his intern under Noviumdesigns company funding,
if I remember well. But I am not sure if there has been
some final version released to public. It has been based
on actual RTEMS CAN FIFOs stub and they planned to somehow
fix it but if it. If it is offered under RTEMS mainline
compatible license then it can be updated to CAN API
and FIFOS after rewrite and used for RTEMS XCAN support
in the next step. By the way Zynq-MP and Versal have
advantage that Xilinx included corresponding CAN FD
controllers model int

Re: Status of CAN API?

2023-08-22 Thread Philip Kirkpatrick
Gedare,

Thank you for your input on this.  I'm still digesting LinCAN, but it looks
like a good way to go.  On our end, we will likely have some resources to
throw at this in a few weeks.

-Phil

On Thu, Aug 17, 2023 at 4:26 PM Gedare Bloom  wrote:

> Hi Phil,
>
> On Wed, Aug 9, 2023 at 6:38 AM Philip Kirkpatrick
>  wrote:
> >
> > Hello,
> >
> > Some people on our team here at Reflex are preparing to implement some
> CAN drivers.  Specifically for TMS570 and for ZynqMP-RPU (side note my
> latest patch for that on Jun 29th is still sitting there unreviewed).  I
> was wondering what the current status of the CAN API is.
> Feel free to ping the patch. At the moment, this email based system is
> all we have, and sometimes patches may not get a lot of attention
> especially if no one "owns" it -- such as new BSPs.
>
> > I saw in August of last year and API was added and then last month was
> reverted with this patch:
> > https://lists.rtems.org/pipermail/devel/2023-July/076013.html
> > The comment on the patch says the API isn't mature enough for release.
> What deficiencies need to be resolved in the API, is this being actively
> worked on, and should we design against this API or is there a different
> API we should target?
> >
> The implementation of that API was deficient. It did not support
> multiple read/write transactions, it had a custom-built ring buffer
> that was not fully vetted, and some other problems related to
> threads+priorities. I expect to have some time to look at how to
> provide better CAN support inside of RTEMS. This has been an ongoing
> discussion I've been having with Pavel Pisa and others for many years
> now (a decade?). The direction that I will prefer to go is to port
> LinCAN
> https://cmp.felk.cvut.cz/~pisa/can/doc/lincandoc-0.3.5.pdf
>
> Both Pavel and I are interested in seeing this come through. So far,
> we mostly do it on volunteer time or as side pieces of other work.
> Pavel's group has good experience with CAN and CAN FD, and with both
> TMS570 and the Zynq (non-MP) boards, with Linux, RTEMS, and NuttX. We
> would be open to collaborating, subject to whatever time or resource
> constraints everyone has :) Michal Lenc has been working on this topic
> as a thesis, "CAN FD Support for Space Grade Real-Time RTEMS
> Executive"
>
> Regarding LinCAN itself, there is one design challenge to port it,
> which has to do with the use of internal FIFOs already in LinCAN code
> base, or to use RTEMS/POSIX message queue style to interface the CAN
> drivers and userspace. I actually see there are good reasons to
> support both ways, and may explore exactly that. We have had quite
> some discussions here on the topic:
> * https://lists.rtems.org/pipermail/devel/2023-March/074537.html
> * https://lists.rtems.org/pipermail/devel/2022-April/071235.html
> * https://lists.rtems.org/pipermail/devel/2013-April/030761.html (for
> historical good measure)
>
> Gedare
>
> > Thank you,
> > Phil
> > ___
> > devel mailing list
> > devel@rtems.org
> > http://lists.rtems.org/mailman/listinfo/devel
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: Status of CAN API?

2023-08-17 Thread Gedare Bloom
Hi Phil,

On Wed, Aug 9, 2023 at 6:38 AM Philip Kirkpatrick
 wrote:
>
> Hello,
>
> Some people on our team here at Reflex are preparing to implement some CAN 
> drivers.  Specifically for TMS570 and for ZynqMP-RPU (side note my latest 
> patch for that on Jun 29th is still sitting there unreviewed).  I was 
> wondering what the current status of the CAN API is.
Feel free to ping the patch. At the moment, this email based system is
all we have, and sometimes patches may not get a lot of attention
especially if no one "owns" it -- such as new BSPs.

> I saw in August of last year and API was added and then last month was 
> reverted with this patch:
> https://lists.rtems.org/pipermail/devel/2023-July/076013.html
> The comment on the patch says the API isn't mature enough for release.  What 
> deficiencies need to be resolved in the API, is this being actively worked 
> on, and should we design against this API or is there a different API we 
> should target?
>
The implementation of that API was deficient. It did not support
multiple read/write transactions, it had a custom-built ring buffer
that was not fully vetted, and some other problems related to
threads+priorities. I expect to have some time to look at how to
provide better CAN support inside of RTEMS. This has been an ongoing
discussion I've been having with Pavel Pisa and others for many years
now (a decade?). The direction that I will prefer to go is to port
LinCAN
https://cmp.felk.cvut.cz/~pisa/can/doc/lincandoc-0.3.5.pdf

Both Pavel and I are interested in seeing this come through. So far,
we mostly do it on volunteer time or as side pieces of other work.
Pavel's group has good experience with CAN and CAN FD, and with both
TMS570 and the Zynq (non-MP) boards, with Linux, RTEMS, and NuttX. We
would be open to collaborating, subject to whatever time or resource
constraints everyone has :) Michal Lenc has been working on this topic
as a thesis, "CAN FD Support for Space Grade Real-Time RTEMS
Executive"

Regarding LinCAN itself, there is one design challenge to port it,
which has to do with the use of internal FIFOs already in LinCAN code
base, or to use RTEMS/POSIX message queue style to interface the CAN
drivers and userspace. I actually see there are good reasons to
support both ways, and may explore exactly that. We have had quite
some discussions here on the topic:
* https://lists.rtems.org/pipermail/devel/2023-March/074537.html
* https://lists.rtems.org/pipermail/devel/2022-April/071235.html
* https://lists.rtems.org/pipermail/devel/2013-April/030761.html (for
historical good measure)

Gedare

> Thank you,
> Phil
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Status of CAN API?

2023-08-09 Thread Philip Kirkpatrick
Hello,

Some people on our team here at Reflex are preparing to implement some CAN
drivers.  Specifically for TMS570 and for ZynqMP-RPU (side note my latest
patch for that on Jun 29th is still sitting there unreviewed).  I was
wondering what the current status of the CAN API is.
I saw in August of last year and API was added and then last month was
reverted with this patch:
https://lists.rtems.org/pipermail/devel/2023-July/076013.html
The comment on the patch says the API isn't mature enough for release.
What deficiencies need to be resolved in the API, is this being actively
worked on, and should we design against this API or is there a different
API we should target?

Thank you,
Phil
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel