Added JR XBus support for Pixhawk

Hello everyone,

I’m just getting back in to the world of DIY Drones after a year or so off (things have come on a long way since APM 2 came out!). I’ve been using a Pixhawk with a JR radio via the PPM Encoder but decided it was time to reduce my wiring a bit and use JR’s XBus instead. For those who’ve not come across it before the XBus is just a serial output from the receiver which contains all the channel data, much like the Futaba SBus and Spektrum DSM Satellite protocol.

XBus has two modes of operation; Mode A is a JR proprietary protocol which they have released the specification for here (in Japanese, but Google Translate does a fairly decent job). I first attempted to implement this through the Spektrum/DSM connector (the SBus connector would be more convenient, but unfortunately the Rx line is inverted!), but found that the custom baud rate of 250000 would almost certainly break the existing code.

Mode B, on the other hand, is an SRXL compatible protocol which uses the standard 115200 baud rate. It turns out that JR actually use the Multiplex version of SRXL with support for up to 12 channels with 12bit precision, details here. I have implemented XBus Mode B on the Spektrum DSM connector of the Pixhawk and have tested it with a JR XG14 Transmitter, the pull request for the PX4Firmare repository can be found here.

Because the XBus Mode B/SRXL protocol implements a checksum, I am fairly confident that my additional code should not interfere with decoding of DSM frames should a Spektrum receiver be connected instead. However, I am unable to test this as I don’t have any Spektrum kit. If there is anyone here who uses a Spektrum satellite and would be willing to test my firmware and make sure it doesn’t break anything, that would be great!

For anyone else with XBus kit who’d like to connect it to Pixhawk, my firmware should work for you. Simply follow the instructions here for building from source, but replace the PX4Firmare directory with my version:

mv PX4Firmware PX4Firmware_orig git clone https://github.com/omcaree/PX4Firmware.git

To connect the XBus to the DSM port you’ll need to make up a custom cable which provides power to your receiver from your BEC (the power output from the DSM port is 3.3V, JR receivers need 5V), but routes the XBus signal to the DSM Rx pin (the leftmost pin in this image).

If there is anyone else using other SRXL compatible radios (e.g. Multiplex, Graupner, etc…) and you would like me to add support for a particular protocol just let me know.

Cheers,
Owen

Dear Owen,

very helpful!
I tried to connect a PX4 clone (AUAV X2) with a Multiplex RX 7 M-Link which provides SRXL sum signal and failed. After some research in the internet I found your work.

I try to get up and running with your code during the next few days. I’ll keep you updated!

regards,
Daniel

Hi Daniel,

I hope it is useful for you!

Here’s a bit more info that might be useful. I recommend using the ArduCopter-3.2.1 branch of the ardupilot repositories along with my XBusTemp branch, rather than XBusInput as specified in the pull request. The reason for this is that the latest ardupilot builds use a different way of managing dependant repositories which I haven’t figured out yet!

Also, since my first post I have changed the logic for what gets decoded on the DSM port. I have introduced a #define in the px4io.h file of the px4iofirmware module which determines whether to decode incoming data as DSM, ST24 or XBus/SRXL (the default value in my repository is for XBus). The reason I added this was because the nature of DSM packets means that partially received SRXL packets can be interpreted as valid DSM data which then overrides the channels with nonsense data! It would be better to add this as a configuration parameter which can be set at runtime via MissionPlanner or similar but I have no idea how to go about this as the PX4IO firmware runs on a separate chip.

If you come across any problems running my code just let me know.

Cheers,
Owen

Dear Owen,

thank you for the hints!
…but after some evenings and almost the weekend trying to compile the code I’m now very close to give up.
Its all about merging your code to the “officical” code. I’m struggling around wrong references and other dependencies between the modules. And yes, I used ArduCopter3.2.1 branch with your code.
I’m pretty sure that I use the compiler in the right way, because I am able to build the “clean” code.

can you provide me a compiled PX4-V2 Firmware for testing?

thanks again,
Daniel

Hi Daniel, sorry for the delay I was on holiday for most of August!

I’ve attached our latest build of the ArduCopter-v2.px4 firmware, hopefully this will work for you.

What exactly is the error you were getting building from my repository?

Cheers,
Owen

Hi Owen,

I can’t belive this :smiley: :smiley: :smiley: :smiley:
Your compiled firmware works with my Multiplex RX-9-DR M-Link via SRXL(‘SBUS Mode B’) on Pixhawk.
Thank you very much :smiley:
Can you please explain which part of the px4code I need to use, if I want to include SRXL in an other px4 firmware? I need it for quadcopter.
dev.ardupilot.com/wiki/building-px4-with-make/

Kind Regards,
Sven

Dear Owen,

many thanks!
I can load the Firmware on a AUAV-X2 but I don’t get a signal. Maybe I have an issue with my RX, try to investigate this…
@Sven: which firmware version is yor RX? MPX changed the SXML in V1.3

my Problems compiling this were related to the usage of github and their tools. I learned a lot :wink:
Now it seems to work fine.

I’ll Keep you updated.

Thanks for your help,
Daniel

Hi Owen,
Hi Daniel,

I tried to compile the firmware in Windows 10, but I have problems with GitHub branches.
I can compile ardupilot master branch. If I select Arducopter-3.2.1 branch in GitHub Desktop, it won’t compile.
[attachment=2]compiler_error_3.2.1.jpg[/attachment]

Can you please provide me with a compiled PX4-V2 firmware for quadcopters?

@Daniel
The MPX programmer won’t work with Windows 10. So I cannot say wchich version my RX-9-DR M-LINK has. I created a ticket for MPX support.

Kind Regards
Sven

Hello,

I forgot to provide the receiver with 5V.
My version is v1.26.
I cannot update to v1.35, because RX-9-DR is unsupported.
If you have RX-9-DR-SRXl you cannot downgrade, because the receiver is unsupported I think.
[attachment=0]rx-9-dr.jpg[/attachment]

But I do not know if it’s the reason. Have you connected thr receiver to U1Rx on AUAV-X2?
Do you have the receiver switched to SRXL?

Kind Regards,
Sven

Dear Sven,

I got it in between, was the U1Rx pin, I found it after reading the manual again.
I have the 1.26 too.

Now I work on fixing my build Environment.
I have a Win 8.1 with PX4 toolchain and Eclipse this page helps me a lot to set up the environment to build a master branch.
Now I stuck when I switch to ArduCopter-3.2.1/XBusTemp with error during build fatal: reference is not a tree: c340616517c4736016898077bb9ac3ed3818a275 Unable to checkout 'c340616517c4736016898077bb9ac3ed3818a275' in submodule path 'modules/PX4Firmware' I hope I can find out something during this week. in the meantime maybe you can push Owen’s pull request: Click :slight_smile:

have a nice evening,
Daniel

Dear Owen,

I saw on MPX specification sheet that they added a version called SRXL V2 with 16 channels, maybe you can add this feature before the pull request will be approved :wink:

Many thanks for your work,
Daniel