Jump to content

FreeJoy. OpenSource joystick controller on STM32


Recommended Posts

-FISTN-Ugly_Eric
Posted

So i read from the wiki, that with some future timetable you are planning to add ffb to this project. That kinda is the last straw for me to hop from mmjoy2 to freejoy. I already have planned all my controllers to mechanically accept ffb, in the hope of a future day use to it. 

Posted
1 час назад, -FISTN-Ugly_Eric сказал:

So i read from the wiki, that with some future timetable you are planning to add ffb to this project. That kinda is the last straw for me to hop from mmjoy2 to freejoy. I already have planned all my controllers to mechanically accept ffb, in the hope of a future day use to it. 

Thats right, its is planned after more common functions

vonrickenbecker
Posted
7 hours ago, WG_Magners said:

Thats right, its is planned after more common functions

Wow, I am more impressed with the scope of your project with every update! 

 

I think someone may have already asked this, but do you have a Patreon account? I would gladly donate to support this excellent work. 

Posted (edited)

My son and I have just started working on designing and 3D printing a HOTAS as something to do while we're in lock-down. I'm doing the electronics for it and found FreeJoy via a post on Reddit. While I'm waiting for my son to finish designing the stick, I've been working on a shift register circuit that we can install in the grip. It's been a while since I last did any electronics tinkering, and I'm more than a little bit rusty. I think I understand how to daisy chain the shift registers, but would someone mind sanity-checking my work before I send it off to China to be fabbed?

 

The attached schematic is for 3 x 74HC165 shift registers, giving 24 buttons plus the ability to daisy chain another board if required (I'm planning on using the same board in the throttle as well).

 

 

Schematic_SMD Shift Register_Sheet_1_20200411113400.png

Edited by terahurts
  • Like 1
Posted (edited)
6 часов назад, terahurts сказал:

sanity-checking my work before I send it off to China to be fabbed

 

The only critical thing is you must tie CE# pins to the ground (no resistor needed, just short them to GND). Also it is recommended to add 0.1uF caps between VCC and GND near every VCC pin of register. And I'd recomended you to use 10K pull up resistors but this won't make much difference.

Here is typical application schematic from Texas Instruments:
image.png.01db4cf753b4d09d123737ec8b4404cc.png

Please note that shift resistor's power supply should be connected to 3.3V in case of FreeJoy and BluePill (or other STM32 board)

Edited by WG_Magners
Posted

Beta version v1.5.1b5 is available now for test:

Configurator tool: https://yadi.sk/d/bX3eDSTYgg4r-w
Firmware: https://yadi.sk/d/Z_Y1CJJBECsq7A

 

Note that this version is only available for flashing with st-link programmer. But you still can downgrade from this beta to latest stable release with .bin file from configurator tool.

Main changes:

  • Now it is possible to set one Latch pin to several shift register chains
  • Pins mapped to shift registers now displayed on shift registers tab of configurator
  • Support of ADS1115 external ADCs * Support of AS5600 sensor in I2C mode *
  • Support of 3-axis MLX90393 sensor in SPI mode **
  • Support of all MCP32xx external ADCs(изменено)
  • A lot of bugfixes and improvements

* Connection of many I2C devices may reduce overall performance of the controller. I2C devices are connected to PB8 and PB9 pins

** Chineese purple board need some modifications for use in SPI mode:

Скрытый текст

2132276797_665ab4591a85(2).png.e4a358f44261c66a8cd256a12775d610.png

 

Posted (edited)

Release v1.5.1b3:

 

Firmware release page: https://github.com/FreeJoy-Team/FreeJoy/releases
Configurator release page: https://github.com/FreeJoy-Team/FreeJoyConfigurator/releases

 

Changes:

Скрытый текст
  • Now it is possible to set one Latch pin to several shift register chains
  • Pins mapped to shift registers now displayed on shift registers tab of configurator
  • Support of ADS1115 external ADCs
  • Support of AS5600 sensor in I2C mode
  • Support of 3-axis MLX90393 sensor in SPI mode
  • Support of all MCP32xx external ADCs

 

Full list of features:

  • 8 analog inputs (12 bit output resolution)
  • axis configuration options: calibration (manual or auto), filtering, offset, deadband (center or dynamic), curve shapes
  • axis to buttons function (up to 12 buttons per axis)
  • buttons/encoders to axis functions
  • 128 digital inputs (buttons, toggle switches, hat povs, encoders)
  • digital inputs configuration options: normal/inverted button, 3 types of toggle switches, radiobutton sequential button
  • 5 shift modificators
  • 4 hat povs
  • 16 incremental encoders
  • shift registers 74HC165 and CD4021
  • digital sensors  TLE5010/5011, AS5600, MLX90393 (SPI interface only)
  • external ADCs ADS1115 and MCP3201/02/04/08
  • 3 PWM channels for lighting
  • 24 LEDs (single or matrix) bindable to button's states
  • device name and other USB settings
  • user-friendly configuration utility
  • updating firmware on USB
  • saving and loading configuration from file

 

Instructions and guides are available on our wiki.

Edited by WG_Magners
  • Thanks 1
  • Upvote 1
Posted

OK, OK, you've talked me into it. I bought 3 x STM32F103C8T6 boards and a ST-LINK V2 STM8/STM32 module from ebay today, I have downloaded the STM32 ST-LINK Utility v4.5.0 and I'm really looking forward to seeing what I can create with this.

 

Looks like lots of fun. Will let you now how I get on with it. :)

  • Like 1
vonrickenbecker
Posted
On 4/16/2020 at 3:03 PM, WG_Magners said:

Beta version v1.5.1b5 is available now for test:

Configurator tool: https://yadi.sk/d/bX3eDSTYgg4r-w
Firmware: https://yadi.sk/d/Z_Y1CJJBECsq7A

 

Note that this version is only available for flashing with st-link programmer. But you still can downgrade from this beta to latest stable release with .bin file from configurator tool.

Main changes:

  • Now it is possible to set one Latch pin to several shift register chains
  • Pins mapped to shift registers now displayed on shift registers tab of configurator
  • Support of ADS1115 external ADCs * Support of AS5600 sensor in I2C mode *
  • Support of 3-axis MLX90393 sensor in SPI mode **
  • Support of all MCP32xx external ADCs(изменено)
  • A lot of bugfixes and improvements

* Connection of many I2C devices may reduce overall performance of the controller. I2C devices are connected to PB8 and PB9 pins

** Chineese purple board need some modifications for use in SPI mode:

  Hide contents

2132276797_665ab4591a85(2).png.e4a358f44261c66a8cd256a12775d610.png

 

 

Fantastic news Magners! Just got my MLX90393 from Amazon (same Chinese board you show), can't wait to try it. Referring to the note about cutting in your 90393 image, do I cut between the two solder pads, or should I cut the entire CS unit free?

Posted (edited)
1 час назад, vonrickenbecker сказал:

 

Fantastic news Magners! Just got my MLX90393 from Amazon (same Chinese board you show), can't wait to try it. Referring to the note about cutting in your 90393 image, do I cut between the two solder pads, or should I cut the entire CS unit free?

Cut between solder pads.

It originally connect CS directly to VCC to force I2C mode. We need SPI mode, so we need to release CS from this hard pull up.

After cutting you may solder 10K resistor between these pads to enable weak pull up for CS (optional)

Edited by WG_Magners
  • 1 month later...
Dirt_Merchant
Posted

Oi @WG_Magners checking in on your project and am so happy to read about FFB support coming down the line!

 

Also - tried to hit your paypal and it seems to be down - can you add a new donation link for us?

WG_Magners
Posted (edited)
1 час назад, [_FLAPS_]Dirt_Merchant сказал:

Oi @WG_Magners checking in on your project and am so happy to read about FFB support coming down the line!

 

Also - tried to hit your paypal and it seems to be down - can you add a new donation link for us?

Yes, i switched to patreon because of limitations of using paypal in Russia.. You can find donation link on github:

 

Screenshot_20200520-191410.thumb.png.101ea021064842af0f0a946f99a48e98.png

 

Donation will be used to buy the hardware (sensors, logical ICs, etc) for testing and development

Edited by WG_Magners
Dirt_Merchant
Posted

well noted sir!

Posted

Hi @WG_Magners

 

Great work you are doing with this platform, thank you.

 

I do however have an issue with the latest build, v1.5.1b6.

After loading it the UART method, my BluPill board does not get recognized on the PC and the green LED is very dim, barely on.

(On Github it did not say that it can only be done via ST-Link Programmer and only saw that here on this forum now.)

 

Could you please assist me in how to resolve this? Could this mean that my board is somehow broken due to this? Or should it work properly if I manage to obtain and download it with a ST-Link programmer and not with UART?

 

I tried a 2nd Bluepill board and then the green LED also went very dim after the download, so then I loaded v1.4.1 and it is working, but LED still dim, and 3 pins are not working anymore.

 

Any advice or guidance would be much appreciated.

 

Thank you in advance.

 

Qtin

WG_Magners
Posted (edited)
10 часов назад, Qtin сказал:

After loading it the UART method, my BluPill board does not get recognized on the PC and the green LED is very dim, barely on.

(On Github it did not say that it can only be done via ST-Link Programmer and only saw that here on this forum now.)

 

Dimming LED indicates problem with incompatible version of saved configuration (configuration stored in other memory section than application). Make sure to do full chip erase to wipe both old application and its configuration. 

UPD. Added this to guide on github. You surely can flash your controller via UART converter, i just have done it successfully.

Edited by WG_Magners
Posted (edited)

Hi @WG_Magners

 

Thank you for your reply. I've borrowed a ST-Link V2 programmer and did a full chip erase, but Windows is not detecting the device after flashing. Perhaps the STM32 chip has an issue. Atleast my other board is working with the order firmware, the Dim green LED went away after assigning "Button_Gnd" to pin C13, now when i short it to ground the LED goes bright green and then I read the input in the Configurator.

 

Keep well.

 

Qtin

Edited by Qtin
  • 3 weeks later...
Posted (edited)

Release v1.6.0

 

Changes:

  • HID bootloader (improved software updating algorithm)
  • Buttons logic completely reworked
  • Timer functionality for buttons (delay before pressing and press duration)
  • Sequential non-latching buttons
  • Logic buttons inversion option
  • Button output disabling option
  • Axis trimming by buttons
  • Axis centering by buttons (helicopter-style trimming)
  • Axis prescaler
  • Combined axes activation by button
  • Prescaler activation by button
  • "Equal" function for combined axes
  • Encoders as axes sources
  • Encoders reading resolution settings
  • High-resolution (fast) encoder support
  • Improved ADC performance
  • Improved shift registers stability
  • Configurator GUI improvements
  • USB-communication improvement

Migrating from v1.5.x without a programmer device

  • Run old configurator v1.5.x and connect your device
  • Using Firmware Flasher upload Bootloader.bin file from the archive to the device. It should reboot and connect as FreeJoy Flasher
  • Delete old configurator and install the new one (v1.6.0)
  • Upload new firmware FreeJoy_v1_6_0bx.bin via FreeJoy Configurator v1.6.0 as described in wiki

If you have a programmer device you can flash .hex file as usual (bootloader is already included in .hex file)

 

Firmware - https://github.com/FreeJoy-Team/FreeJoy/releases
Configurator - https://github.com/FreeJoy-Team/FreeJoyConfigurator/releases

Edited by WG_Magners
  • Like 2
  • Upvote 1
  • 1 month later...
Posted

Release v1.6.2:

Changes:

  • Fixed TLE501x sensors range mapping
  • Fixed some errors in SPI sensors reading
  • Fixed non-atomic access to buttons reading function
  • Axis centering now stored in config
  • Axis centering now affects on plus/minus functions for axes
  • Added debounce for axes to buttons
  • Axes from buttons (trimmers) operation extended to axis fullscale
  • POV center function for buttons for supports of RKJXT1F series POVs
  • Bluepill image in configurator changed to render
  • Fixed multiboard operation in configurator
  • Configurator does not require installation anymore

References:
Firmware
Configurator
Wiki

  • Upvote 3
  • 4 weeks later...
Posted

How many shift registers can I use on this? I would really like to use as much inputs as possible without using matrix wiring

Posted
2 часа назад, Smokedawg сказал:

How many shift registers can I use on this? I would really like to use as much inputs as possible without using matrix wiring

You can wire all 128 buttons by shift registers. 4 different chains possible

Posted

I am a noob to this whole thing and I am getting someone else to build a board for it so I can just solder on the blue pill and registers . Could you explain more so that I can describe it to another party who has a lot more experience to me. If things work out, I want to make the board files available to everyone. I know I am getting older and don't want to spend the time learning pcb design just to make 128 i/o's when I can pay someone else to do it in 2 hours.

Posted (edited)

A bit before i've posted reference schematic for shift registers connection:

 

Since you want to use all 128 input it can make sence to not daisy chain all 128/8=16 shift register but split them to 2 or 4 independent chains. In theory everything should be ok even with 16 registers in chain but i saw some people reporting about problems.
Shift regs use 3 signals for communication: SCK, DATA and LATCH.
SCK is B3 pin common for all regs chains 
LATCH can be set to any bluepill's pin and may be common for all chains or not

DATA can be set to any bluepill's pin and must be individual for each chain

You can use configurator tool to make it more obvious:
 

Common LATCH

Скрытый текст

image.png.5513665ed44473bb5594e446ac25a862.png

image.png.f6512f473808c84ece01e45b239f060b.png

 

 

Individual LATCH

Скрытый текст

image.png.77e3a07efaf0ab8254bf28595fb34bff.png

image.png.04135488ae0806c15d47d563ad06c9a4.png


One chain for all 128 inputs

Скрытый текст

image.png.2ea67ca6ccbb915efa9d345fde777256.png

image.png.af9978359aab0f2be4e3a74f531ce623.png

 

Edited by WG_Magners
  • Upvote 2
Dirt_Merchant
Posted

Heyo @WG_Magners!

 

I hope all is well for you!

 

Wanted to check in with you on estimated timeline for FFB support, or do you even have this on your radar yet?

Posted
10 часов назад, [_FLAPS_]Dirt_Merchant сказал:

Heyo @WG_Magners!

 

I hope all is well for you!

 

Wanted to check in with you on estimated timeline for FFB support, or do you even have this on your radar yet?

Hey, 

of course i'm going to do this, but i have to polish current functionality first since a lot of bugs and enhacements reported.

Also it is quite possible I will start FFB suppoting project on another board, stm32f4 blackpill

Dirt_Merchant
Posted

well noted! thank you very much for the update - i am sure we are all very much looking forward to this work!

  • Like 1
TantraTransair
Posted (edited)

Great work, very nice project and seems a lot cleaner than MMjoy but I just started exploring Freejoy. I am very interested to read the button state via an LED. I followed the guide but cannot get the LED to light up when a button is pressed. At the LED tab I used the input # from the button and tried both in normal and inverted. I connected the LED to GND and the pin assigned at the Pin config tab. seems pretty straightforward but I guess I am missing something here. Help is appreciated.

;)

Edited by TantraTransair
Already got the answer. I don't see a delete post button here
Posted (edited)

Hello, I am trying to create a shield for the STM32 and I am running into a few issues using FreeJoy Configurator 1.6.2b1 and I was hoping I could get some assistance.

 

1. The first issue occurs when using a common latch with 4 different shift register chains. I am able to set up the shift registers tab fine so there are 4 chains with 32 buttons each, but the Pin Config tab and Button Config tab only show 32 physical buttons. They should show 32 x 4 = 128 buttons. Upon further testing, I determined that the number of buttons displayed in the Pin Config tab is determined by the number of pins that I set to ShiftReg_LATCH, and not by ShiftReg_Data. This is incorrect as I am using a shared latch for all 4 chains.

 

2. The second issue occurs when I select the MCP3208_CS for a pin. The MCP3208 chip has 8 analog channels, however, when I add this device to a pin, the software only adds 1 Axis source. This is incorrect as 8 sources should be added for this chip.

 

3. The final issue has to do with the TLE5011_GEN signal. I have gone through the TLE5011 datasheet and I don't see any signal called GEN so I am unsure how this chip is supposed to be wired to work with the FreeJoy project. I was wondering if anybody had any experience with this.

 

Thanks

 

freejoy_unexpected_behavior.zip

Edited by nflaum
Posted

@nflaum

1) I will check this out soon, thanks

2) Not really a problem, you still can select any of 8 channels. I will add this to low priority fixes list

3) GEN is 4MHz output for TLE system clicking (TLE CLK pin)

Posted

@WG_Magners

 

Thanks. For the MCP3208, I'm trying to find out if the software will work at all with this chip because I need to decide if I should put it on my PCB or not. It's different from the MCP3201 in that you need to use SPI bits to determine which input channel you want to select and whether you want to use differential or single-ended inputs. It sounds like the FreeJoy software is not set up for this right now.

 

Ideally, I wanted 24 total analog inputs (8 on the STM32 plus 2 MCP3208 chips). Can you verify that the MCP3201 is working successfully? I might try to add a bunch of those instead, but the MCP3208s would be much better.

 

Thanks again

Posted (edited)
2 часа назад, nflaum сказал:

@WG_Magners

 

Thanks. For the MCP3208, I'm trying to find out if the software will work at all with this chip because I need to decide if I should put it on my PCB or not. It's different from the MCP3201 in that you need to use SPI bits to determine which input channel you want to select and whether you want to use differential or single-ended inputs. It sounds like the FreeJoy software is not set up for this right now.

MCP3201, 02, 04, 08 should work with FreeJoy right now in single ended mode.

Axis setup section has "channel" selection box for multi-channel sensors like MCP3202, 04, 08, ADS1115.

I have not tried them with 1.6.2 but if you can confirm troubles with these sensors I have all of them in stock to check and fix communication

15 минут назад, WG_Magners сказал:

Ideally, I wanted 24 total analog inputs

