rc:dev:sbus_client
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rc:dev:sbus_client [2014/10/08 23:22] – [Trame] redox | rc:dev:sbus_client [2023/11/24 21:55] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 2: | Line 2: | ||
## Overview | ## 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 | ## Protocol | ||
Line 7: | Line 10: | ||
### Technical details | ### Technical details | ||
- | Because it would have been to easy to use standard settings, | + | The technical details originaly come from __Uwe Gartmann__ from the MBed website (source link in the Links section). |
* A baudrate of 100000 b/s | * A baudrate of 100000 b/s | ||
Line 13: | Line 16: | ||
* One parity bit | * One parity bit | ||
* Two stop bits | * Two stop bits | ||
+ | * MSB first (that the only common thing !) | ||
Luckily, the Teensy3 can manage that =) | 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 | ### SBus protocol | ||
Line 23: | Line 29: | ||
- | * (0x)F0 is the start byte. It should always be 0xF0. You can sync on that I guess if you want to. | + | * F0 is the start byte. It should always be 0xF0. You can sync on that I guess if you want to. |
- | * (0x)xx are the data bytes. There should be 22 of them | + | * 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. |
- | + | ||
- | | + | |
- | They could have made our lives easier and used 12bits per channel, but No... So: | + | |
* CH1 uses the first data byte (let's call it D0), and the 3 Most Significant Bits (MSB) of D1 | * CH1 uses the first data byte (let's call it D0), and the 3 Most Significant Bits (MSB) of D1 | ||
* CH2 uses the 5 Least Significant Bits (LSB) of D1, and the 6 MSB of D2 | * CH2 uses the 5 Least Significant Bits (LSB) of D1, and the 6 MSB of D2 | ||
- | * And so on... CH3 uses the 2 lSB of D2, the whole D3, and the MSB of D4...See, its not that easy to process... | + | * And so on... CH3 uses the 2 LSB of D2, the whole D3, and the MSB of D4...See, its not that easy to process |
- | * (0x)yy is the flag byte | + | * yy is the flag byte |
* Bit 7 (0x80) is CH17, it's a digital/ | * Bit 7 (0x80) is CH17, it's a digital/ | ||
* Bit 6 (0x40) is CH18, same. | * Bit 6 (0x40) is CH18, same. | ||
Line 38: | Line 41: | ||
* Bit 4 (0x10) indicates __Failsafe mode__ | * Bit 4 (0x10) indicates __Failsafe mode__ | ||
* Bits 3-0 are not used and sould be 0 | * Bits 3-0 are not used and sould be 0 | ||
- | * (0x)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. | + | * 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 | ### Typical Frame | ||
Line 58: | Line 61: | ||
## Code | ## Code | ||
+ | |||
+ | Well, it's heavily adapted from the [[: | ||
+ | |||
+ | Here's the last version of the code: {{: | ||
+ | |||
+ | ## 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 | ## Links |
/home/share/www/redox.ws/wiki/data/attic/rc/dev/sbus_client.1412810576.txt.gz · Last modified: 2023/11/24 21:55 (external edit)