CAN driver for TMS570

Pavel Pisa ppisa4lists at pikron.com
Mon Dec 5 01:19:01 UTC 2016


Hello MH Najmi,

On Saturday 03 of December 2016 13:01:36 MH Najmi wrote:
> hello every bodyI want to use CAN port of my Hercules (TMS570ls3137) Board
> in RTEMS...I could run RTEMS ticker example on my board but it use serial
> port how to use CAN port instead?

the use of CAN bus as a serial port replacement requires usually
some protocol, standard etc. Not so straightforward.

You can try to use something like ProtocolTool on Host side

  http://protocoltool.sourceforge.net/

As for the TMS570 CAN support and offlist queried CANopen
support, I have no solution ready for RTEMS.

My colleagues at the university have invested more
man years to complete TMS570 peripherals support
including CAN, FlexRay, SPI etc for project contaracted
by a big control systems company, more interfaces
are modelled to be prepared for Autosar integration

  http://rtime.felk.cvut.cz/rpp-tms570/

But I have no right to open source that code without
our university group head permission and even
the code porting to RTEMS would mean man months
of work. I would like to have that done one day,
but it is on the bottom of my stack and without
funding and more people that would not happen.
I would deal with teaching of about 500 students in
next year so my time will be even more limited
and I have more paid contracts at university
and company which have priority.

The RTEMS provided TMS570LS3137 headers include CAN
peripheral. The integrated controller is DCAN which
is newer CCAN variant.
I have writtent CCAN driver years ago for LinCAN

  https://sourceforge.net/p/ortcan/lincan/ci/master/tree/lincan/src/c_can.c

it can be used as some example.

If you limit yourselves to direct mapping of messages boxes
to individual Tx and Rx messages IDs then the use and driver
can be much simpler than the example.

I have ported and included self-test code required
for CAN peripherals use to the RTEMS BSP, so that
part is ready in mainline sources.

People from Vecna.com have developed CANopen stack
for RTEMS for SAM based devices so you can ask them
if there is option to cooperate.

I have experience with

  http://canfestival.org/

and own dynamic and more complex CANopen stack

  http://ortcan.sourceforge.net/

But there has never been time and resources to invest
to port that to RTEMS.

If ETHERNET connection is available for your board,
you can try our lwIP 2.0 port to RTEMS TMS570, this
can be more appropriate for stream data pasing
than CAN

  git clone git://git.code.sf.net/p/ulan/lwip-omk

But if you run from Flash and use internal RAM only
then you need to tune number of buffers to not exceed
available memory.

As for your another question about remote OpenOCD
use, the OpenOCD listens on TCP port and accepts
remote connections , so if you use

  target remote my.server.com:3333

at GDB prompt then you connect to remotely
running OpenOCD if hostname and port matches.
As I know, thare has not been any limitation to localhost
only in the OpenOCD, but if it is there added then
I expect that it can be disable from config.
You need to find in which Eclipse dialog you need
to put host information.

Best wishes,

Pavel





More information about the users mailing list