Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HIDman-mini issues when interfacing with an Atari Eiffel adapter #4

Open
klyde2278 opened this issue Nov 2, 2024 · 8 comments
Open

Comments

@klyde2278
Copy link

klyde2278 commented Nov 2, 2024

Hi Serisman,

I am a French retro computer enthusiast, especially when it comes to the 8-bit and 16-bit Atari computers, my favorites.
I have basic skills in electronics, I am just a hobbyist, and a couple of years ago I have developed a PS/2 to Atari Mega ST keyboard and mouse adapter, based on Didier Mequignon’s Eiffel adapter:
https://storage.atari-source.org/atari/mirrors/didier.mequignon.free.fr/eiffel-e.htm

This adapter translates PS/2 keyboard scan codes, and mouse and joystick signals to Atari ST scan codes, using a PIC16F876 micro-controller. It works like a charm.

I recently came across your HIDman-mini project, and my idea was to add a USB support to the Eiffel adapter, doing something like this:

Image1

So, I managed to draw a schematic and I had the PCB made at JLCPCB with a mounted CH559:

Simplified schematics with CH559 to PIC16F876 interface. (Atari output and joystick support not shown):
CH559 + Eiffel schematics

The PIC16F876 needs the following inputs :

PIC16F876 SIGNAL
P21 KEYB DATA
P22 KEYB CLK
P23 MOUSE DATA
P24 MOUSE CLK

I have downloaded your HIDman-mini_v1.1.3.bin firmware on your GitHub and was able to successfully flash the CH559 but it does seem to work marginally.

I used a Microsoft Comfort Curve Keyboard on USB1 and a Microsoft Wheel Optical Mouse on USB2 for testing.
The keyboard lights (Num Lock, Caps Lock) don’t light up and the mouse doesn’t work at all on the Atari (The optical sensor lights up). I was not able to test the keyboard further on the Atari, since I had no working mouse, so I am not sure the keyboard 100% works.

I checked continuities and power voltage between the CH559 and the PIC16F876, and they are all ok.

Here are the parameters I used for CH559 flashing. Is it ok?
Capture

I checked with a scope.
Here is what I have on CH559 P35 – KEYB CLK:
P35 - KB CLK

And for P37 - KEYB DATA, when I press the “a” key, I get this:
P37 - KB DATA - Letter A

I don’t know if it is the correct PS/2 scan code for “a” (1C F0 1C) but I noticed that every key gives a different pattern, and pressing the same key always gives the same pattern.
I also noticed that the signal is HIGH by default but sometimes goes LOW and remains LOW (when I press “z” or “t” I think), until the next keypress.

But this is what I have for P13 – MS CLK it is stuck HIGH (or floats) at 2.5V, even when I move the mouse, no change.
P13 - MS CLK

And this is P14 – MS DATA, it looks like a clock signal with a weird shape?
P14 - MS DATA

Here is a zoomed version, the signal goes down twice very briefly every 5ms.
P14 - MS DATA zoomed

I also have noticed this clock signal on P25 & P26 (LEDs, I don’t use them).
P25
P25

P26
P26

What do you think? What did I do wrong? Do I need to build a specific firmware?

I thank you for developing the HIDman-mini / micro projects!

Emmanuel

@serisman
Copy link
Owner

serisman commented Nov 2, 2024

Emmanual,

This repository is really just for hosting the alternate hardware versions (HIDman-mini and HIDman-micro) that I came up with. The original design and the firmware itself are supported by rasteri's upstream HIDman repo: https://github.com/rasteri/HIDman You'd probably be better supported by asking firmware questions on that repo. The firmware attached to this repo is really just a pre-compiled version of what is available on rasteri's repo with a few of the required make flags set.

For what it's worth, the HIDman-mini is pretty much fully compatible with the original AXP hardware (and firmware) with the exception of requiring the internal oscillator instead of using an external crystal. The HIDman-micro is a more slimmed down design and requires more code changes, mostly around some pinout changes and dropping certain features.

I haven't studied your schematic, but I'd start with a comparison to the official AXP schematic to see what might be different.

@klyde2278
Copy link
Author

klyde2278 commented Nov 2, 2024

Hi! Thank you for your answer.

I based my schematics on your HIDman-mini schematics below and tried to reuse the KEYB CLK, KEYB DATA, MS CLK and MS DATA outputs:
Schematic

Cheers!

@serisman
Copy link
Owner

serisman commented Nov 2, 2024

I just took a look at your schematic, and for the most part it looks pretty reasonable.

But, here are a few things I noticed that may or may not need to be addressed:

  • Your schematic seems to be missing the bulk capacitors (C1,C2) on the +5V rail(s). You might also want to remove D1 (or change to a schottky diode for less voltage drop)
  • Not sure why you added R4, and ZD1. VDD33 is the output of an internal 3.3v regulator that just need a 3u3 bypass cap. You don't need to supply it with an external 3.3v supply.
  • You might need to install pull-up resistors for the un-used keyboard, mouse, and serial pins (P3.5, P3.6, P0.6, P0.7, P4.4, P4.0, P0.4, P0.1). Alternatively, you may be able to get away with using a custom firmware build that disables serial support (i.e. BOARD_TYPE = BOARD_MINI should do that)
  • I believe the pull-up resistors should be 2k2 for mouse and keyboard pins (not 5k6). Pull-ups on serial pins can be 10k (5k6 is probably fine for these ones)

@serisman
Copy link
Owner

serisman commented Nov 2, 2024

One more thought...

I had a look at that Eiffel adapter's schematic and noticed that there are alternate configurations for the mouse pins RB3/RB2. They can alternately be hooked up to Rx/Tx on the Atari or the PCA82C251 for CAN? support. The scope pictures for your mouse pins looks like something with the PIC16F876P may be conflicting with the CH559 (i.e. they are both trying to drive the pins at the same time). So, I'd double check the firmware you loaded on the PIC to confirm it is the correct one, and not one with some alternate functionality that is trying to do something else with those pins. If you can't figure out a firmware issue, you could temporarily lift those mouse pins on the PIC and get some new scope shots of the CH559 pins to see if things look different.

@klyde2278
Copy link
Author

Thank you so much for reviewing my schematic.

  • I used C4 (100nf) decoupling capacitor, but missed C1 and C2, thank you for pointing me out. I'll add one.
  • D1 is a reverse current protection diode, and yes, I noticed that it generates a voltage drop. I'll change it for a Schottky.
  • ZD1 and R4: I thought a 3.3V input was needed for the CH559 to work, I saw there is an internal voltage regulator in the datasheet, but didn't realised it is an output... I'll remove ZD1, R4 and C5.
  • I'll add 10k pull-ups for unused serial keyboard and mouse pins.
  • I'll change the 5.6k pull-ups (used by the PIC with PS/2 ports on my Eiffel board) with 2.2k.
  • I'll compile a new firmware with the HIDman mini options (internal xtal, no serial, board type=mini)
  • The PIC is socketed, easy to remove and test with the CH559 only

I'll let you know what it gives.

Cheers,
Emmanuel

@serisman
Copy link
Owner

serisman commented Nov 2, 2024

  • ZD1 and R4: I thought a 3.3V input was needed for the CH559 to work, I saw there is an internal voltage regulator in the datasheet, but didn't realised it is an output... I'll remove ZD1, R4 and C5.

You'll need to leave C5. The internal regulator needs the external bypass capacitor still.

You can probably leave the 5.6k pull-ups for now. You aren't using an actual PS/2 keyboard/mouse. So, if 5.6k works for the PIC, it will probably work fine with the CH559 as well. I was just pointed out differences between your schematic and mine.

You also probably don't actually need the pull-ups on the unused keyboard/mouse pins. I don't believe the current firmware does anything with those.

But, the 10k pull-ups on the serial pins (and/or compile without serial support) would still be good to have to make sure the firmware isn't trying to communicate with a serial mouse.

@klyde2278
Copy link
Author

Thank you, I'll check that out tomorrow, and I'll let you know.

Are the parameters I use for flashing the CH559 correct?

Cheers!
Emmanuel

@klyde2278
Copy link
Author

klyde2278 commented Nov 4, 2024

Hi!

I did further testing on 2 diffrents PCBs, with what I consider the bare minimum.

  • CH559 powered up with 5V + 100nF decoupling capacitor (no 3.3µF decoupling cap though) + 3.3V output with a 3.3µF bypass cap,
  • No PIC16F876 installed,
  • 5.6K pull-ups,
  • the rest is floating.

Here is the schematic:
CH559 + Eiffel schematics

I built a firmware from Rasteri sources, with the HIDman-mini Makefile options (BOARD_TYPE=MINI, OSC_TYPE=OSC_INTERNAL,), and I tried with your precompiled HIDman-mini 1.1.3 too.

Eiffel_PCB

KB_CLK and KB_DATA seems ok.
This is what I have when pressing letter "a":
P35 - P37 Letter A

But still a no-go for the mouse, I tried with 3 different known good working USB mice (HP HSTNN-PM12, Logitech M100, Microsoft Optiocal Wheel). The optical sensor light up each time, but MS_CLK and MS_DATA lines are stuck HIGH whether I move the mouse or press the buttons.

I also noticed that P15, P25 and P26 (RGB LED, not installed on my PCB) react when I move the mouse and press the buttons, so there is some "life", but no outputs on P13 and P14.

My next step I think will be to have your HIDman-mini PCB made, in order to connect it to my original PS/2 Eiffel PCB and see what I end up with...

Cheers!
Emmanuel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants