avatar_Joss

Is there any recent project to connect a PC (PS/2) keyboard to the CPC?

Started by Joss, 18:42, 27 August 12

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

n_sonic

Thank you for the fast, full and complete reply!  I can make my cpc6128 alive again with help of your board!Regards from friendly forum zx-pk.ru Thanks again! Alexey.

gerald


n_sonic

 It's me again... Unfortunately all is not so easy. Controller don't want to start. I have tried two chips and two different programmers, checked all lines and connections. May be some errors in code, cause attiny don't reset the keyboard and don't generate keyboard clk without ckout enabled...  :( Any ideas?

gerald

Here are the fuse configuration I am using. These are read from the device that is used in my CPC6218
[attach=2]

Questions :
1. What is the state of the keyboard clock/data lines (with the CLKOUT fuse disabled) ? Both are expected to be high unless there is a ongoing communication with the keyboard. If these are low all time, the keyboard may not have integrated pullups.
2. Did you mount the pullup resistors on the keyboard clock/data? if not, can you try with them ?
3. Are you using a true PS2 keyboard or a USB one with an adaptor ?





n_sonic

If you mean PS2 keyboard serial lines - both (clk and data) are in high level voltage (logic "1"). I'm using pull-up resistors 10k each in this lines. Without them the result is the same (high level and no reaction). Keyboard have PS2 interface, not USB. I think that the program isn't starting at all. Fuses are right. To program ic i use two programmers with parallel and serial programing. In ISP mode i program with modified AVRdude sw (with window interface) by USBasp programmer. Fantastic...  :o Data memory should be empty or not?

gerald


Quote from: n_sonic on 22:47, 27 November 12
Data memory should be empty or not?
EEPROM is not used.

Can you check the following :
- reset pin (pin 1) is not shorted to vcc
- keyboard clock and data are not swapped ?
- Have you tried with an other keyboard ?

Also, do you have access to any debugging equipment (oscilloscope ?)
Can you also post a picture of your board and setup ?


Joseman

Hi

Sorry for the late post on this topic,

I was searching too how to attach a ps/2 keyboard to our beloved CPC, i thing that is very interesting to preserve the cpc keyboard and for use on programming, testing, office jobs (anyone?) and for games like conversational games or the ones that don't need perfect timing pressing a key, i suposse that the ps2 to cpc adapter will produce some lag or input lag that in any games will not work well?

anyway i found a very very interesting project for spectrum "imar3" using the expansion port of the 48k/48k+, the adapter doesn't work on other speccy's, i suspect that it's the same problem with our cpc, not all the signals from the keyboard are on  the expansion port.

What i like about the project it's that he is using old school electronic to make the adapter not last generation hardware that i think it's not the way to make expansions for the cpc, i like to stay with the same technologiy all the time, it's more cool with our cpc's :) and always will be replacements in the junk rooms of the world XD

here is the project (in english):

Adaptador de teclado PC para Spectrum

And I like the Gerald solution that it's going directly to the PPI 8255, seems that is more simple and much more compatible.

Will be possible to adapt de imar3 project with Gerald idea to our amstrads?

SyX

@Joseman: But remember how the CPC keybard is read. The keyboard is attached to the AY and the Z80 only can access to the AY through the PPI. While in the ZX 48 is only attached to the $FE i/o port that you can capture easily from its expansion bus.

Then the complexity of your circuit will depend where you attach your new keyboard: AY is the most direct, because only needs to understand how the AY get the keyboard bytes (the zx interface is most similar about what is need at this level... but you are going to sweat for putting all those old and big ICs inside of a CPC); PPI needs understand how the PPI reads from the AY; Z80 will need sniffer the i/o ports used for write/read the PPI from the expansion bus during the read keyboard protocol.

With respect to not use "modern" technology in 2014, well CPLDs and FPGAs were born in 1984 and the only reason they were not used in 8 bits computers then, was cost and size. And for the old nerds justifying the lack of control with respect to use TTLs, they have not seen the modern tools for designing circuits, because you can draw your circuit using the TTLs you want and then the software generate a "binary" file for you can flash your exact design in the IC (even although it's not a bad thing learn a little of VHDL).

What do you prefer solder 15 TTLs or 1 CPLD? Or compare the size of a DK Tronics 256 KBs RAM Expansion with the 512 KBs RAM / 512 KBs ROM X-MEM? My philosophy is use the tools that make my work easier for giving the best i can, we are in 2014 and i doubt any want uses Brunword or Protext for write a text :P

ralferoo

Quote from: Joseman on 08:43, 15 June 14
What i like about the project it's that he is using old school electronic to make the adapter not last generation hardware that i think it's not the way to make expansions for the cpc, i like to stay with the same technologiy all the time, it's more cool with our cpc's :) and always will be replacements in the junk rooms of the world XD

