RFC: Using PIC24FJ64GA002 as a modern 8042 replacement - Page 1
Forum section: electronics / general

author: technix
author_rank: Super Contributor
timestamp: December 01, 2018, 05:45:14 pm
content: For a PC/XT clone, the 8042 keyboard controller is a headache, as that is implemented using a microcontroller with a parallel slave port and at least one address line. Most of the 40/44-pin 8-bit PIC has PSP but it lacked that address line, and they are also those bigger variants of the chips.I then came across PIC24FJ64GA002, a 28-pin PIC24 that has a PSP even in the 28-pin package, and two address lines to go along with that. I wonder if that can make a good 8042 replacement, implementing PS/2 keyboard protocol. Also is there any 5V version of a similar chip?

author: jazper
author_rank: Regular Contributor
timestamp: December 25, 2018, 08:01:09 am
content: You know, you may be able to do this with the venerable atmega328 relatively easily (can handle 5v too)

author: technix
author_rank: Super Contributor
timestamp: December 26, 2018, 03:27:29 pm
content: Quote from: jazper on December 25, 2018, 08:01:09 amMy main processor is a NEC V40HL with a nice overclock on it. ATmega328 isn’t going to be fast enough.

author: jazper
author_rank: Regular Contributor
timestamp: December 31, 2018, 12:26:17 am
content: When you say nice overclock what kind of overclock are we talking? (what speed do you really need?)Based on this page:http://devster.monkeeh.com/z80/upi42/it looks like the 8042 was a 12.5mhz chip. The atmega328 can do 16mhz.Another chip which comes to mind is the STM32F103. It's 5V tolerant but 3.3v so you may need a logic shifter for the output.The question becomes how much time do you want to invest in it - if you can do it with arduino libraries etc, it'll be quicker to get going.

author: Jacon
author_rank: Regular Contributor
timestamp: January 01, 2019, 11:42:32 am
content: Quote from: jazper on December 31, 2018, 12:26:17 amOnly in Arduino - actually chip can 20MHz...

author: technix
author_rank: Super Contributor
timestamp: January 02, 2019, 05:40:38 am
content: Quote from: jazper on December 31, 2018, 12:26:17 amMy V40HL is the 16MHz version and I am going to try run it at 20MHz or 24MHz.

author: Rasz
author_rank: Super Contributor
timestamp: January 02, 2019, 08:28:40 am
content: Quote from: technix on January 02, 2019, 05:40:38 amdoesnt really matter, keyboard controller is sitting on 7MHz ISA bus, what you need to worry is access timingsREAD:CS, A0 to Data Out Delay 130 nstRD RDvto Data Out Delay 130 nstDF RDuto Data Float Delay 85 nsWRITE:tWW WR Pulse Width 160 nstDW Data Setup to WRu 130 ns8042 handles this with dedicated hardware slave port, what you might need is a small cpld to handle the bus and buffer I/O, or one of those fancy microcontrollers with buildin cpld block, or something with really fast realtime IO like XMOS

author: technix
author_rank: Super Contributor
timestamp: January 02, 2019, 07:37:09 pm
content: Quote from: Rasz on January 02, 2019, 08:28:40 amThat is why I am talking about that PIC24, which also has a similar dedicated hardware slave port. Also since I am overclockiny the main processor to 24MHz, the bus is overclocked too.

author: Rasz
author_rank: Super Contributor
timestamp: January 02, 2019, 09:01:24 pm
content: Quote from: technix on January 02, 2019, 07:37:09 pmgoogle... 80 ns, yep, Addressable Parallel Slave Port Mode looks perfectQuote from: technix on January 02, 2019, 07:37:09 pmonly if you want it to be, you can configure wait states, default is 3