CAN communication

Software » CAN communication

The Revision 2 main board supports CAN communication. The CAN bus can be used for configuration and for obtaining values like voltages, input states etc. The CAN messages are configurable and can be adjusted to be compatible with existing equipment.

Currently the CAN bus speed is fixed to 250kbps.

Setting and reading parameters via SDO

The abbreviation SDO is taken from the CANOpen protocol. It assigns a certain meaning to the 8 data bits of a CAN frame.

PurposeCAN-IdByte 1 (Cmd)Bytes 2-3 (Index)Byte 4 (Subindex)Bytes 5-8 (Data)
Set Value 0x601 0x40 0x2000 Value Index Value x 32
Set Value Reply 0x581 0x23 0x2000 Value Index Value x 32
Get Value 0x601 0x22 0x2000 Value Index don't care
Get Value Reply 0x581 0x43 0x2000 Value Index Value x 32
Abort - invalid index 0x581 0x80 0x2000 Value Index Abort Code = 0x06020000
Abort - value out of range 0x581 0x80 0x2000 Value Index Abort Code = 0x06090030

The value index must be determined by counting the output of the list command. E.g. "boost" at the very top has index 0, potnom has index 77. The indexes can change over firmware versions as new parameters are added somewhere in between.

Mapping values to arbitrary CAN messages

Values can be mapped into a certain bit range of the 64 payload bits of a CAN message. They can either be read from the message or sent via a message. To do so enter

can tx udc 123 0 16 10

This maps the value of udc to a CAN message with id 123 bits 0..15 (start at bit 0, span over 16 bits) with a gain of 10.

can tx din_forward 123 24 1 1

would map the pin state of the forward input to bit 24 of CAN message with id 123

To save your can map simply type "save".

The next step is to allow setting digital and analog inputs via CAN.

Limits

  • A maximum of 8 messages can be defined
  • Per message a maximum of 8 values can be mapped
  • a value can not span across the 32-bit boundary, i.e. it must be fully contained in the first or second 32 bits of the message. E.g. "can tx udc 123 16 32 10" is not allowed
  • A value can span maximum 32 bits