Radiomaster Serial Port Driver

178 views
Skip to first unread message

Giorgina Makara

unread,
Jul 25, 2024, 10:17:55 PM7/25/24
to Paper.js

I am looking to get some input on using SBUS on the Arduino Due. Hopefully I am posting this in the right thread. Please forgive me if I am not. I'll give some background on myself and then on the project I am working on.

I have done one or two really simple projects on Arduino's before (previously on a Nano, and now I am using a Due). I would consider myself a novice and although I am a engineer by profession (mechanical) and have a reasonable understanding of electronics and circuits as well as some coding ability. I know very little about the inner working of COM protocols or the more technical aspects of microcontrollers. So I guess what I am looking for is advice but explained in layman's terms if possible. I have tried searching for the answers I need but can't quite find what I am looking for, and most of what I find is a bit beyond my understanding or is some library or piece of code without any documentation.

So basically I am building a quadcopter/VTOL drone of sort (Its not necessary to explain further) and I am using the Due as the flight controller. The little RF receiver I currently have is the R161 from Radiomaster (and I have a openTX Radiomaster transmitter). The R161 uses SBUS and I am looking to find out how I can read in this SBUS on one of the Due's Rx pins, decode it, map/scale it, and use this as the inputs for the LQR controller.

So Question 1 is on the RF receiver. I understand that FrSky uses inverted SBUS whereas Futaba uses non-inverted - is this correct? I think the R161 is FrSky compatible, so I am assuming this means that it uses inverted SBUS?

Question 2, if it is inverted, is it correct to say that I will need to un-invert the SBUS before connecting it to the Rx pin on the Arduino? I have the resistors and transistors on hand to do this if I indeed do need to do this. I found the details of the resistors and transistor needed to do this online somewhere.

Question 3. I was looking at what libraries are available. And it looks as though the bolderflight one wont work on the Due, as the device is not supported - is this correct? I found another library: GitHub - mikeshub/FUTABA_SBUS: SBUS driver for arduino - which although isn't accompanied by documentation, I think it may potentially be something that would work. Not sure if anyone can confirm this? I'll probably seek advice on the code of the example in this library and how I would change it for the Due. But I'll leave this perhaps for the next post after these initial questions.

Question 4. Lets assume that I have an SBUS signal coming in (un-inverted if need be). Can I put this on any of the Serial ports? Preferably not the native USB one right? so if I say put it on the Rx1 pin. Would I initiate the coms by saying Serial1.begin(baud rate)? I think the FUTABA_SBUS library allows you to specify the Serial port in the header file.

Question 5. If you read in SBUS from say Serial1 and you map it to the values you need, if I wanted to see this in real time, would I then write the values to the usual Serial port to see it on the Serial Monitor window?

Question 6. I have seen that the baud rate is typically specified at 100k or possibly 115200 but nothing more than this. Lets say I specify the baudrate at 115200. What sort of time are we talking here to read in the 16 channels on the SBUS in the main loop of the code? I have seen values of a good few milliseconds - that seems quite slow. I would like to keep this value as low as possible.

I think that is it for now. I apologize for the bombardment of questions. I would appreciate any help to any of the above questions. I am quite far along in my project in terms of the physical build, I have also got my BLDC motors, servo motors working. I have modelled the state space, simulated the LQR controller etc. so things are almost there. Getting the control inputs from the radio receiver is the last major obstacle for me. Building a rather complicated VTOL aircraft from scratch and using an Arduino is almost certainly not the easiest/cheapest option, but I have mainly decided to do this as a learning experience (and a hobby to keep me busy).

I eventually managed to get SBUS working on the Due. As a Arduino novice it was a bit of a headache as I didnt really know what I was doing, so I thought I would post the working solution for anyone else who may find this info useful.

Hi! I'm trying to do the same thing) I have a Radiomaster R161 receiver and want to use Arduino Nano to parse SBUS data from it.
Did you figure out whether Radimaster has Futaba (uninverted) SBUS or FrSky-like (inverted) SBUS? As I understood, in case it is already inverted - I can feed it directly to Arduino's serial, whereas in case it uses Futaba's SBUS, I will need to use an additional logical NOT scheme.

I am having trouble installing the latest firmware on my Cube Orange. I can not seem to get the Cube Orange to be recognized as a device when I plug it in to my computer with a USB cable. I have read many forum posts on different ways to solve the problem, but am having no luck. Here is some background information to help with understanding the problem.

