Jump to content

Yet Another OpenSource USB Controller


Recommended Posts

http://Http://www.hempstick.org

 

Announcing Hempstick OpenSource USB firmware for Joystick and general purpose flight sim controller.

 

1. Uses Atmel's ARM 32bit MCUs, up to 120Mhz.

2. You buy the supported boards from either Atmel directly or buy the Arduino Due board from anywhere (none of my business).

3. Contains FreeRTOS, a real-time operating system and is fully multi-threaded, unlike Arduino's dumb busy polling loop wasting CPU cycles.

4. Uses voltage level change event-based interrupt handlers tasks to read buttons and switches. No button press, no CPU cycles used.

5. Up to 16 channels of 12bit ADC. Contain a digital averaging noise filter. Can use over-sampling to increase resolution to 14bit w/ software (can do 16bit, but I personally feel it's quite phony so it's artificially limited to 14bit). ADC reading uses DMA freewheeling, without software intervention, so you always get the latest ADC values at the USB report time.

 

7. Reads TM Cougar and Warthog sticks with hardware (only for MCUs that have SSC modules, SAM4S and SAM3X), so it doesn't waste CPU cycles to generate the right wave form for the stick's buffer.

 

8. 1000 samples per second, max a full speed USB can do. There is plenty of CPU to do more, but no point of doing that.

 

9. Configure the USB VID/PID to anything you want. My CH rudder is, for instance, configured as TM16000, as I don't have any USB VID. Works just fine. Currently, these values are compiled in. A planed feature would let you configure them at runtime, as these are written in SRAM, unlike some written in ROM.

 

10. You get the source code, install the IDE, change a configuration file, press a button and it burns the firmware for you. Instructions in the form of PDF and iBook. For some boards, you will need to buy a hardware programmer, but for some other boards, Atmel includes an EDBG chip on board that allows you to debug/program the MCU w/o additional hardware debugger.

 

Yes, you read that right, YOU BURN THE FIRMWARE. Don't worry, I have step-by-step screen shot instructions walking you through downloading/installing the software tools to pressing the button to compile/burn the firmware. Installing the IDE is not unlike installing a game program. After the installation, all you will need to do are unzip the source code, open the two projects, change a config file and press the build button.

 

11. Uses Atmel Software Foundation library, so supporting newer faster/better Atmel MCUs would be quite simple. For instance, I just got my paws on a SAM4E board that has a build in Ethernet on die, and Atmel's W23 WiFi module is just announced and availability is imminent.

 

Planed feature includes reading MLX90363 ion SPI digital mode.


Edited by Hempstead
  • Like 1
Link to comment
Share on other sites

That should work, although I have not done it myself. If you wish to have Hempstick masquerading as a TM Cougar, I cannot tell you exactly how, in fear of DMCA. But it should be just some configuration changes without any source code modification.

 

Take a look at this post on SimHQ 3+ years ago, http://simhq.com/forum/ubbthreads.php/topics/3140402#Post3140402. That CADDY was my old handle on CougarWorld.

 

However, Cougar has some of the configuration/settings sent to the board and stored right there, including axe curves. Hempstick does not do that. So, even if you make it masquerade as a Cougar, you cannot use Foxy to configure it. It's just not a Cougar and I have no intention of making it a Cougar. Why bother? Use vJoy.

 

Nice Hempstead :thumbup: One of our guys had an issue with the PCB of the Cougar jpoystick not long back. He did manage to get a used board but I will keep this in mind in case a similar problem arise. Thanks for sharing :thumbup:

 

Cheers

Hans

Link to comment
Share on other sites

No I wasn't thinking of Hempstick masquerading as a TM Cougar. I just wanted to the joystick up and running again. I have taken apart my own TM Cougar throttle and installed a Leo Bodnar card so that it shows up as a plain joystick controller. And here of cause I cannot use Foxy either. Actually I didn't have any problem with the board. I just wanted to get rid of Foxy

 

To me it looks like what Hempstick can do is similar. It can turn the Cougar stick into a standard joystick controller and then the mapping and curves will have to be done in the game.

 

Correct me if I am wrong.

 

Cheers

Hans

Link to comment
Share on other sites

Did you run 22 wires into the Cougar stick with the Bodnar board or 5? With Hempstick, I run 5 using the original PS2 connector; didn't even open the stick to rewire anything.

 

True for regular pit builders that Hempstick just turns your whatever creation into a regular USB HID controller; that's the whole point so it requires no special driver on the OS side! ;-) But it's possible to use TARGET to do the curve and more. Bodnar can't do that. He does that, he will probably lose his USB license over that. But he might be able to implement similar feature and let you change it. I don't know, I am not a lawyer. However, I don't have a USB license to lose and I am not doing it. You are doing it. And it's NOT ILLEGAL for you to do it. USB developers do it all the time. It just might be illegal for me to tell you how to do it, because of DMCA. So I am not tell you how, just that it can be done easily with Hempstick.

 

