[En-Nut-Discussion] CANBUS as a NUTCANBUS device

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Thu Jul 12 17:11:24 CEST 2012


Hello,

I just checked into SVN my work on a NUTCANBUS approach. dev/canbus.h
provides the new header and is similar to the dev/can-dev.h +
dev/at_can.h. Checks were run on a STM32F105 platform. 

In short:
 - register the NUTCANBUS
 - set baudrate on the bus
 Now you are already able to send data.
 - set messages filters
 - enable reception on the bus
and received messages should appear in the rx message queue

If the TX queue is full or the RX queue is empty, writing or reading
block. Read blocking has settable timeout. Before doing a blocking action,
you can query the status of the queue.

You can set the size of the RX queue  with NutRegisterCanBus call.

For the STM32 implementation with two receive fifos in each CAN device, I
choose to implement two NUTCANBUS structures, a main one and a
companion. You may only register the companion when the master is already
registered. There is no tx queue on th companion, and e.g. baud rate setting
errors out and the setting of the master device is used. Now two thread with
different message filters can wait for RX on a single can node.

Feedback and improvement welcome!
-- 
Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------



More information about the En-Nut-Discussion mailing list