New USB Host hardware for ER9x

General mods that are considered worth doing; regardless of the end firmware you use.
Post Reply
jpiii
Posts: 8
Joined: Wed Jul 25, 2012 6:43 pm
Country: -

New USB Host hardware for ER9x

Post by jpiii »

Please move this topic as appropriate.

Here is a link to our new USB host board for the ER9x.

http://www.youtube.com/watch?v=j0aUPDQX_hk&noredirect=1

It uses an FTDI host as the core of the module to power and interpret a standard PC USB joystick.
The joystick data is then parsed and sent out over UART to the ER9x. The ER9x source was downloaded and modified to use the UART data instead of the analog reads that are currently present.

<iframe width="560" height="315" src="http://www.youtube.com/embed/j0aUPDQX_hk" frameborder="0" allowfullscreen></iframe>

It uses UART port 1, so the same mod that the Telemetry units use (FRSky etc) is used for the USB Host.

The gear switch on the ER9x controller is currently set up as a buddy switch. If it is flipped, the control reverts back to the ER9x, and it ignores the UART data.

I'll be uploading the source modified for the USB joystick as soon as I can get some decent comments in it.

User avatar
Kilrah
Posts: 11109
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: New USB Host for ER9x

Post by Kilrah »

Interesting, looks like there's quite some latency though...

Why not have your USB host board output a simple PPM signal that can be fed to the trainer input, sparing the custom er9x version and leaving posssibility to mix joystick and radio control?
BushmanLA
Posts: 1
Joined: Wed Jul 25, 2012 7:19 pm
Country: -

Re: New USB Host hardware for ER9x

Post by BushmanLA »

The main reason we didn't do this is because we intend on doing away with the Eurgle Radio at some point all together. This project is just a stepping stone towards that end.
So we wanted the USB host as integrated input stream to the controller.

Also generating PPM, only to capture and generate more PPM hearts my heart when you can get the digital values straight from the USB host.
jpiii
Posts: 8
Joined: Wed Jul 25, 2012 6:43 pm
Country: -

Re: New USB Host hardware for ER9x

Post by jpiii »

That is one way to do it, and we debated that for a while. The main problem is that all joysticks are different, and the USB payload varies in number of bits and in the order that they are delivered.
If we just dump the USB payload out over UART, we can allow for others using a different joystick with different features. Users can simply modify the open source ER9x code to parse their joystick data payload correctly and utilize all of the nice mixing etc already present in the ER9x code set.
User avatar
Kilrah
Posts: 11109
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: New USB Host hardware for ER9x

Post by Kilrah »

jpiii wrote:If we just dump the USB payload out over UART, we can allow for others using a different joystick with different features. Users can simply modify the open source ER9x code to parse their joystick data payload correctly and utilize all of the nice mixing etc already present in the ER9x code set.
Except that the 9x is already very short in available processing power and free flash memory, so it would sound more logical to do the decoding in the USB host board that has nothing else to do, and send a simplified standardized stream to the radio, no?

Well, I guess it works :D

jpiii
Posts: 8
Joined: Wed Jul 25, 2012 6:43 pm
Country: -

Re: New USB Host hardware for ER9x

Post by jpiii »

The USB host has plenty to do .... trust me ;-) There really isn't any great way to add PPM capability to that board without adding an auxiliary processor.
We actually tried to task it with that the first time, but couldn't maintain satisfactory timing with the PPM timers and the USB multi-thread host functions. Something inevitably would crash. Either the USB host would stop responding, or the PPM would get jittery.

Without the USB UART code additions, the ER9x load is:
Program: 56972 bytes (86.9% Full)
(.text + .data + .bootloader)
Data: 3465 bytes (84.6% Full)
(.data + .bss + .noinit)

With the addition of the USB UART code the ER9x load is:
Program: 58070 bytes (88.6% Full)
(.text + .data + .bootloader)
Data: 3637 bytes (88.8% Full)
(.data + .bss + .noinit)

The majority of the new USB code is one time overhead that isn't necessary to replicate for each joystick. Additions for other joysticks are added into a single function "InterpretData" that looks at the VID/PID of the USB joystick to differentiate between sticks. The VID/PID is sent over the UART when the joystick is plugged in.

I tried to standardize the UART stream to be similar to the telemetry data that is currently sent back to the ER9x. In fact, I borrowed heavily from the NMEA.cpp and NMEA.h to create portions of the USB.cpp and USB.h.

I'm hoping to post it soon for others to look at. I've also got a handful of extra prototypes that I'd like to get some beta testers for if anyone is interested.
User avatar
MikeB
9x Developer
Posts: 17996
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: New USB Host hardware for ER9x

Post by MikeB »

