#SBus client
## Overview
Well… Not much to say here. I have the radio, the receiver, a Teensy3.1 and some spare time. Let's hook everything together =D
## Protocol
### Technical details
The technical details originaly come from Uwe Gartmann from the MBed website (source link in the Links section). Because it would have been to easy to use standard settings, SBus serial communications use:
* A baudrate of 100000 b/s * An inverted logic * One parity bit * Two stop bits * MSB first (that the only common thing !)
Luckily, the Teensy3 can manage that
The SBus protocol sends a message every 7ms (high speed mode) or every 14ms (low speed mode).
### SBus protocol
A common SBus message requires 25 bytes of data:
F0 xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx yy 00
* F0 is the start byte. It should always be 0xF0. You can sync on that I guess if you want to. * xx are the data bytes. There should be 22 of them. SBus manages 16 analog channels, and uses 11bits for each, so 11*16/8 ⇒ 22 bytes.
* yy is the flag byte
* 00 is the stop byte. It should always be 0x00. You can also do some check to check there was no lost/added byte in the serial communication.
### Typical Frame
F0 2E 90 FB 1F 1D EC 8E 0F B6 F3 DE 07 C6 A0 D4 1A 83 50 6A 0D 41 A8 00 00
* Starts with 0xF0 * Flag is 0x00, no error. * Ends with 0x00
### Radio off
If the receiver was getting data and then looses the connection (eg, if you turn off the transmitter). It outputs something like this:
F0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 30 00
The only interesting byte is the flag byte; 0x30 means the receiver is in failsafe mode and that a frame was lost (no kidding :-°). Good
## Code
Well, it's heavily adapted from the SmartPort Master code. Same warnings, same wiring (Gnd on Gnd, Vcc on Vcc, SBus signal on TX1/PB17). It doesn't do much, but might help start/debug another project…
Here's the last version of the code: tsysbusrecv_20141008_1942.tar.gz
## Next ?
* Decode the CH* values * Port to Attiny (cost, embeddable, …) * Emulates a joystick with Teensy3, so I can use the RC simulator softwares without any cable.
## Links
* http://forum.pjrc.com/threads/23956-Teensy-3-UART-settings * http://developer.mbed.org/users/Digixx/notebook/futaba-s-bus-controlled-by-mbed/