here is the project (in english):

Adaptador de teclado PC para Spectrum
So, I'm confused. This project requires the use of the PIC 16F84, essentially an entire computer on a chip, that was introduced over a decade after the 6128 was released. For comparison, FPGAs were available commercially at the time the 6128 was released and CPLDs even earlier still (they were the next intermediate stage after ULAs, PALs and GALs before FPGAs).

In what way is that more like "old school technology"?  ;D

Much as SyX said, you can be sure if these techonologies made economic sense, Amstrad would have used them. You can see a GAL being used in the 6128 to control the RAM banking and the cost-down CPCs were Amstrad's testbed of using ASICs before they made the plus range.

Joseman

Ok guys the two are right  :P

the pic is nearly a decade over the cpc and it's right that amstrad made use of the (bugged) ASIC, it emulate various chips, but i hate emulators, i don't like the cpc+ range  :P , and it's nearly impossible to be 100% accurate with the original chips (again, bugs on the asic).

I know, it's me, I don't like emulators and hardware emulating ancient consoles (the new fashion), if i want to play with an old computer or console, i use the original hardware, because it's the best accurate mode to use. Syx i know that i'm ¿beating around the bush?.

Talking about expansions i understand your point of view, and i agree with the use of modern hardware for this. But the idea to use "old" spares and chips it's for an idea that i have in mind since last year but i will not say anything about it  ;) .

the real point for me is, can the hardware of the imar3 (with modifications) be attached to the ppi like Gerald's project and make a solution 100% compatible with the original cpc keyboard?







ralferoo

Quote from: Joseman on 20:02, 16 June 14
the real point for me is, can the hardware of the imar3 (with modifications) be attached to the ppi like Gerald's project and make a solution 100% compatible with the original cpc keyboard?
TBH, I'm not sure which side of the PPI Gerald's project attaches. It'd be relatively simple to hook something like this up to the keyboard matrix, assuming you have an old style 464 with easy to connect headers.

It'd be harder (probably not impossible, but harder) to do this as an add-on board on the PPI, as the keyboard matrix inputs go into the AY chip (where they could just be pulled low on input) but between the AY and PPI, you'd have to keep track of the AY's register state. You also shouldn't just pull this data bus low, although if the AY chip is NMOS you will probably not cause too much damage if you did. So, really, you'd also have to intercept the control signals to the AY chip (fortunately, these do come from the PPI).

on the keyboard matrix side of the PPI, especially as there'd not really much much to worry about timing wise. It'd probably not be impossible on the CPU side of the PPI if the

So, overall, it'd be a bit of a pain.  :-X

BTW, my CPC FPGA project uses a PS/2 keyboard. Personally, I find it takes a little bit of getting used to as when you're typing punctuation, it's easy to think "PC keyboard" and not type the same keys you would instinctively on a CPC. I guess it's the same problem as with a PC-based emulator too though.

gerald

Quote from: ralferoo on 20:24, 16 June 14
TBH, I'm not sure which side of the PPI Gerald's project attaches.
The interface is just hooked to the line number output of the PPI and Z80 signals that are used to write to the PPI register.
The interface is basically two chip : one 74LS138 and a microcontroller.
   The 74LS138 is used to detect a write to the line port and generate an IRQ to the microcontroller.
   The Microcontroller  (89C2051 for the original version, AtTiny2313 for the later version) manage the PS2 keyboard and does the translation to amstrad keyboard matrix. Keyboard row update is done each time a key is pressed/release or when line changes.

The row ouput of the microcontroller is then connected to the AY input, which on the 6128 is also available on a unmounted resistor network, just between the PPI and the AY. So piggypacking the interface on the PPI was the obvious choice  ;)

Quote from: Joseman on 08:43, 15 June 14
Will be possible to adapt de imar3 project with Gerald idea to our amstrads?
There is no need to adapt the imar3 ;) , my interface works the same way : a microcontroller to handle the PS2 keyboard, glue logic to interface with the CPC.
And if you want to have my interface on the CPC expansion connector, you just need to add a 4 bit buffer to emulate the PPI register and connect the row output to the joystick port. While there is no schematic of this, I've described it earlier in this thread.

Bryce

Regarding using old/new ICs, I used only old LS ICs on the MegaFlash just so that it looks more retro. I could have put it all in a CPLD, but I thought it looked better with real Logic in DIP packages. The Flash obviously doesn't match as flash wasn't around back then.

@Gerald: Nice solution, how does it handle PC keyboards with a different language?

Bryce.

gerald

Quote from: Bryce on 08:35, 17 June 14
@Gerald: Nice solution, how does it handle PC keyboards with a different language?
The keyboard translation is handled by a set of conversion tables. The download version only include a UK PS2 layout to UK ROM CPC. But I also have PS2 US layout to UK CPC and PS2 FR layout to FR CPC. Obviously these tables can only be changed by recompiling the whole code.
The original design could deal with two keymap, selected by a jumper. The 'modern' version with AtTiny could handle more thanks to the free oscillator pins.

Bryce

That's good. Maybe some simple solder-bridges could be added to the PCB to select the language? Real jumpers aren't really needed as this choice would probably only ever be made once.

Bryce.

Munchausen

I can't understand what the 3 pin header is for on the schematic?

Bryce

That's probably the jumper to select which keyboard layout you are using.

Bryce.

gerald

Quote from: Munchausen on 13:55, 17 June 14
I can't understand what the 3 pin header is for on the schematic?
As Bryce just said, it is the jumper used to select the keyboard layout.
By slightly loading one bit or the other, the internal comparator will be 0 or 1. That was the only way to get one bit for configuration from the old design (with AT80C2051). It is currently not used by the release code.

jibanes

I'm following this thread closely, I'm highly interested; I wonder if someone will sell the pcb?

Piotr

Hello, i assembly this interface but:
When i run my CPC464 with interface and connected ps2 keyboard, ps2 keyboard not working. If i run cpc and connect ps2 keyboard later all is ok. I check two diffrent keyboards, with and without pullup resistors. Any idea?
I use attiny 2313A and 74LS138 in prototype board.
A8 to pin 1 ls138,
A9 to pin 2 ls138
A11 to pin 3 ls138
IOWR to pin 4 ls138


amstrad CPC 464 ps2 keyboard interface test - YouTube

Anyway i design small pcb for this interface  ;)

]

Joseman

You don't know how many time i've been waiting for something like this!

The board is powered with the same source that the cpc?

I don't understand the attiny 2313A but... perhaps the keyboard detection doesn't work well because the board doesn't initialize fast enough (for some reason) but if you have the board totally working, then connect the keyboard, the autodetection is fine?

How about the game compatibility?

thanks for this project!!!!!!!!!!!!!

Regards
Jose

Piotr

Well but is Gerald project i only assembly it and made PCB design. Nothing special.  If Gerald give me permission i can made some boards assembled or not. But this still need some work.

gerald

Quote from: Piotr on 06:08, 02 January 15
When i run my CPC464 with interface and connected ps2 keyboard, ps2 keyboard not working. If i run cpc and connect ps2 keyboard later all is ok. I check two diffrent keyboards, with and without pullup resistors. Any idea?
That's strange, I've never had problems with the keyboard connected at powerup, however I only tested it with 3 or 4 different one in 2 CPC (464 / 6128).
If the keyboard is working when you plug it after power up, the connection to the CPC is OK and this is only a SW issue.
Could you try by removing the capacitor on the reset line (C1) so the microcontroller only use its internal power on reset. I suspect a race condition in the keyboard and microcontroller reset.

Quote from: Piotr on 10:26, 02 January 15
Well but is Gerald project i only assembly it and made PCB design. Nothing special.  If Gerald give me permission i can made some boards assembled or not. But this still need some work.
Permission granted  ;)
But as you say, we need to check that there are no other blocking issues like the one you have.
Also, people need to know that the public project only support UK keyboard on UK CPC.
New keymap (new FW) are needed for other configuration. I have US to UK and FR to FR available, but we may need german and spanish support as well.

Quote from: Joseman on 10:00, 02 January 15
How about the game compatibility?
Game compatibility is limited by the following  :
- you cumulate PS2 matrix clash with CPC matrix clash
- you have a added lag compared to the native CPC keyboard (matrix -> PS2 -> uC -> CPC matrix convertion ).

Piotr

Gerald i sit on it all night ;) But i start with it on previous evening . To be honest i think use this interface for my CPC464 new mainboard what i plan do.  If i made pcb and send one or two to you can you take time to check? And thank you for this.






Joseman

Quote from: gerald on 10:44, 02 January 15
Game compatibility is limited by the following  :
- you cumulate PS2 matrix clash with CPC matrix clash
- you have a added lag compared to the native CPC keyboard (matrix -> PS2 -> uC -> CPC matrix convertion ).

Well, i use 2 playstation pads for gaming on the cpc, but sometimes there is need to pause the game or some special static key like (i)nventory, (m)ap, etc... or text adventure games where there is not need of ultra full speed on this keys and there isnt' keyboard clash problem with that, i think that this project is really the last chain for the cpc-at users...

Regards
Jose

Powered by SMFPacks Menu Editor Mod