So you are feeding in serial data so you can use all the nice mixing, and then intend to do away with the 9x later. So what will do all the nice mixing then?
If you did send in PPM to the trainer port, you can do so much with the trainer input scaling and the mixer scaling you should be able to handle the different PC joysticks there.
Probably quicker then customising the er9x code.

Then again, if you want powerful processing and serial input why not just go for the ersky9x board with it's ARM processor and ready to use serial ports?

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
jpiii
Posts: 8
Joined: Wed Jul 25, 2012 6:43 pm
Country: -

Re: New USB Host hardware for ER9x

Post by jpiii »

"Then again, if you want powerful processing and serial input why not just go for the ersky9x board with it's ARM processor and ready to use serial ports?"

Exactly what we are looking at doing!

ER9x ARM with USB host integrated onto one board!

Could utilize the existing ER9x code framework and send ppm out. The user could directly run the radio, or use it as a PPM input to another device.
User avatar
MikeB
9x Developer
Posts: 17996
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: New USB Host hardware for ER9x

Post by MikeB »

I don't think the specific ARM processor used on the ersky9x board supports "on-the-go" host mode.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
jpiii
Posts: 8
Joined: Wed Jul 25, 2012 6:43 pm
Country: -

Re: New USB Host hardware for ER9x

Post by jpiii »

no it doesn't, you are correct. .... we would use the ARM on the er9x board on a new board integrated with the USB host controller that we've implemented.

Essentially the same thing you saw in the video. In the video, you saw the ER9x taking uart data from our usb host board. We would integrate the ARM onto our board and run the ER9x code set there.
User avatar
MikeB
9x Developer
Posts: 17996
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: New USB Host hardware for ER9x

Post by MikeB »

You might want to take a look at the ersky9x code then. This is basically er9x, but with the drivers for the ARM processor, and certain enhancements only available on the ARM. It also uses a RTOS.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
jpiii
Posts: 8
Joined: Wed Jul 25, 2012 6:43 pm
Country: -

Re: New USB Host hardware for ER9x

Post by jpiii »

I'll have to take a look. I pulled the er9x code from the google group.

Can you point me to the right place? http://www.ersky9x.net/ doesn't seem to have code listed.
User avatar
Kilrah
Posts: 11109
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: New USB Host hardware for ER9x

Post by Kilrah »

User avatar
Kilrah
Posts: 11109
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: New USB Host hardware for ER9x

Post by Kilrah »

jpiii wrote:The USB host has plenty to do .... trust me ;-) There really isn't any great way to add PPM capability to that board without adding an auxiliary processor.
We actually tried to task it with that the first time, but couldn't maintain satisfactory timing with the PPM timers and the USB multi-thread host functions. Something inevitably would crash. Either the USB host would stop responding, or the PPM would get jittery.
You didn't mention which uC you used, but nowadays most have at least one output compare module. If it's the case and you can thus generate the PPM signal by hardware, no problem. All you have to do is update a register once every 300-1200us, without having to be precise or consistent on the timing.
jpiii
Posts: 8
Joined: Wed Jul 25, 2012 6:43 pm
Country: -

Re: New USB Host hardware for ER9x

Post by jpiii »

The USB host board is based on an FTDI chip. There is no output compare module. You have to run it with timer interrupts to generate the PPM with a standard GPIO.
The FTDI device is really useful for the actual USB interface, but for everything else it kinda sucks. I can run multiple USB endpoints with relative ease, and we want to eventually try a full HOTAS setup with rudder pedals. (All standard PC type equipment)

On the FTDI chip, even running it at max clock speed, the scheduler can't keep up with the demands from both the USB interface thread, the PPM interrups, and the other housekeeping functions.

I played around for several days with manipulating thread priorities and fail safes, but inevitably either the USB side would die, or the PPM stream would jitter unacceptably.

I suppose we could have gone with another device for the USB interface that could handle the PPM generation as well, but I've got alot of experience working with the FTDI device family, and have found them to be much more reliable than the other non-dedicated microcontroller approaches.
User avatar
kaos
Posts: 3247
Joined: Wed Dec 28, 2011 1:15 am
Country: United States

Re: New USB Host hardware for ER9x

Post by kaos »

If you get this thing working either with stock board or the ersky board. I probably will be the 1st one to jump on it. ;) preferably ersky board. ;)
jpiii
Posts: 8
Joined: Wed Jul 25, 2012 6:43 pm
Country: -

Re: New USB Host hardware for ER9x

Post by jpiii »

kaos wrote:If you get this thing working either with stock board or the ersky board. I probably will be the 1st one to jump on it. ;) preferably ersky board. ;)
Its working now with the stock board, I am ordering an ersky board now to do a custom box without thumb sticks.

Shoot me an email or IM if you want one of my prototypes. We've got 9 of them and are sending them out to beta testers for the cost of the parts and shipping.

We'd love to get as detailed feedback as possible.

Post Reply

Return to “Electronic Mods”