I am trying to build an autonomous boat so I am planning to use the ardupilot rover with skid steer. The boat is built and I have the Cube Orange flight controller with an external buzzer, Here 3 GPS, rc control with an R168 and a Radiomaster TX12, telemetry is with a RFD-900x-US ultra long range radio modem, power through a power brick mini, and two Blue Robotics ESCs to two T200 thrusters. All of this is connected and powers up just fine.

Prior to receiving the thrusters I set up the flight controller, GPS, and telemetry in a box to learn about how all that works. I installed Mission Planner on my laptop (Win10) and was able to connect using Mavlink on Com Port15. It works good and I am able to track my self walking around with the flight controller box. All data and maps work great in Mission Planner.

In all of these cases, nothing is showing up in Device Manger under the ports or USB connections. I tried this with peripherals connected and disconnected and with the microUSB card installed and uninstalled.

It seems like the Cube Orange is functioning properly thru Mavlink, but it will not connect thru a USB to the computer. I have tried to update the drivers a bunch of times as that seems to be the problem, but not connecting on 3 different computers is strange.

The problem has been fixed. The suggestion by Bjrn Opitz turned out to be the issue. I tried an new USB cable that came with a toy for my son and it worked perfectly. So I guess there must be some variation in data transfer capabilities among USB cables. This was the 5th different cable tried, so try a different USB cable if it will not connect.

I see multiple people having this problem but not seen an answer why or a solution: The Virtual COM Port driver (1.4) is not working for Windows 10 users. I have the same problem. I download the Driver from:

Ant - Thanks for the reply! I actually have an STM32F429 board in addition to my STM32F411. I built the Tracealyzer demo, flashed it to the board and the 'STMicroelectronics STLink Virtual COM Port' magically appeared under 'Ports' in 'Device Manager'. Yay!!

However, what I don't understand is what exactly happened with the board/software/driver that caused the COM port to work. I've studied the 'USB F4 VCP Device' section of the PDF you've linked to but nothing there is making it entirely clear why this suddenly works.

At first I figured the COM port appeared because the Tracealyzer software running on the board activated certain peripherals to cause the 'connection' to happen. However, since then I've flashed different software (like just a simple light blink example), I unplug the board, plug it back in and it's surprising to me that the COM port for the

Even if you don't 'connect' to the device, it should show up in device manager on your PC as plugging it in starts the enumeration process and establishes the connection. It could be clock related, or maybe you are missing the USB interrupts being enabled (check in CubeMX).

No dice. I plug my STM32F429 in and ''STMicroelectronics STLink Virtual COM Port (COM5)'' shows up under ''Ports''. in Device Manager. I unplug it, and plug in my STM32F411 using the same USB cable and port and nothing

In CubeMX on pinout tab, locate USB_OTG_FS and set mode to device only, also untick Activate_VBUS... don't think this is required, check the 429 project. Then if you look at the top under middlewares USB_DEVICE should be in bold, click the drop down box (Class for FS IP) and select communication device class. Save and generate code.

Hi Ant - Thanks for the tips. I followed your instructions, but unfortunately still no 'STMicroelectronics STLink Virtual COM Port' listed under Ports of Device Manager when making these modifications, generating code and running it on the STM32F411 board

I've attached my latest IOC file with the modifications you've suggested. I also did various comparisons between it and the IOC from your F429 TraceAlyzer project and I'm not seeing any outlying, obvious differences that could be causing the problem.

If you look at the attached IOC in Cube MX you'll notice I've activated GPIO pins D12, D13, D14 and D I do this because in the main loop I toggle the LEDs on the board just to make sure something works. So, the only code I add to the generated project are the following two lines in main's while loop:

At this point I'm wondering if something is physically wrong with my STM32F411 board. It costs around $20 USD to order a new one. I prefer to not spend $20 on something I already have, but I can afford it. Think I should try getting a new STM32F411 board?

Maybe check if there are any solder bridges that need connecting on the board, swap the USB cable, try a different port... although I'm sure you have already tried these. Check the schematic vs the board, soldering on the dev board USB socket.

So, I'm an idiot. I step thru the code as you suggest, and definitely see it going through the USB init steps. I then examine the board and don't notice any anomalies, then suddenly think 'hey, why not try and plug a USB cable into CN5 and connect it to the Win 10 machine', I do so, and bingo, 'STMicroelectronics Virtual COM Port (COM4)' shows up under 'Ports' in Device Manager.

Reply all
Reply to author
Forward
0 new messages