Author Topic: RFC: Using PIC24FJ64GA002 as a modern 8042 replacement  (Read 2223 times)

0 Members and 1 Guest are viewing this topic.

Offline technix

  • Super Contributor
  • ***
  • Posts: 3316
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
RFC: Using PIC24FJ64GA002 as a modern 8042 replacement
« on: December 01, 2018, 05:45:14 pm »
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?
 

Offline jazper

  • Contributor
  • Posts: 40
Re: RFC: Using PIC24FJ64GA002 as a modern 8042 replacement
« Reply #1 on: December 25, 2018, 08:01:09 am »
You know, you may be able to do this with the venerable atmega328 relatively easily (can handle 5v too)
 

Offline technix

  • Super Contributor
  • ***
  • Posts: 3316
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: RFC: Using PIC24FJ64GA002 as a modern 8042 replacement
« Reply #2 on: December 26, 2018, 03:27:29 pm »
You know, you may be able to do this with the venerable atmega328 relatively easily (can handle 5v too)
My main processor is a NEC V40HL with a nice overclock on it. ATmega328 isn’t going to be fast enough.
 

Offline jazper

  • Contributor
  • Posts: 40
Re: RFC: Using PIC24FJ64GA002 as a modern 8042 replacement
« Reply #3 on: December 31, 2018, 12:26:17 am »
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.

 

Online Jacon

  • Contributor
  • Posts: 33
  • Country: pl
Re: RFC: Using PIC24FJ64GA002 as a modern 8042 replacement
« Reply #4 on: January 01, 2019, 11:42:32 am »
...The atmega328 can do 16mhz....
Only in Arduino - actually chip can 20MHz...
 

Offline technix

  • Super Contributor
  • ***
  • Posts: 3316
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: RFC: Using PIC24FJ64GA002 as a modern 8042 replacement
« Reply #5 on: January 02, 2019, 05:40:38 am »
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.
My V40HL is the 16MHz version and I am going to try run it at 20MHz or 24MHz.
 

Online Rasz

  • Super Contributor
  • ***
  • Posts: 2354
  • Country: 00
    • My random blog.
Re: RFC: Using PIC24FJ64GA002 as a modern 8042 replacement
« Reply #6 on: January 02, 2019, 08:28:40 am »
My V40HL is the 16MHz version and I am going to try run it at 20MHz or 24MHz.

doesnt really matter, keyboard controller is sitting on 7MHz ISA bus, what you need to worry is access timings
READ:
CS, A0 to Data Out Delay 130 ns
tRD RDvto Data Out Delay 130 ns
tDF RDuto Data Float Delay 85 ns
WRITE:
tWW WR Pulse Width 160 ns
tDW Data Setup to WRu 130 ns

8042 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

« Last Edit: January 02, 2019, 08:32:31 am by Rasz »
Who logs in to gdm? Not I, said the duck.
My fireplace is on fire, but in all the wrong places.
 

Offline technix

  • Super Contributor
  • ***
  • Posts: 3316
  • Country: cn
  • From Shanghai With Love
    • My Untitled Blog
Re: RFC: Using PIC24FJ64GA002 as a modern 8042 replacement
« Reply #7 on: January 02, 2019, 07:37:09 pm »
My V40HL is the 16MHz version and I am going to try run it at 20MHz or 24MHz.

doesnt really matter, keyboard controller is sitting on 7MHz ISA bus, what you need to worry is access timings
READ:
CS, A0 to Data Out Delay 130 ns
tRD RDvto Data Out Delay 130 ns
tDF RDuto Data Float Delay 85 ns
WRITE:
tWW WR Pulse Width 160 ns
tDW Data Setup to WRu 130 ns

8042 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
That 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.
 

Online Rasz

  • Super Contributor
  • ***
  • Posts: 2354
  • Country: 00
    • My random blog.
Re: RFC: Using PIC24FJ64GA002 as a modern 8042 replacement
« Reply #8 on: January 02, 2019, 09:01:24 pm »
That is why I am talking about that PIC24, which also has a similar dedicated hardware slave port.

google... 80 ns, yep, Addressable Parallel Slave Port Mode looks perfect

Also since I am overclockiny the main processor to 24MHz, the bus is overclocked too.

only if you want it to be, you can configure wait states, default is 3
Who logs in to gdm? Not I, said the duck.
My fireplace is on fire, but in all the wrong places.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf