Open c1570 opened 10 months ago
Hi c1570,
Yes, I have found a few keyboards that have the same issue. Just some random thoughts......
I found that unplugging the keyboard from the adaptor while the adaptor is plugged in to the c64 main board and powerd on seems to resolve my issue of the keyboard 'not being seen'. The issue presents itself on several VIC 20's , C64's, and a c16 that I tested. I tried different external crystal speeds and internal speed configurations. It must lay in the way the PS2/ USB keyboard communicates. I had thought of putting in a push button along the 5v line to the PS2 / USB keyboard. When depressed would cut the power and hopefully reinitialise the keyboard after the Arduino microcontroller had a chance to boot up and become ready to process data.
It appears in the latest version of schematics, I omitted the bypass capacitor. Placing a 100NF (.1uf) capacitor between VCC and ground can help with some of the glitching.
I will correct in the next revision. i will be revisiting the project this year and I am looking to include PCB transfers and possible fix for power up key detection.
Hi Hartland,
Thanks for the prompt response. This is a great project. I see quite a few PS2/USB keyboard to C64 builders have used your code.
I wondered if I could ask for some advice. I don't see a questions tab in this GitHub profile. Only an issues tab. Could I use the issues tab to ask for advice or is there a better way?
I will look forward to seeing your next revision.
Regards..
It appears in the latest version of schematics, I omitted the bypass capacitor. Placing a 100NF (.1uf) capacitor between VCC and ground can help with some of the glitching.
I forgot to mention that I already added additional capacitors to rule that out.
It looks like the PS2KeyAdvanced lib goes into some weird state in case setLock() gets called before the keyboard is actually ready. I suspect one has to wait for the 0xAA/BAT message from the keyboard after power on before sending control codes.
Banman11,
I believe the discussion tab is now available.
Responses may be a bit slow as my day job is entering the busier season.
As for the keyboard issue, has anybody tried to add a delay before ps2advanced is loaded? I am in the process of getting my C64 project bench setup up and running, while finishing off a couple of my personal projects, so I have not been able to look directly into this. Also, could you give me some model numbers of the keyboards that are having issues. i have not encountered this issue with any keyboards I have used and I will need to get one of the model keyboards that are having this issue.
Hi Hartland,
First of all I would like to you for this great project.
Much appreciated for adding the discussion tab.😁
No, I haven't added a delay before the ps2advanced is loaded. This may actually be a good way to check it. I have a theory that some of the keyboards I tested needed some type of delay.
I must apologise, I am a very mediocre hobbyist at best. What would the code snippet look like if a delay were added.
I definitely will let you know the types of keyboard that works and doesn't work. I did notice that some USB keyboards functioned perfectly fine with the PS2 programmed firmware. So I would say that some USB keyboards use PS2 style protocols.
A few of us started this thread....
https://www.melon64.com/forum/viewtopic.php?t=15160&hilit=Usb+keyboard
We had tried to contact you some time ago to get permission to use your project. However we got no reply. I do apologize very much if we have done the wrong thing. We can pull the thread down if you wish. Please let us know. We would be happy to comply.
A few of us started this thread....
https://www.melon64.com/forum/viewtopic.php?t=15160&hilit=Usb+keyboard
We had tried to contact you some time ago to get permission to use your project. However we got no reply. I do apologize very much if we have done the wrong thing. We can pull the thread down if you wish. Please let us know. We would be happy to comply.
No issues, I always meant this project to be available to all hobbyists. In fact ,I will be changing to a MIT license during the updates planned this year. I have tried to register at melon64 a couple of times, but I never receive the email verification. Perhaps give the admin a poke to check out the verification system.
Also, I have published the overall plan this year in the discussion forum.
Hello Heartland,
Thank you very much for your blessing.
It would absolutely be our pleasure if you would join us on Melon64. It would be a great opportunity for us hobbyist's have your views and inputs. There are so many things I want to know regarding your great work. Melon64 is a good easy forum for off the cuff discussion of things with an incline towards retro computer related stuff. I will see what I can do about resolving your login verification issues. I am sure it is some minor clerical technicality. I'll get back to you.
Thanks again for a great project.
Hi Hartland,
Well, I can say I that I haven't had any issues with breaking any keyboards using your current circuit layout. I even accidentally reversed the pin header on a C16 Commodore computer and absolutely nothing untoward happening. However, I absolutely don't recommend that one tries this of course.
At the time I thought the C16 machine is finished.
I would hazard a guess the crosspoint IC chip you have implemented has safety cutoff features. That's a sign of good engineering, thanks.
You mentioned earlier in this thread about adding a time delay in the Arduino microcontroller code. Would you be kind enough to post, say some sample code. I am a very mediocre hobbyist and don't know much about coding the Arduino microcontroller. However I am willing to do my best and add the snippet of code you suggest in the original code. I can check to see to see if that improves things.
@Hartland Not sure if your findings are actually related to the original description of this issue. Have you tried removing the setLock() call in resetMT8808() ? If that fixes the issue, then it's clearly related, if not, a new issue should get opened.
Perhaps the early setLock() call triggers some USB detection on keyboard side? And that only happens if - due to supply voltage/power line length/resistance - the keyboard is a bit late when initializing?
I deleted a few of my posts as they are no longer relevant and do not provide useful information. I have a tendency to share in my troubleshooting process in hopes of somebody will have some helpful insights. After tentatively fixing the issue, I thought it appropriate to cleanup a bit.
I believe I have a solution to the PS/2 initialization issue that may or may not be be related to this issue.
On certain PS/2 - USB combo keyboards, including those with only a wired PS/2 connector, there appears to be something different with the pull-up resistance on both data and clock lines. Whether or not the micro-controller has the pins set as pull-up makes no difference. Installing 4.7K or 10K pull-up resistors(again regardless of the micro-controller settings) fixes the initialization and protocol issue. Some keyboards still seem to send extra packets when a key is held down, but I will investigate and issue a fix if needed.
For those unfamiliar with pull up resistors, it is simply adding a resistor from V+ to clock and data pins separately (each pin has its own resistor).
If this does not help with the OP issue, I will separate this into a new issue.
Hi Hartland,
Very interesting! I think I have a few keyboards that have a USB cable which will work on the PS2 programmed adapter after I disconect and reconnect the keyboard cable while the adapter is powered up.
Thank you for the tip on using the 4.7k -10k Ohm pullup resistor between the + 5v power rail and the Clock and Data separately.
I'll get back to you with my observations.
Thanks
As mentioned in in the discussion post, I found that 220 ohm resistors work best. At least with the keyboard I experimented with, that value really brought it under control and working smoothly.
It seems I'm stumbled upon a PS/2 keyboard (a cheap "Labtec 867571-0102") that has some issues with the startup timing.
Setup: ATmega8, 8MHz internal clock, 64ms startup, 4V BOD, rather long power lines.
Symptom:
I suspect the problem is power related as this doesn't happen that often with very strong power supply/very short power lines. Perhaps the ATmega powers on much before the keyboard does, bringing them out of sync or similar.
In any case, disabling the setLock() call in resetMT8808() seems to fix the issue. I suspect delaying that somewhat would also be fine.