Need Input
I'm working on adding peripherals to PikaPC, my homebrew PowerPC computer project. I have plans for adding support for video, SD card, and keyboard & mouse. I'm still waiting for some parts to arrive for video, and I'll need to build a SPI interface for an SD card, so I'll start with adding a keyboard/mouse controller.
I've decided to use a PS/2-compatible keyboard controller salvaged from an old PC motherboard that was destroyed by a leaking battery. There are endless options that would have served this purpose, but these 8042-compatible controllers are abundant and fairly easy to use.
The keyboard controller will be sitting on the 5V peripheral bus, so it will need the PLD I programmed previously for enabling the level-shifting bus transceivers, but otherwise it didn't need any other glue logic to interface with the CPU. It just required some inverting buffers for the physical PS/2 interface. This also makes it a good place to start testing my 5V peripheral bus.
I got everything wired up & flipped the switch to test it, and if course it didn't work. The computer would no longer boot. A problem like that is bound to be bus contention and removing the bus transceiver confirmed the problem. Probing with the logic analyzer, I realized the bus enable signal was stuck in the active state so the bus transceiver was trying to drive the bus at the same time as ROM and RAM.
Pulling the PLD and going back to the breadboard, I was able to duplicate the issue — the bus enable signal was always asserted and did not respond to any input changes. This took me a while to track down. I went back to the simulator and realized I hadn't simulated this particular signal previously. When I added it to the simulation, it came back as indeterminate state. Nothing I did seemed to have any effect. Despite assigning a value to the pin, it always compiled to be an input.
What was the problem? A typo. I had swapped two letters. The PDBEN pin I had defined at the top was never referenced, but the PBDEN signal I assigned a value to was used throughout. With that corrected, the computer booted into Forth again without issue with the 5V bus reconnected.
The next step was to update the ROM to configure the additional memory regions I would need for the keyboard controller. The PPC403GA has a built-in memory controller with 8 banks that can be configured for accessing DRAM or ROM/SRAM/Peripherals. Each bank comes with proper chip select signals and can be configured for proper timing for whatever device is connected to that bank.
I have the first two banks configured for ROM & RAM. I set up additional banks for the keyboard controller and future SD card & video peripherals. This ended up requiring some back-and-forth because I misunderstood how the bank addressing works. But once I sat down and mapped out all the regions of the address space that each bank needed, I was able to get the system running with all the requisite banks enabled.
All I needed then was some software to test the keyboard controller and keyboard. I have experimented with 8042 keyboard controllers before, so I had an old Arduino sketch that had worked for me previously. I just needed to port the initialization code over to Forth so I could start testing —
Success!
Playing around with my Forth code, I can initialize both the keyboard and mouse, and see them report back data. The keyboard sends valid scan codes for button press and release; the mouse sends valid data packets for movements and button clicks.
The remaining parts for the video circuit should arrive any day now so I'm planning on starting wiring for that next. The video generator is a in a 208-pin package, and there are 4 RAM chips in 40 pin packages to accompany it, plus the new bus transceivers and logic; somewhere around 400 new wires is more than the rest of this project as it stands currently. It's going to take quite some time to assemble!