Unfortunately this is not possible for non-composite USB device because of Windows limitations. For now you can only get 8 axes (no matter internal adc or external sensor) from one stm32 in freejoy

Edited by WG_Magners
Posted

@WG_Magners

 

Thanks again for the explanation. It sounds like there's no practical reason for me to put any MCP32XX on my board then if the axis limitation in FreeJoy is 8.

 

Out of curiosity, since I now understand the software better, it sounds like it would work successfully with the MCP3208, even though the Pin Config tab only shows 1 analog axis, if I go into the Axes Config tag, set 8 Axes to use the same CS pin for the MCP3208, but set the channels of each axis from 0-7. Is this correct?

Posted
4 часа назад, nflaum сказал:

set 8 Axes to use the same CS pin for the MCP3208, but set the channels of each axis from 0-7. Is this correct?

Yes, this is exactly what you should do for MCP3208

Posted
Quote

...if the axis limitation in FreeJoy is 8.

 

8 Axis is not FreeJoy limitation, is Windows Dimput limitation and affect any other joystick controller.

 

Only with the announced - but not released yet, VKB expansion modules (SEM, THQ...) for Gladiator NXT, this 8 axes limitation will be surpassed, due special features (digital operation) of their USB Controller Njoy32NG, that allow NXT became a "USB HUB" for up do four expansion modules, and so plug all modules using only one USB port in computer.

 

But for games the axes above 8 of this array became new virtual controller, what prevent their use in games that support only one joystick. E.g. FPS games with "floating weapons", like BF series.

  • Upvote 1
  • 2 weeks later...
Posted (edited)

Hi there!


First of all awesome work WG_Magners !!!

I'm setting my first steps into building a DIY HOTAS, have some 3D printing and designing experience but not much where it goes about electronics. I've been following steps from wiki to flash those STM32 boards through ST-Utility and everything went smoothly, except when after soldering pin headers.

Before soldering FreeJoy Configurator was able to read and write config, but after it's just stuck on the Requesting config.. or Writing config.. It still connects and is recognized by Window, though. I was paying attention when soldering, just a few sec of heat, but who knows? Could I have damaged the memory?

 

Reflashing did not help. Tried it on two separate boards with same result.

 

Anybody experienced something like that?

Firmware 1.6.2b3

FreeJoy Configurator: 1.6.2b0

s4.jpeg

Edited by MortDTH
Photo added
Posted
2 часа назад, MortDTH сказал:

Hi there!


First of all awesome work WG_Magners !!!

I'm setting my first steps into building a DIY HOTAS, have some 3D printing and designing experience but not much where it goes about electronics. I've been following steps from wiki to flash those STM32 boards through ST-Utility and everything went smoothly, except when after soldering pin headers.

Before soldering FreeJoy Configurator was able to read and write config, but after it's just stuck on the Requesting config.. or Writing config.. It still connects and is recognized by Window, though. I was paying attention when soldering, just a few sec of heat, but who knows? Could I have damaged the memory?

 

Reflashing did not help. Tried it on two separate boards with same result.

 

Anybody experienced something like that?

Firmware 1.6.2b3

FreeJoy Configurator: 1.6.2b0

Hi,

did you use same USB cable before the issue appeared?

Have you cleaned your board after soldering? It may make sense to load some photo of your soldering results

Posted (edited)

Hmm, weird. Today I got them both working and all I can think of is rebooting my PC and maybe plugging in a Saitek x52, if that could have anything to do with it.
Yes, the cable was the same. How should you clean the board after soldering? IPA? I've added a photo to the original post.

Also, I have another question. Now that I can write to memory, I've set up two buttons in Freejoy Configurator (confirmed it by unplugging and reading back the config). I can see  them turning green in Configurator when I short appropriate pins, but there's no reaction in Windows game controller properties. Is that how it should be? Should all those buttons and axes be visible?

z.jpg

Edited by MortDTH
Posted

Alternatively to (obsolete) Windows Game Controllers use VKB Button Tester, if buttons blink there is OK.

 

 

 

 

Posted (edited)
6 часов назад, MortDTH сказал:

Is that how it should be?

Did you set buttons in logical buttons block?

You will gey all 8 axes and 128 buttons visible while HID dynamic config option is not set.

We have some explanations how to set up buttons in our wiki

Edited by WG_Magners
Posted (edited)

All good now. I assumed that logical buttons are to be set up only when using matrix or shift registers.
I'm getting the hang of it. Just plugged in a mini joystick and it works flawlessly. This is getting exciting! Thanks for help!

 

obraz.png

Edited by MortDTH
  • Like 1
  • Upvote 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...