UART reading on Pico: Struggeling to understand/make it work #15557
Replies: 2 comments 2 replies
-
Your best bet would be to read the incoming data properly (ie all eleven bits) Does the SBUS protocol use a start/stop bit in addition to the eleven data bits? EDIT: from machine import UART
uart = UART(0, baudrate=100000, bits=8, parity=0, stop=2, invert=UART.INV_TX | UART.INV_RX ) |
Beta Was this translation helpful? Give feedback.
-
Out of interest, are you basing your work on Sokrates80/sbus_driver_micropython: a Micropython driver for the SBUS protocol? There's an issue comment which appears to help it work on the RP2040: Inverted SBUS: Pico |
Beta Was this translation helpful? Give feedback.
-
Hello,
I'd like to read data from a radio control system (Radiomaster Pocket and FrSky ) using the FrSky ACCST transmission protocol. The receiver has a so called SBUS signal that consists of 25 bytes:
1 start byte: 0x0f
22 data bytes
1 flag byte
1 end byte: 0x00
The information per channel is coded with 11 bits, so more than one byte is needed to transmit the information, e. g. channel 1 using bits 0 to 10, channel 2 using bits 11 to 21...
For getting the channel information I have found some code examples but that comes next. As a first step I read the SBUS information using UART functionality:
System gives readings that fits to my expectation at the first glance
I'd expect that the transmitted information will change if I change positions of transmitter's gimbals, but I get either the same information per read or see changes that occur occasionally (not caused by any interaction on the transmitter).
Example 1 (no gimbal movements)
Example 2 (with gimbal movement of channel 1)
Of course, the data shown above is more or less nonsense because decoding of the eleven bits per channel isn't done yet, but according to the definition of SBUS the first byte should always be 0x0F as well as the last one being 0x00. If I move gimbal of channel 1 I'd expect that bytes 2 and 3 will change, but the others will stay.
Therefore I'm wondering whether UART reading is the right solution. Or are my expectations wrong?
Best regards
Juergen
System: MicroPython v1.21.0 on 2023-10-06; Raspberry Pi Pico with RP2040
Beta Was this translation helpful? Give feedback.
All reactions