Slamy / Yaumataca

USB mouse and joystick to Amiga, Atari ST & C64 Adapter
MIT License
10 stars 2 forks source link

No mouse movement. #1

Open andreacampanella opened 2 weeks ago

andreacampanella commented 2 weeks ago

I spent a week trying to figure out what's going on with this project.

I've got the UART working to get some info, I had to move some of he pins of port 2 to do that.

the only thing I can get it's some quadrature out on GP14 and GP15 when..I press the mouse button?

...what?

What's up with the sense pin?

also, the schematics here:

https://github.com/Slamy/Yaumataca/blob/main/schematic/yaumataca/yaumataca.svg

says gpio14 and 15 are up and down but here:

https://raw.githubusercontent.com/Slamy/Yaumataca/8ccdbdfc71e2675bf3530aba36dd38ebfc55d48c/doc/pinout.svg

are left and right?

what's going on.

Slamy commented 2 weeks ago

Feel free to create an issue after days instead of a week. Let's look.

I first try to answer the first question which I think you have deleted. I don't use an UART for printf debugging. Please never use an UART again for printf debugging. The RP2040 is capable of doing RTT. The vscode Projekt does it automatically. By enabling CONFIG_DEBUG_PRINT you enable the printf output over RTT. Please look into it, it is very useful as it doesn't take up any pins. But you need to have a debugger attached for it, which can just be another Rp Pico.

Next the problem itself. I think you have the Yaumataca in C1351 mode. You may need to press the button to cycle through the modes. What computer do you have? Amiga? Quadrature on mouse click sounds extremly like C1351. Press once again for Amiga. Press again after that for Atari ST. The sense pins are only for C1351 mode and can be left out for Amiga and Atari ST

Slamy commented 2 weeks ago

You are the unlucky first person which has ever created an issue here. But with every issue I can sense the problems this project has and improve it.

andreacampanella commented 2 weeks ago

Yes, I deleted the issue as I figured that one out, but I didn't had a second pico or a debugger, according to the printouts, it's running in Amiga mode, I should have 2 pairs of quandrature output, but on the scope I can only see one output per axis

Slamy commented 2 weeks ago

Alright. You've found an issue. I've looked again at the svg files and it seems that after I've done the PCB, I forgot to update the first svg. The commits are squashed. I had an old version, where the old pinout is still used. At first there was no intent of making a PCB. This is where the first SVG was right. It was intended for manual wiring. The kicad svg is the right one. Are you able to measure signals there? There should be quadrature there

Slamy commented 2 weeks ago

If you see the prints, when moving the mouse there should be a display of the quadrature signals. I would expect that these are also present on the pins. There is not much between the outer pads and those prints. I've also now created a branch called develop which has the svg updated. I hope I can somehow help you.

andreacampanella commented 2 weeks ago

Here is a log of what's happening, when I move the mouse in both axis, only the first 2 bytes moves: mouse.txt

Slamy commented 2 weeks ago

Oh no. I have a theory. This here catches my mind.

HID device address = 1, instance = 1 is mounted
VID = 046d, PID = c52b
HID has 4 reports 2 2 1
Primary mouse

It says 4 reports... The report mode might be to blame. I have an idea to check...

I've added a branch for you: https://github.com/Slamy/Yaumataca/compare/develop?expand=1

This does two things. It ditches the "report mode" in favor of the default boot compatibility mode. Wheels no longer work with this. But it behaves like a standard PS/2 mouse. Please try if this fixes the problem. I assume this is related because no HID report descriptors are parsed yet with this project. And maybe your mouse is a super special gamer mouse with multiple buttons and maybe multiple wheels.

andreacampanella commented 2 weeks ago

it's a logitech mouse modle M310 with a unify receiver, I will try it

andreacampanella commented 2 weeks ago

I'm building the branch and I get : [ 98%] Building C object CMakeFiles/yaumataca.dir/pico-sdk/src/rp2_common/hardware_pio/pio.c.obj /home/andrea/Yaumataca/src/handlers/hid_mouse.cpp: In member function 'virtual void MouseReportHandler::process_report(std::span)': /home/andrea/Yaumataca/src/handlers/hid_mouse.cpp:26:22: error: unused variable 'i' [-Werror=unused-variable] 26 | for (uint8_t i : report) { | ^ compilation terminated due to -Wfatal-errors. cc1plus: all warnings being treated as errors

Slamy commented 2 weeks ago

Ah this is because you are building without CONFIG_DEBUG_PRINT. PRINTF is masked out. This print is rather helpful. It prints the full report for protocol analysis :-)

Slamy commented 2 weeks ago

I've just experimented with a rapoo receiver. I'm having the same issues as you. But the workaround should fix your issues.

