FrSky x8r reciever sbus - StefanClementz/libopencm3_libraries GitHub Wiki
The FrSky x8r reciever
The FrSky x8r reciever contains 8 traditional pwm-like signals with a period of 18 millisecond (~55.6 Hz) with an on-time (3.3 V) that varies between 1 and 2 milliseconds (duty cycle between ~5.56% and ~11.1%). SBUS is an alternative to using the PWM ports. The reciever also holds RSSI capability to measure the received signal strength and a smart port for telemetry.
The SBUS protocol
The FrSky SBUS allows for 16 channel use through a single signal wire which is obviously to prefer for a controller with a limited number of IO ports. SBUS is a inverted USART protocol with a baud rate of 100000. Fig. 1 shows the signal that was measured using an oscilloscope over a period of 20 milliseconds. Three frames are seen in the figure. Each frame consists of 25 bytes of data that are transmitted over 3 milliseconds and a new frame begins to be transmitted every 9 milliseconds.
Fig. 1: Sbus frames
A packet of transferred data containing a byte of proper SBUS data is shown in Fig. 2. Each packet contains a start bit "st" (+3.3V), eight data bits "a_0", "a_1", ..., "a_7" making a data byte, a parity bit "p" (even parity), and two stop bits "s" (0V).
The note regarding inverted USART above means that a low bit (0V) = logical 1 and a high bit (3.3V) = logical 0.
Immediately following is the next start bit and a packet with the exact same structure as the previous:
| st a_0 a_1 a_2 a_3 a_4 a_5 a_6 a_7 p s s |
| st b_0 b_1 b_2 b_3 b_4 b_5 b_6 b_7 p s s |
| ... |
Fig. 2: Sbus packets
For SBUS, each channel data consists of 11 consecutive bits. Example:
ch1: | b_2 b_1 b_0 a_7 a_6 a_5 a_4 a_3 a_2 a_1 a_0|
ch2: | c_6 c_5 c_4 c_3 c_2 c_1 b_7 b_6 b_5 b_4 b_3|
etc.
Decoding SBUS
There are two obvious ways to decode an SBUS signal.
-
Trigger timers on individual IO changes to measure time of high/low over a frame and decode the message after a frame has passed. The pro here is that the SBUS signal can be read straight off but it might be difficult to configure on the microcontroller without spending significant CPU time on interrupts.
-
Use a NOT gate, i.e., change low<->high, to convert the signal into a traditional USART signal with baud rate 100000, even parity, and two stop bits. This is currently the method implemented in this library