[ebus-dev] Checksums and reliability

Werner Koch wk at gnupg.org
Tue Nov 29 09:41:28 CET 2011


On Mon, 28 Nov 2011 23:22, hans.epost at gmail.com said:

> I am probably a little bit late into the protocol discussion, but I
> think the bus should use CRC16 checksum. When an ack is required, it

In case you only subscribed later: I am running my own version of the
software which uses a CSMA system [1] (already discussed here) and a CRC16.

avr-gcc comes with a fast crc16 implementation which takes about 17
cycles per byte; with a 16Mhz clock it takes less than 19us per message
or 4% of the time needed to receive a _single_ byte at 19200.

My bus protocol allows to carry different protocols and is able to
convey Elktor Bus messages without a change (the CRC is not part of the
16 byte payload).

You can find my code at

  http://git.gnupg.org/cgi-bin/gitweb.cgi?p=wk-misc.git;a=tree;f=ebus

It requires a Unix box to build.  The code is not yet finished but the
shutter.c node runs for several months here without real problems.  The
final design is to have a daemon (housed) running on a 32 bit controller
or on a PC which takes care of broadcasting the current time to the
nodes and as a general one stop access point to the bus.  The tool
housectl.c will eventually communicate with the daemon to allow command
line access to the bus.

I have not yet found the time to implement a node to gateway between the
CSMA bus and a simple RS232 PC port [2].  Thus I currently use one
RS485->RS232 converter to read the bus (housed displays all bus
activity) and a second one to write to the bus (housectl does this and
hopes for the best that there won't be a collision) [3].


Shalom-Salam,

   Werner



[1] CSMA/CD := Collission Sense Multipe Access with Carrier Detection.
    Which is the same thing Ethernet does.

[2] The simplest way to do this is to connect a bus node to a spare node
    PCB using I2C and to connect it's RS485 via the RS485->RS232->USB
    adapter to the PC.  The real bus node would gateway all traffic via
    the spare node to the PC and for the other direction take care of
    the CSMA logic.

[3] Doing CSMA directly on a Unix box is possible but it requires a
    custom driver.  I try to avoid this because a node handlig the CSMA
    is much cheaper compared to the time required to write and maintain
    such a driver.

-- 
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.




More information about the Ebus-dev mailing list