andreacampanella commented 2 weeks ago

Yes, this is better:

Yaumataca says hello! JoystickMouseSwitcher + JoystickMouseSwitcher + Found configuration byte 0x0 at offset 0x1 Pipeline + GPIOs set for joystick mode on left port GPIOs set for joystick mode on right port PortSwitcher + 200050C0 PortSwitcher + 200050F0 MouseModeSwitcher + MouseModeSwitcher + GamepadAutoFire + GamepadAutoFire + Set mouse mode 0 QuadratureMouse + AmigaMouse + Set mouse mode 0 QuadratureMouse + AmigaMouse + C1351 calibration data not saved before... C1351 calibration -1675 -1417 -1452 -1221 C1351 calibration -1675 -1417 -1452 -1221 R 0000 000 L 0000 000 HID device address = 1, instance = 0 is mounted VID = 046d, PID = c52b HID has 1 reports 0 6 1 HID device address = 1, instance = 1 is mounted VID = 046d, PID = c52b HID has 4 reports 2 2 1 Primary mouse HID device address = 1, instance = 2 is mounted VID = 046d, PID = c52b HID has 3 reports 16 1 65280 Device attached, address = 1 HID device address = 1 is mounted VID = 046d, PID = c52b Mouse: 00 f9 01 00 Switched to mouse GPIOs set for joystick mode on right port GPIOs set for joystick mode on left port R 0101 000 R 0111 000 Mouse: 00 f2 01 00 R 1110 000 R 1100 000 R 1101 000 Mouse: 00 f9 00 00 R 1111 000 R 1110 000 R 1100 000 R 1101 000 R 1111 000 R 1110 000 Mouse: 00 f3 01 00 R 1000 000 R 1001 000 R 1011 000 R 1010 000 R 1000 000 R 1001 000 Mouse: 00 f6 02 00 R 0011 000 R 0110 000 R 0100 000 R 0101 000 R 0111 000 R 0110 000 Mouse: 00 f2 02 00 R 1100 000 R 1001 000 R 1011 000 R 1010 000 R 1000 000 R 1001 000 Mouse: 00 f6 02 00 R 0011 000 R 0110 000 R 0100 000 R 0101 000 R 0111 000 R 0110 000 Mouse: 00 f3 02 00 R 1100 000 R 1001 000 R 1011 000 R 1010 000 R 1000 000 R 1001 000 Mouse: 00 f6 02 00 R 0011 000 R 0110 000 R 0100 000 R 0101 000 R 0111 000 R 0110 000 Mouse: 00 f8 03 00 R 1100 000 R 1001 000 R 0011 000 R 0010 000 Mouse: 00 f9 02 00 R 0100 000 R 1101 000 R 1111 000 R 1110 000 R 1100 000 R 1101 000 Mouse: 00 f9 03 00 R 1011 000 R 0010 000 R 0100 000 R 0101 000 R 0111 000 R 0110 000 Mouse: 00 fa 02 00 R 1100 000 R 1001 000 R 1011 000 R 1010 000 R 1000 000 R 1001 000 Mouse: 00 fd 01 00 R 0011 000 R 0010 000 R 0000 000 R 0001 000 R 0011 000 R 0010 000 Mouse: 00 fd 03 00 R 0100 000 R 1101 000 R 1011 000 R 1010 000 R 1000 000 R 1001 000 Mouse: 00 fe 02 00 R 0011 000 R 0110 000 R 0100 000 R 0101 000 R 0111 000 R 0110 000 Mouse: 00 ff 01 00 R 1100 000 R 1101 000 R 1111 000 R 1110 000 R 1100 000 R 1101 000 Mouse: 00 ff 02 00 R 1011 000 R 0010 000 R 0000 000 R 0001 000 R 0011 000 R 0010 000 Mouse: 00 fe 02 00 R 0100 000 R 1101 000 R 1111 000 R 1110 000 R 1100 000 R 1101 000 Mouse: 00 ff 02 00 R 1011 000 R 0010 000 R 0000 000 R 0001 000 Mouse: 00 ff 03 00 R 0111 000 R 1110 000 R 1000 000 R 1001 000 R 1011 000 R 1010 000 Mouse: 00 ff 04 00 R 0000 000 R 0101 000 R 1111 000 R 1010 000 R 1000 000 R 1001 000 Mouse: 00 fe 04 00 R 0011 000 R 0110 000 R 1100 000 R 1001 000 R 1011 000 R 1010 000 Mouse: 00 fd 05 00 R 0000 000 R 0101 000 R 1111 000 R 1010 000 R 0000 000 R 0001 000 Mouse: 00 fe 05 00 R 0111 000 R 1110 000 R 1000 000 R 0001 000 R 0111 000 R 0110 000 Mouse: 00 fd 06 00 R 1100 000 R 1001 000 R 0011 000 R 0110 000 R 1100 000 R 1001 000 Mouse: 00 ff 04 00 R 0011 000 R 0110 000 R 1100 000 R 1001 000 R 1011 000 R 1010 000 Mouse: 00 fe 06 00 R 0000 000 R 0101 000 R 1111 000 R 1011 000 R 0011 000 R 0111 000 Mouse: 00 fe 08 00 R 1110 000 R 1000 000 R 0000 000 R 0100 000 R 1100 000 R 1000 000 Mouse: 00 00 07 00 R 0000 000 R 0100 000 R 1100 000 R 1000 000 Mouse: 00 ff 06 00 R 0001 000 R 0101 000 R 1101 000 R 1001 000 R 0001 000 R 0101 000 Mouse: 00 00 05 00 R 1101 000 R 1001 000 R 0001 000 R 0101 000 R 1101 000 R 1001 000 Mouse: 00 00 07 00 R 0001 000 R 0101 000 R 1101 000 R 1001 000 R 0001 000 R 0101 000 Mouse: 00 00 07 00 R 1101 000 R 1001 000 R 0001 000 R 0101 000 R 1101 000 R 1001 000 Mouse: 00 00 06 00 R 0001 000 R 0101 000 R 1101 000 R 1001 000 R 0001 000 R 0101 000 Mouse: 00 00 05 00 R 1101 000 R 1001 000 R 0001 000 R 0101 000 R 1101 000 R 1001 000 Mouse: 00 00 06 00 R 0001 000 R 0101 000 R 1101 000 R 1001 000 R 0001 000 R 0101 000 Mouse: 00 00 06 00 R 1101 000 R 1001 000 R 0001 000 R 0101 000 R 1101 000 R 1001 000 Mouse: 00 02 04 00 R 0000 000 R 0110 000 R 1110 000 R 1010 000 R 0010 000 R 0110 000 Mouse: 00 02 06 00 R 1111 000 R 1001 000 R 0001 000 R 0101 000 Mouse: 00 01 04 00 R 1100 000 R 1000 000 R 0000 000 R 0100 000 R 1100 000 R 1000 000 Mouse: 00 03 06 00 R 0010 000 R 0111 000 R 1101 000 R 1001 000 R 0001 000 R 0101 000 Mouse: 00 03 05 00 R 1100 000 R 1010 000 R 0011 000 R 0111 000 R 1111 000 R 1011 000 R 0011 000 R 0111 000 Mouse: 00 03 05 00 R 1101 000 R 1000 000 R 0010 000 R 0110 000 Mouse: 00 02 03 00 R 1111 000 R 1001 000 R 0001 000 R 0101 000 Mouse: 00 05 04 00 R 1100 000 R 1010 000 R 0011 000 R 0101 000 R 0100 000 Mouse: 00 04 02 00 R 1110 000 R 1011 000 R 1001 000 R 1000 000 Mouse: 00 03 02 00 R 0010 000 R 0111 000 R 0101 000 Mouse: 00 02 01 00 R 1100 000 R 1110 000 Mouse: 00 03 01 00 R 1011 000 R 1001 000 R 1000 000 Mouse: 00 03 00 00 R 1010 000 R 1011 000 R 1001 000 Mouse: 00 02 01 00 R 0000 000 R 0010 000 Mouse: 00 02 00 00 R 0011 000 R 0001 000 Mouse: 00 04 01 00 R 0100 000 R 0110 000 R 0111 000 R 0101 000 Mouse: 00 03 00 00 R 0100 000 R 0110 000 R 0111 000 Mouse: 00 05 00 00 R 0101 000 R 0100 000 R 0110 000 R 0111 000 R 0101 000 Mouse: 00 06 00 00 R 0100 000 R 0110 000 R 0111 000 R 0101 000 R 0100 000 R 0110 000 Mouse: 00 07 ff 00 R 0011 000 R 0001 000 R 0000 000 R 0010 000 R 0011 000 R 0001 000 R 0000 000 Mouse: 00 06 ff 00 R 1010 000 R 1011 000 R 1001 000 R 1000 000 R 1010 000 R 1011 000 Mouse: 00 07 ff 00 R 1101 000 R 1100 000 R 1110 000 R 1111 000 R 1101 000 R 1100 000 Mouse: 00 07 fd 00 R 0110 000 R 0011 000 R 1001 000 R 1000 000 R 1010 000 R 1011 000 Mouse: 00 05 fe 00 R 1101 000 R 0100 000 R 0110 000 R 0111 000 R 0101 000 R 0100 000 Mouse: 00 08 fe 00 R 0010 000 R 1011 000 R 1001 000 R 1000 000 R 1010 000 R 1011 000 Mouse: 00 06 fd 00 R 1101 000 R 0100 000 R 0010 000 R 0011 000 R 0001 000 R 0000 000 Mouse: 00 06 fe 00 R 1010 000 R 1111 000 R 1101 000 R 1100 000 R 1110 000 R 1111 000 Mouse: 00 06 fd 00 R 0101 000 R 0000 000 R 1010 000 R 1011 000 R 1001 000 R 1000 000 Mouse: 00 05 fe 00 R 1110 000 R 0111 000 R 0101 000 R 0100 000 R 0110 000 R 0111 000 Mouse: 00 05 fe 00 R 0001 000 R 1000 000 R 1010 000 R 1011 000 R 1001 000 R 1000 000 Mouse: 00 04 fe 00 R 1110 000 R 0111 000 R 0101 000 R 0100 000 R 0110 000 Mouse: 00 04 fd 00 R 0011 000 R 1001 000 R 1100 000 R 1110 000 Mouse: 00 02 fe 00 R 0111 000 R 0001 000 Mouse: 00 03 fc 00 R 1000 000 R 1110 000 R 0111 000 R 0011 000 Mouse: 00 03 fc 00 R 1001 000 R 1100 000 R 0110 000 R 0010 000 Mouse: 00 02 fc 00 R 1011 000 R 1101 000 R 0101 000 R 0001 000 Mouse: 00 01 fa 00 R 1000 000 R 1100 000 R 0100 000 R 0000 000 R 1000 000 R 1100 000 Mouse: 00 01 fd 00 R 0110 000 R 0010 000 R 1010 000 Mouse: 00 02 fb 00 R 1111 000 R 0101 000 R 0001 000 R 1001 000 R 1101 000 Mouse: 00 01 fb 00 R 0100 000 R 0000 000 R 1000 000 R 1100 000 R 0100 000 Mouse: 00 00 fc 00 R 0000 000 R 1000 000 R 1100 000 R 0100 000 Mouse: 00 01 fd 00 R 0010 000 R 1010 000 R 1110 000 Mouse: 00 00 fd 00 R 0110 000 R 0010 000 R 1010 000 Mouse: 00 00 fd 00 R 1110 000 R 0110 000 R 0010 000 Mouse: 00 00 fc 00 R 1010 000 R 1110 000 R 0110 000 R 0010 000 Mouse: 00 ff fd 00 R 1000 000 R 1100 000 R 0100 000 Mouse: 00 ff fd 00 R 0001 000 R 1001 000 R 1101 000 Mouse: 00 ff fa 00 R 0111 000 R 0011 000 R 1011 000 R 1111 000 R 0111 000 R 0011 000 Mouse: 00 fe fb 00 R 1010 000 R 1100 000 R 0100 000 R 0000 000 R 1000 000 Mouse: 00 fe fc 00 R 1101 000 R 0111 000 R 0011 000 R 1011 000 Mouse: 00 fd fb 00 R 1110 000 R 0100 000 R 0001 000 R 1001 000 R 1101 000 Mouse: 00 fe fa 00 R 0111 000 R 0010 000 R 1010 000 R 1110 000 R 0110 000 R 0010 000 Mouse: 00 fd fb 00 R 1000 000 R 1101 000 R 0111 000 R 0011 000 R 1011 000 Mouse: 00 fb f8 00 R 1110 000 R 0100 000 R 0001 000 R 1011 000 R 1110 000 R 0110 000 R 0010 000 R 1010 000 Mouse: 00 fc fc 00 R 1100 000 R 0101 000 R 0011 000 R 1010 000 Mouse: 00 fd fc 00 R 1100 000 R 0101 000 R 0011 000 R 1011 000 Mouse: 00 fc fc 00 R 1110 000 R 0100 000 R 0001 000 R 1011 000 Mouse: 00 fb fc 00 R 1110 000 R 0100 000 R 0001 000 R 1011 000 R 1010 000 Mouse: 00 fc fe 00 R 1100 000 R 0101 000 R 0111 000 R 0110 000 Mouse: 00 fb fd 00 R 0000 000 R 1001 000 R 1111 000 R 1110 000 R 1100 000 Mouse: 00 fc fd 00 R 0101 000 R 0011 000 R 1010 000 R 1000 000 Mouse: 00 fb fe 00 R 1101 000 R 0111 000 R 0110 000 R 0100 000 R 0101 000 Mouse: 00 fb fe 00 R 0011 000 R 1010 000 R 1000 000 R 1001 000 R 1011 000 Mouse: 00 fc fd 00 R 1110 000 R 0100 000 R 0001 000 R 0011 000 Mouse: 00 fb fe 00 R 1010 000 R 1100 000 R 1101 000 R 1111 000 R 1110 000 Mouse: 00 fd ff 00 R 0100 000 R 0101 000 R 0111 000 Mouse: 00 fc ff 00 R 0010 000 R 0000 000 R 0001 000 R 0011 000 Mouse: 00 fb fe 00 R 1010 000 R 1100 000 R 1101 000 R 1111 000 R 1110 000 Mouse: 00 fb ff 00 R 0100 000 R 0101 000 R 0111 000 R 0110 000 R 0100 000 Mouse: 00 fd 00 00 R 0101 000 R 0111 000 R 0110 000 Mouse: 00 f9 ff 00 R 0000 000 R 0001 000 R 0011 000 R 0010 000 R 0000 000 R 0001 000 R 0011 000 Mouse: 00 fd 00 00 R 0010 000 R 0000 000 R 0001 000 Mouse: 00 f8 00 00 R 0011 000 R 0010 000 R 0000 000 R 0001 000 R 0011 000 R 0010 000 R 0000 000 R 0001 000 Mouse: 00 fb 00 00 R 0011 000 R 0010 000 R 0000 000 R 0001 000 R 0011 000 Mouse: 00 f9 01 00 R 0110 000 R 0100 000 R 0101 000 R 0111 000 R 0110 000 R 0100 000 R 0101 000 Mouse: 00 fe 01 00 R 1111 000 R 1110 000 Mouse: 00 f8 02 00 R 1000 000 R 0001 000 R 0011 000 R 0010 000 R 0000 000 R 0001 000 R 0011 000 R 0010 000 Mouse: 00 f8 01 00 R 0100 000 R 0101 000 R 0111 000 R 0110 000 R 0100 000 R 0101 000 R 0111 000 Mouse: 00 fa 03 00 R 1110 000 R 1000 000 R 0001 000 R 0011 000 R 0010 000 R 0000 000 Mouse: 00 f9 03 00 R 0101 000 R 1111 000 R 1010 000 R 1000 000 R 1001 000 R 1011 000 Mouse: 00 fb 02 00 R 0010 000 R 0100 000 R 0101 000 R 0111 000 R 0110 000 R 0100 000 Mouse: 00 fb 02 00 R 1101 000 R 1011 000 R 1010 000 R 1000 000 Mouse: 00 f9 03 00 R 0001 000 R 0111 000 R 1110 000 R 1100 000 R 1101 000 R 1111 000 Mouse: 00 fa 04 00 R 1010 000 R 0000 000 R 0101 000 R 1111 000 R 1110 000 R 1100 000 R 1101 000 R 1111 000 Mouse: 00 fe 02 00 R 1010 000 R 0000 000 R 0001 000 Mouse: 00 fb 02 00 R 0111 000 R 1110 000 R 1100 000 R 1101 000 R 1111 000 Mouse: 00 fc 03 00 R 1010 000 R 0000 000 R 0101 000 R 0111 000 Mouse: 00 fd 03 00 R 1110 000 R 1000 000 R 0001 000 Mouse: 00 fe 02 00 R 0111 000 R 1110 000 Mouse: 00 fe 02 00 R 1000 000 R 0001 000 Mouse: 00 ff 02 00 R 0111 000 R 1111 000 Mouse: 00 ff 02 00 R 1010 000 R 0010 000 Mouse: 00 fe 03 00 R 0100 000 R 1101 000 R 1001 000 Mouse: 00 ff 03 00 R 0011 000 R 0111 000 R 1111 000 Mouse: 00 ff 04 00 R 1010 000 R 0010 000 R 0110 000 R 1110 000 Mouse: 00 ff 03 00 R 1000 000 R 0000 000 R 0100 000 Mouse: 00 00 05 00 R 1100 000 R 1000 000 R 0000 000 R 0100 000 R 1100 000 Mouse: 00 ff 07 00 R 1001 000 R 0001 000 R 0101 000 R 1101 000 R 1001 000 R 0001 000 R 0101 000 Mouse: 00 ff 06 00 R 1111 000 R 1011 000 R 0011 000 R 0111 000 R 1111 000 R 1011 000 Mouse: 00 00 04 00 R 0011 000 R 0111 000 R 1111 000 R 1011 000 Mouse: 00 00 06 00 R 0011 000 R 0111 000 R 1111 000 R 1011 000 R 0011 000 R 0111 000 Mouse: 00 00 04 00 R 1111 000 R 1011 000 R 0011 000 R 0111 000 Mouse: 00 00 06 00 R 1111 000 R 1011 000 R 0011 000 R 0111 000 R 1111 000 R 1011 000 Mouse: 00 00 05 00 R 0011 000 R 0111 000 R 1111 000 R 1011 000 R 0011 000 Mouse: 00 00 05 00 R 0111 000 R 1111 000 R 1011 000 R 0011 000 R 0111 000 Mouse: 00 00 04 00 R 1111 000 R 1011 000 R 0011 000 R 0111 000 Mouse: 00 00 04 00 R 1111 000 R 1011 000 R 0011 000 R 0111 000 Mouse: 00 01 04 00 R 1101 000 R 1001 000 R 0001 000 R 0101 000 Mouse: 00 02 06 00 R 1100 000 R 1010 000 R 0010 000 R 0110 000 R 1110 000 R 1010 000 Mouse: 00 02 05 00 R 0011 000 R 0101 000 R 1101 000 R 1001 000 R 0001 000 Mouse: 00 02 05 00 R 0100 000 R 1110 000 R 1010 000 R 0010 000 R 0110 000 Mouse: 00 03 05 00 R 1111 000 R 1001 000 R 0000 000 R 0100 000 R 1100 000 Mouse: 00 04 06 00 R 1010 000 R 0011 000 R 0101 000 R 1100 000 R 1000 000 R 0000 000 Mouse: 00 01 03 00 R 0110 000 R 1110 000 R 1010 000 Mouse: 00 04 05 00 R 0011 000 R 0101 000 R 1100 000 R 1010 000 R 0010 000 Mouse: 00 06 07 00 R 0111 000 R 1101 000 R 1000 000 R 0010 000 R 0111 000 R 1101 000 R 1001 000 Mouse: 00 03 04 00 R 0000 000 R 0110 000 R 1111 000 R 1011 000 Mouse: 00 05 06 00 R 0001 000 R 0100 000 R 1110 000 R 1011 000 R 0001 000 R 0101 000 Mouse: 00 05 06 00 R 1100 000 R 1010 000 R 0011 000 R 0101 000 R 1100 000 R 1000 000 Mouse: 00 04 05 00 R 0010 000 R 0111 000 R 1101 000 R 1000 000 R 0000 000 Mouse: 00 07 07 00 R 0110 000 R 1111 000 R 1001 000 R 0000 000 R 0110 000 R 1111 000 R 1001 000 Mouse: 00 07 07 00 R 0000 000 R 0110 000 R 1111 000 R 1001 000 R 0000 000 R 0110 000 Mouse: 00 05 05 00 R 1111 000 R 1001 000 R 0000 000 R 0110 000 R 1111 000 R 1001 000 Mouse: 00 05 04 00 R 0000 000 R 0110 000 R 1111 000 R 1001 000 R 1000 000 Mouse: 00 03 02 00 R 0010 000 R 0111 000 R 0101 000 Mouse: 00 03 03 00 R 1100 000 R 1010 000 R 0011 000 Mouse: 00 03 03 00 R 0101 000 R 1100 000 R 1010 000 Mouse: 00 04 02 00 R 0011 000 R 0101 000 R 0100 000 R 0110 000 Mouse: 00 04 03 00 R 1111 000 R 1001 000 R 0000 000 R 0010 000 Mouse: 00 05 02 00 R 0111 000 R 1101 000 R 1100 000 R 1110 000 R 1111 000 Mouse: 00 07 04 00 R 1001 000 R 0000 000 R 0110 000 R 1111 000 R 1101 000 R 1100 000 R 1110 000 Mouse: 00 05 04 00 R 1011 000 R 0001 000 R 0100 000 R 1110 000 R 1111 000 Mouse: 00 06 04 00 R 1001 000 R 0000 000 R 0110 000 R 1111 000 R 1101 000 R 1100 000 Mouse: 00 0a 07 00 R 1010 000 R 0011 000 R 0101 000 R 1100 000 R 1010 000 R 0011 000 R 0101 000 Mouse: 00 07 04 00 R 1100 000 R 1010 000 R 0011 000 R 0101 000 R 0100 000 R 0110 000 Mouse: 00 05 03 00 R 1111 000 R 1001 000 R 0000 000 R 0010 000 R 0011 000 R 0001 000 Mouse: 00 06 02 00 R 0100 000 R 1110 000 R 1111 000 R 1101 000 R 1100 000 R 1110 000 Mouse: 00 04 02 00 R 1011 000 R 0001 000 R 0000 000 R 0010 000 R 0011 000 R 0001 000 Mouse: 00 07 02 00 R 0100 000 R 1110 000 R 1111 000 R 1101 000 R 1100 000 R 1110 000 Mouse: 00 06 02 00 R 1011 000 R 0001 000 R 0000 000 R 0010 000 R 0011 000 R 0001 000 Mouse: 00 03 01 00 R 0100 000 R 0110 000 R 0111 000 R 0101 000 R 0100 000 Mouse: 00 05 02 00 R 1110 000 R 1011 000 R 1001 000 R 1000 000 R 1010 000 Mouse: 00 04 02 00 R 0011 000 R 0101 000 R 0100 000 R 0110 000 Mouse: 00 08 03 00 R 1111 000 R 1001 000 R 0000 000 R 0010 000 R 0011 000 R 0001 000 R 0000 000 R 0010 000 Mouse: 00 04 01 00 R 0111 000 R 0101 000 R 0100 000 R 0110 000 Mouse: 00 05 02 00 R 1111 000 R 1001 000 R 1000 000 R 1010 000 R 1011 000 Mouse: 00 08 02 00 R 0001 000 R 0100 000 R 0110 000 R 0111 000 R 0101 000 R 0100 000 R 0110 000 R 0111 000 Mouse: 00 04 00 00 R 0101 000 R 0100 000 R 0110 000 R 0111 000 Mouse: 00 05 00 00 R 0101 000 R 0100 000 R 0110 000 R 0111 000 R 0101 000 Mouse: 00 05 00 00 R 0100 000 R 0110 000 R 0111 000 R 0101 000 R 0100 000 Mouse: 00 05 00 00 R 0110 000 R 0111 000 R 0101 000 R 0100 000 R 0110 000 Mouse: 00 06 00 00 R 0111 000 R 0101 000 R 0100 000 R 0110 000 R 0111 000 R 0101 000 Mouse: 00 04 00 00 R 0100 000 R 0110 000 R 0111 000 R 0101 000 Mouse: 00 05 ff 00 R 0000 000 R 0010 000 R 0011 000 R 0001 000 R 0000 000 Mouse: 00 07 00 00 R 0010 000 R 0011 000 R 0001 000 R 0000 000 R 0010 000 R 0011 000 R 0001 000 Mouse: 00 05 ff 00 R 1000 000 R 1010 000 R 1011 000 R 1001 000 R 1000 000 Mouse: 00 04 00 00 R 1010 000 R 1011 000 R 1001 000 R 1000 000 Mouse: 00 06 ff 00 R 1110 000 R 1111 000 R 1101 000 R 1100 000 R 1110 000 R 1111 000 Mouse: 00 05 ff 00 R 0101 000 R 0100 000 R 0110 000 R 0111 000 R 0101 000 Mouse: 00 04 fe 00 R 0000 000 R 1010 000 R 1011 000 R 1001 000 Mouse: 00 05 ff 00 R 1100 000 R 1110 000 R 1111 000 R 1101 000 R 1100 000 Mouse: 00 03 ff 00 R 0110 000 R 0111 000 R 0101 000 Mouse: 00 04 ff 00 R 0000 000 R 0010 000 R 0011 000 R 0001 000 Mouse: 00 05 fd 00 R 1000 000 R 1110 000 R 0111 000 R 0101 000 R 0100 000 Mouse: 00 03 ff 00 R 0010 000 R 0011 000 R 0001 000 Mouse: 00 06 fd 00 R 1000 000 R 1110 000 R 0111 000 R 0101 000 R 0100 000 R 0110 000 Mouse: 00 04 fd 00 R 0011 000 R 1001 000 R 1100 000 R 1110 000 Mouse: 00 05 fe 00 R 0111 000 R 0001 000 R 0000 000 R 0010 000 R 0011 000 Mouse: 00 04 fd 00 R 1001 000 R 1100 000 R 0110 000 R 0111 000 Mouse: 00 05 fd 00 R 0001 000 R 1000 000 R 1110 000 R 1111 000 R 1101 000 Mouse: 00 05 ff 00 R 0100 000 R 0110 000 R 0111 000 R 0101 000 R 0100 000 Mouse: 00 05 fe 00 R 0010 000 R 1011 000 R 1001 000 R 1000 000 R 1010 000 Mouse: 00 04 ff 00 R 1111 000 R 1101 000 R 1100 000 R 1110 000 Mouse: 00 07 ff 00 R 0111 000 R 0101 000 R 0100 000 R 0110 000 R 0111 000 R 0101 000 R 0100 000 Mouse: 00 06 00 00 R 0110 000 R 0111 000 R 0101 000 R 0100 000 R 0110 000 R 0111 000 Mouse: 00 07 ff 00 R 0001 000 R 0000 000 R 0010 000 R 0011 000 R 0001 000 R 0000 000 R 0010 000 Mouse: 00 05 ff 00 R 1011 000 R 1001 000 R 1000 000 R 1010 000 R 1011 000 Mouse: 00 03 00 00 R 1001 000 R 1000 000 R 1010 000 Mouse: 00 07 ff 00 R 1111 000 R 1101 000 R 1100 000 R 1110 000 R 1111 000 R 1101 000 R 1100 000 Mouse: 00 03 00 00 R 1110 000 R 1111 000 R 1101 000 Mouse: 00 04 ff 00 R 0100 000 R 0110 000 R 0111 000 R 0101 000 Mouse: 00 03 ff 00 R 0000 000 R 0010 000 R 0011 000 Mouse: 00 02 ff 00 R 1001 000 R 1000 000 Mouse: 00 02 ff 00 R 1110 000 R 1111 000 Mouse: 00 01 ff 00 R 0101 000 Mouse: 00 01 00 00 R 0100 000 Mouse: 00 01 ff 00 R 0010 000 Mouse: 00 01 ff 00 R 1011 000 Mouse: 00 00 ff 00 R 1111 000 Mouse: 00 01 00 00 R 1101 000 Mouse: 00 00 ff 00 R 0101 000 Mouse: 00 01 ff 00 R 0000 000 Mouse: 00 00 ff 00 R 1000 000 Mouse: 00 01 ff 00 R 1110 000 Mouse: 00 01 ff 00 R 0111 000 Mouse: 00 01 ff 00 R 0001 000 Mouse: 00 00 ff 00 R 1001 000 Mouse: 00 01 ff 00 R 1100 000

