modm API documentation
|
Classes | |
class | modm::sab2::Interface< Device, N > |
SAB2 interface More... | |
Enums | |
enum | modm::sab2::Error { modm::sab2::ERROR_GENERAL_ERROR = 0x00, modm::sab2::ERROR_NO_ACTION = 0x01, modm::sab2::ERROR_WRONG_PAYLOAD_LENGTH = 0x02, modm::sab2::ERROR_NO_RESPONSE = 0x03 } |
Error code. More... | |
Variables | |
const uint8_t | modm::sab2::maxPayloadLength = 32 |
Maximum length for the payload. | |
lbuild module: modm:communication:sab2
The SAB (**S**ensor **A**ctuator **B**us) is a simple master-slave bus system. It is primarily used to query simple sensors and control actuators inside our robots.
One master can communicate with up to 32 slaves. The slaves are only allowed to transmit after a direct request by the master. They may signal an event by an extra IO line, but this depends on the slave.
Features:
SYNC
- Synchronization byte (always 0x54)LENGTH
- Length of the payload (without header, command and CRC byte)HEADER
- Address of the slave and two flag bitsCOMMAND
- Command codeDATA
- Up to 32 byte of payloadCRC
- CRC-8 checksum (iButton)The second bit is always false
when the master is transmitting. In the other direction, when the slaves are responding, the second bit has to following meaning:
true
- Message is an positive response and may contain a payloadfalse
- Message signals an error condition and carries only one byte of payload. This byte is an error code.Between different boards CAN transceivers are used. Compared to RS485 the CAN transceivers have the advantage to work without a separate direction input. You can just connected the transceiver directly to the UART of your microcontroller.
Within a single PCB, standard digital levels are used (either 0-3,3V or 0-5V) in a multi-drop configuration. Meaning it does not allow multiple drivers but multiple receivers. The idle state of a UART transmission line is high, so standard TTL-AND gates have to be used for bundling transmission lines from multiple slaves.
Both approaches can be combined to reduce the number of needed CAN transceivers on a single board. Between two boards you should always use transceivers and therefore differential signaling to improve noise immunity.
The signal lines to indicate events by the slave are strict optional, you may or may not use them (if the slave provides them).
enum modm::sab2::Error |
Error code.
Error codes below 0x20 are reserved for the system. Every other code may be used by user.