And it uses much more powerful 32bit ARMs MCUs than other flight sim controllers out there. You can do a hell lot more with these ARMs. Reading the ThrustMaster Cougar/Warthog sticks is just one such example. You want more sensors, and outputs, write it up. There's plenty of CPU cycles available! Actually, this is one of the main initial points I had against using the Bodnar board myself. I bought a Bodnar board, and found out I can't do a lot of things I want it to do. So, I decided to roll my own, which eventually evolved into Hempstick.

 

Since it's OpenSourced, it's perfectly ok for somebody else to design a board laid out more friendly to pit builders, burn custom Hempstick firmware on them, and sell them. It's just that I ain't gonna do that.

Link to comment
Share on other sites

I can't really say how complicated it would be to really drive the FF motors.

 

So far, Hempstick does only input to the host, but not output. If they really use the standard USB HID FF standard, it shouldn't be too difficult to change the device descriptor and report descriptor and to invoke an RTOS task when a report is received. But what the task does, I have no idea. Particularly, I have no idea how G940 and FFB2's motor drive work. You got to reverse engineer that first.

 

If they use custom Windows driver and sends custom protocol over to the controller, then you got to reverse engineer that protocol too.

 

 

It's OpenSource, take a crack at it.... I can help, but output to it is low on my priority.

 

I will soon put up a forum on http://www.hempstick.org to support the Hempstick though.

 

 

Hi Hempstead, how complicated might me do add force feedback functionality to this device?

 

Maybe to use an existent FF device like G940 or MS FFB2 and to shadow only the axis

 

 

Hi Hempstead, how complicated might me do add force feedback functionality to this device?

 

Maybe to use an existent FF device like G940 or MS FFB2 and to shadow only the axis somehow.

Link to comment
Share on other sites

Yes, very easy. Just change a couple of lines in the header file and configuration files and change the USB descriptor to match and you are done. No code change.

 

However, the current supported boards do not wire all the leads out, and they have some on board "stuff" like additional RAM, SD card, etc. that are wired up already.

 

But you can make a vanilla board to bring out all of them.

 

Nice work, one Q, the old 32 input limitation for DX is long gone, is it easy to scale past 32?

 

cheers

 

Peter

Link to comment
Share on other sites

Hempstick Forum is Online

 

I have added a JForum on http://www.hempstick.org. You can either use the link on the site or you can directly hit it with your browser at http://www.hempstick.org/jforum.

 

Fire up your questions, suggestions, and requests (or demands;-).

 

The Hempstick site now has minimal information. Everything is work in progress, more information will be added slowly, as well as features. Check back often.

 

From here on forward, announcements will be posted on the Hempstick forum. But milestone and important announcements will be cross posted here for your convenience.

 

And you can also PM me there for ordering the PTFE ring.

Link to comment
Share on other sites

Awesome work Hemp. Any chance you could make an entry in the wiki in my sig for this?

Seems like useful knowledge.

[sIGPIC][/sIGPIC]

 

Creator of:

 

F-18C VFA-195 "Dambusters" 1998 CAG Livery

https://forums.eagle.ru/showthread.php?t=213788

 

F-18C VFA-195 "Dambusters" July 2001 CAG Livery

https://forums.eagle.ru/showthread.php?t=215950

 

Pilot avatars for DCS Logbook

https://forums.eagle.ru/showthread.php?t=221160

 

How to make a DCS A-10C Panel

http://forums.eagle.ru/showthread.php?t=65998

Link to comment
Share on other sites

User Manual Correction v.1.0.1

 

I apologize to those who read the User Manual and clicked on the links to libHemp.zip and Hempstick.zip in the PDF file... they don't exist anymore.

 

I have corrected the document on pp.12 to reflect the the move of the source code to GitHub.

 

For the full announcement, please see http://www.hempstick.org/jforum/posts/list/0/6.page#6

 

 

 

Also apologies to those who tried to download the user manual and got 404 yesterday... I honestly forgot I had to put those documents back after I updated the site pages. Sorry, I got to get this process better and less error prone.

Link to comment
Share on other sites

New code pushed to GitHub. Do your git pull to update your code.

 

1. Fixed a problem with enabling/disabling reading TMStick. Now, just flip a flag and it deals with all the crap for you, instead of having to change several places for that.

2. Added a new feature to allow ADC channel to HID axes mapping. Meaning, which ADC channel do you wish to map to which USB HID axis. No longer needs to change the code for it.

 

For the official announcement, see http://www.hempstick.org/jforum/posts/list/0/9.page#17

 

 

The next project will be to demonstrate how to use Hempstick to hook up your rudder. Obviously, this will be easy 3 axes. But the purpose is to get you started on where things are, what configuration files to change for what.

 

The demo project after that will be building on what you learned from the rudder hook up. we will do the whole Cougar (yes, both throttle and the stick).

 

I will connect the rudder and Cougar to TARGET. But I can't show you the critical part. You will have to figure that one out yourself.

Link to comment
Share on other sites

fantastic work! Any thoughts on supporting teensy 3.1?

 

Sorry, not a chance. Because I use Atmel Software foundation library in Hempstick code and I use other Atmel hardware/software during development so I am stuck on Atmel chips. This makes it easy for me to support other new chips from Atmel, like the new SAM4E with 16bit ADC and Ethernet. But there is a price to pay... Teensy 3.1's chip is a Freescale. No chance Atmel will support it, so nor will I.

 

Getting stuck on a family of chips is very common in embedded development. Teensy made the conscious decision of moving from Atmel to Freescale and that decision has its consequences. This is one of them.

 

Even though it's also possible to support other Atmel chips, like Arduino Uno's ATMega AVR chips, I will not support them either, because that defeats the whole purpose of using higher end chips to do much more advanced functions at much higher speed.

  • Like 1
Link to comment
Share on other sites

Rudder Demo Project

 

As promised, the Rudder Demo Project is up. The announcement is at http://www.hempstick.org/jforum/posts/list/0/11.page#19.

 

This document will take you step-by-step from a blank SAM4S XPLAINED Pro board to having the rudder show up in TARGET. However, again, I cannot tell you how to make TARGET accept Hempstick. That part you have to figure it out by yourself. But if you read the document carefully, it's almost inevitable that you will figure that out by yourself.

 

It's just two values you must choose yourself. Choose wisely and it gives you eternal life, Indy.

 

The document is at http://www.hempstick.org/download/manual/RudderDemo.pdf or http://www.hempstick.org/download/manual/RudderDemo.ibooks. They are still a bit rough, haven't done much proof reading yet. So, please let me know of any error or suggestion.

 

I have not updated the Hempstick web site's download section for this yet (some yet to be finalized work-in-progress changes of the the site prevented reflecting just this change).

Link to comment
Share on other sites

Yes, very easy. Just change a couple of lines in the header file and configuration files and change the USB descriptor to match and you are done. No code change.

 

However, the current supported boards do not wire all the leads out, and they have some on board "stuff" like additional RAM, SD card, etc. that are wired up already.

 

But you can make a vanilla board to bring out all of them.

 

Doh.... I forgot I already bumped it up to 64 buttons a year ago.... It would take me maybe 15 minutes to bump it up again, but it takes a lot longer to validate that it works for all supported boards and release it.

 

However, please remember, each button is connected to an MCU pin directly so we can take advantage of the built-in hardware rebouncers, resistors, glitch filters, and level change interrupt on each pin. And I do not provide the full mapping of the 64 buttons. You have to provide that, b/c I have no idea what mapping you actually want to have. Ok, ok, I am more interested in coding it right than tedious data mapping.

Link to comment
Share on other sites

Any plans on adding FFB support? :)

 

Sorry, no plan for FFB. Personally, I am not interested in FFB, and I don't have the required motor drive electronics expertise for it.

 

It's OpenSource, so, other people with the interest & expertise can build it. I can provide the support for Hempstick side.

 

My current priority for Hempstick is as the followings.

1. Demo project for Cougar conversion with Hempstick & Documentation.

2. SAM4E board & Ethernet support.

3. DeviceNet protocol & LED PWM support.

4. MLX90363 Hall Effect sensor support.

5.... maybe... support for a chip to do analog air core gauges (very low priority for me even though I already have some of those chips & some air cores at hand).

 

I can be convinced with different priorities... but FFB is a tall order.

 

After that, I go back to why I started the Hempstick to begin with -- build my panels, joystick, rudder, and other stuff.

Link to comment
Share on other sites

SAM4E support delay

 

Hit a brick wall in SAM4E support project, USB port stopped working... Got to be something stupid like didn't configure the USB VBus pin correctly, the new chip requires slightly different calling procedure, need to explicitly configure USB interrupt b/c of default value changed, or something like that... Aaahhh... No worry, I will figure it out eventually. But it will take longer for this board to be supported.

 

I do regret sitting on Hempstick source code w/o releasing it for a year, even though I finished it, put up the GPL v.2 license notice in source, and wrote the User's guide a full year ago already. I blame my sofa being too comfortable. Ok, BattleField 4 should share some blame too while I am at it. ;-)

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...