Slamy commented 2 weeks ago

Thank you for finding this. I'll recommend to remove the prints now as it will disrupt the usability because lag is generated. Afterwards please use the device with this change for now so you can actually use it with your beloved machine. We will leave this Issue open until a fix exists. Right now I have another big project to tackle and I can't concentrate on multiple things in my free time.

andreacampanella commented 2 weeks ago

ok, I tested it on my amiga but the mouse it's not moving, the mouse goes up and down but not left and right, it's this related to the debug?

Slamy commented 2 weeks ago

Maybe this is still related to the pinout misunderstanding from the SVG.

        gpio_put(7, state.fire2); // Also used as Pot X
        gpio_put(9, state.fire1);
        gpio_put(15, state.up);
        gpio_put(11, state.fire3); // Also used as Pot Y
        gpio_put(14, state.down);
        gpio_put(12, state.left);
        gpio_put(10, state.right);

The SVG was wrong at some point. Those are the right numbers. According to the prints I see from you, those are exactly the values at the output of the Pico. Quadrature Encoding is indeed performed so it has to work. When up and down is fluent, this means that this is no longer related to Atari ST or C64 mode.... I hope you still have the report workaround inside.

andreacampanella commented 2 weeks ago

PXL_20240915_120636369 How is this looking?

Slamy commented 2 weeks ago

Ah you have a scope. That is very good. I mean, yes I see the signals. And if there is quadrature on the pins, there should be something occurring on the Amiga as long as you've soldered the right pins to the controller port. You can even now check the signals in the Amiga. It is no longer a software issue we are facing here. The quadrature on up down is the same as the one left right. Just different pins.

andreacampanella commented 1 week ago

Ok, after some rewiring seems to be alright.

I do now have some problems with the left buttons.

The amiga seems to see the left button always pressed, like it's stuck, if I press it, it unstuck and it depressed until I pressed again, basically, it's sticky.

the middle button it's always high.

the right button doesn't work

Slamy commented 1 week ago

Always pressed? This seems wrong.... Just in case. Do you have directly wired the Pico Pins to the Amiga? If yes, this is not the intended way as the Amiga is 5V while the Pico is officially not 5V tolerant. There are NPN transistors used as level shifters. This also means of course that the output of the Pico is inverted. A high signal on the Pico causes the transistor to pull down the signal on the Amiga which has an internal pull up.

andreacampanella commented 1 week ago

No, of course not, I'm using two 8bit level translators (the one readily available on AliExpress and company) the rest of the mouse works well, but maybe it's inverted from the way it works with the transistors ?

Slamy commented 1 week ago

Yes, in this case you've build it differently than originally intended. I think you may just need to change the code in controller_port.hpp. Every gpio_put has to be inverted.

Slamy commented 1 week ago

I haven't tested this setup yet. Usually it is not expected to actually drive an Amiga controller port up. It has internal pull ups and pushing it down is sufficient for everything.... except the C64... or the Paddle inputs....

andreacampanella commented 1 week ago

Cool, thank you very much for the project and the support :)