tloimu/adapt-ffb-joy

Not work on ATmega32u4 on Arduino pro micro Leonardo Board

denisn73 opened this issue · 27 comments

I flash chip with "adaptffbjoy-r54.hex" and it not work! Device not recognized, no device in device manager.
But arduino bootloader work perfectly, this means that the board is working.

How many reset drives are running?

How many reset drives are running?

what is meant?

The device will not be recognized if line 3 to PB5 is not connected correctly. If only the FFB does not work (sometimes) try to invert the X1 line 11 to PB4 - that solved the issue for me. I changed the Hex code accordingly. Adding capacitors did not help, i even removed the one the Joystick mainboard.

The device will not be recognized

Do you mean that if i connect only the board without the joystick it doesn't even show up on windows?

Edit (for future reference): I built the circuit and I can confirm the joystick it's not recognized by windows until the joystick itself is connected.

Its a while ago... If I remember correctly that is the case.

If only the FFB does not work (sometimes) try to invert the X1 line 11 to PB4 - that solved the issue for me

Help me out please. What do you mean by invert? Swap PB4 and 5 ? I seem to have that issue but I am a total noob when it comes to coding.

adaptffbjoy-r54_inverted.zip

Invert means turn a high level to a low level and vice versa. You can either change the Hex-code or use a transistor to do so.
I have added the Hex-Code - good luck!

ah ok, that was the other option :D I'll give it a try right away, thanks!
Do you know where in the code the setting is hidden? I have started to make some other changes in the code that I would like to combine

tried the hex....could you check if that was the right one? It behaves like a sample-hex. its not detected as Lufa JoystickwFFB and gives a periodic push upwards on the stick every second.

That sounds wrong - i will need to search...
Answer: Sorry, no other version on my PC and i even found the batch file for programming - it should work
I suspect your CPU is simply resseting when the stick reacts...

I am running it on the "SideWinder Force-Feedback Pro" and it works well.
The bigger problem is that the most games dont support it - best till now was Seriuos Sam HD. Steam is a pain regarding joysticks.

Here is what i did:

  • Convert Hex file to binary
  • disassemble binary with AVR tools

Then you find two sections where the port B4 is used:

at adress:
590: 9824 - CBI DDRB,4 (Clear bit 4 of port B)
595: 9A24 - SBI DDRB,4 (Means set bit 4 of port B)

and at B6D and B77 accordingly.

I simply exchanged the commands - 98 to 9A and vice versa. If you understand the Intel Hex format you can see that in the file compare...

then convert to Intel Hex again and you should get the uploaded file.

If you find the sources to the 54 version file you could do it directly in the code - but i didn't find that.

I didn't even notice that the Version 54 is different from the Git-sources. I didn't find any Version besides Lufa & 3DP-Vert...where did you find the code version?

One thing I notice is, that your hex is a bit bigger than the non-inverted one.

r54 39.348 Bytes
r54_inverted 40.243 Bytes

Interesting thing: The guys over at decentbb took the code a bit farther it seems, integrating the Shift and more buttons. But they worked with the sources provided.

Hexes & Text here https://dbb.d3k.org/viewtopic.php?f=8&p=386319
Sources here https://github.com/r8dhex/adapt-ffb-joy

The original 54 file is in the download section of this repository: https://github.com/tloimu/adapt-ffb-joy/tree/master/downloads
If i re download and unpack my inverted version it has exactly the same size - the packed version is a little bigger ..
Use 7zip or Winzip for unpacking - the win 10 packer is not 100% compatible.
MD5 checksum: f00608d30d447aa5be53e45d08246afd

As far as i see it In ffb.c it is this section that needs to be changed: (clr <--> set for TRGX1BIT)

//------------------------------------------------------------------------------
// Trigger the stick

#define X1_pull() WRAP( {
clr_bit( TRGDDR, TRGX1BIT ) ;
clr_bit( TRGDDR, TRGY2BIT ) ;
} )
#define X1_rel() WRAP( {
set_bit( TRGDDR, TRGX1BIT ) ;
set_bit( TRGDDR, TRGY2BIT ) ;
} )

I used 7Zip, thanks for the md5, I'll check my file.
Thats where I got the v54 from, I just could not find any Version number in the GIT-Sources, thats why I thought that the v54-File is the result of the sources.

Thanks for the help with finding the line in code. I'll give it a try in the evening.

Edit:
MD5 checksum matches.

Editedit:

#define X1_pull() WRAP( {
set_bit( TRGDDR, TRGX1BIT ) ;
clr_bit( TRGDDR, TRGY2BIT ) ;
} )
#define X1_rel() WRAP ( {
clr_bit( TRGDDR, TRGX1BIT ) ;
set_bit( TRGDDR, TRGY2BIT ) ;

results in a working hex (no pulsing like when I use your hex. But no FF. The stick centers and FF-Tester does not complain, but no force is applied (and spring effect is not removed when starting the app like usually.

I am a bit embarrassed to tell you (but also very happy).

I found the issue with my stick loosing force feedback while playing. Inside the joystick, a pin of the power connector was broken. So usually the stick had power and worked, but the vibrations of the motors made it loose it's power for FF. Replugging usually worked, because it pushed the pin back in place.
I could beat myself with the stick for not even considering that the vibrations might have caused a physical problem. ARGH!

After 30 seconds of soldering the beast is working.

same kind of isssue for me on arduino micro stick is well recognised all axis ok on joystick conf i feel some motor resitance but not effect works with dcs game or force test programe any advice ? i tried the inverted Hex joystick is not reconized at all with this one

How did you manage the "PD0 PB0" connection on the micro pro ??? by default the pin PB0 is not exposed to soldering pad... it's connected to a to TX led via small SMD resistor i unsolder the resitor to make the connection but still not work midi is send but ignored by FFB1 i m not sure of but it look that the X1_pull is used to init the midi protocol before effect sending. this pulse bifore midi protocol may be my issue... i will try to recompile the source code instead of using the hex provided to see if it help to solve pb with Arduino pro micro

Hedda commented

Anyone managed to port/patch latest adapt-ffb-joy to run on standard "Arduino Pro Micro" and/or "Arduino Leonardo" boards?

Related question also posted here -> #43 (and also in #38)

According to the wiki at https://github.com/tloimu/adapt-ffb-joy/wiki there was an old project making it into an Arduino library:

https://code.google.com/archive/p/sidewinder-arduino/

ej113 commented

Yes!

I was going to try changing the pinouts to make it compatible myself but I instead stumbled across this fork by @juchong which swaps PB0 for PB6.

It also has a PCB design, flashing instructions and is forked from the JayBee-git version with the shift button function and no extra axes.
This one worked for me first time yesterday on the Arduino Micro (not Pro Micro) and I would expect it to also work on the Arduino Leonardo (although using the ICSP header pins) and Adafruit Itsy Bitsy 32u4 5V 16MHz variant based on broken out pins. LEDs are still assigned to Teensy pins so don't turn on but this is a minor change if required.

Also the original Teensy 2.0 .hex files using the PB0 pin should work with the Arduino Micro with no modification and with the Pro Micro if you solder to the LED pad.

  • See here for the Arduino Micro. I was not able to get the FFB to work but it was most likely my dodgy breadboard wiring. Note the board RX LED is still connected to the PB0 pin. I wasn't sure if this might affect the function.
  • and here for the Pro Micro #35

I just tried to get the Micro Pro working.
In general is is working.
The joystick is connected and all Axis and Buttons working, but it is initialized with
FFB effects on and center it. The FFBtest program don't work.
Like #20 (comment)
The teensy 2.0 I also have is working without problems.

Sounds similar to #56. Maybe capacitors?
I've just added a troubleshooting guide to the Wiki. Have a look and see if anything there works for you.

I try 1nF upto 10nF in small steps.
Nothing worked.

Report: I have two joysticks #96755 device (no fan) and 96755 device (with fan),
#96755 Device (no fan) Force feedback works on 1NF
#96755 Device (with fan) Force feedback works on 2.2NF

Is this the right schematics for it ? https://github.com/juchong/adapt-ffb-joy/tree/master/pcb

I have Teensy 2.0 and Pro Micro working fine on v0.5.0beta1
I made a picture, you can check it out
pro_micro_pinout

Thanks.
PD0 and PB6 are connected - right (Pin 3 and 10) ?

Thanks. PD0 and PB6 are connected - right (Pin 3 and 10) ?

Yes (PIN3 and PIN10)
https://golem.hu/article/pro-micro-pinout/

Thanks, Then I check all again

I found the problem.
The model of the arduino in my CAD program was wrong and it mixed the wires to the wrong pins.
I made a new PCB and now it is working, but only 20%.
Need to replug many times before it is working.
I try different capacitors the next weeks
Edit1:
Made some test during the weekend.
2,2nF is too small, with 2x 1,5nF = 3,0nF for each pin it is working very good.
Edit2:
3,3nF is working perfectly with the MicroPro-USB-C