-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Futaba S-bus protocol requires to send LSBit first #65
Comments
I'm a little confused with your post, but my assumption is that you're trying to send SBUS commands from an ESP32 to a flight control system. Inverted SBUS is supported on the ESP32. If you look at the README, the SbusTx constructor for ESP32 is: SbusTx(HardwareSerial *bus, const int8_t rxpin, const int8_t txpin, const bool inv). The boolean inv flag controls whether the signal is inverted or not. You shouldn't have to worry about HardwareSerial setup, the baudrate, the header bytes or bit order - all you need to do is set the channel values and control the timing of how often you call the Write method. Most flight controllers will expect to receive a packet every 10 to 20 ms. |
I effectively set the parameter inv to true in order to make a 0 becomes a 1 (and vice versa) on the serial bus. |
I'm not aware of a need to reverse the bit order. I've tested the library with Teensy microcontrollers, Futaba servos, and FrSky receivers and servos. Other community members have used ESP32 microcontrollers and Futaba receivers. |
According to this https://github.com/uzh-rpg/rpg_quadrotor_control/wiki/SBUS-Protocol, it's stated: But (because there is always a but):
And now it works ! |
I have a FC Skystars F405 HD2 connected with a ESP32 (Arduino) by a serial link (100kbauds, parity even, 2 stop bits, inverted).
25 bytes are sent, starting with byte 0x0F and ending with byte 0x00.
The flight controler seems to catch the frame but does not decode it correctly. I spied the serial transmitter using Saleae Logic 16. I attached the capture of the first bytes sent. The first parameter sent is the throttle position (1498=101 1101 1010).
According to Futaba S-bus protocol, the LSBit shall be transmitted first. So, that's why the throttle is not equal to 1498 but equal to 733 (010 1101 1101).
I've added the inversion in my ESP32 software because the sbus library doesnot do it. Can you confirm that the library does not and I have to do it in my software ?
And, finally, if you have any idea why the flight controller shows me the value 1338 for the throttle (observed in Betflight) instead of 1498, it would help me.
Thanks.
The text was updated successfully, but these errors were encountered: