Close

Working prototype - buggy NES mini controller!!

A project log for NES Controller Interface using PIC16F18446

NES Controller interface for my homebrew CPU SPAM-1 to allow playing CHIP-8 games

john-lonerganJohn Lonergan 08/18/2021 at 17:380 Comments

The hardware for this is easy but getting the software working took longer than expected.

The controllers I got from eBay are knock-offs as expected but what I didn't expect was that these controllers were actually running buggy software and didn't follow the correct NES protocol.

The controllers are of the I2C variety rather than the earlier and simpler shift register style.

The Nintendo I2C controllers (gamepads and nunchucks etc) read cycle requires you to read a sequence of 6 bytes from the controller and the last two bytes contain the information about which buttons are pressed.

Unfortunately the ones I have turned out to be early knock-offs that don't actually work on the console because they require the master to read 8 bytes and keep the last two bytes rather than 6 and 2.

While this is fatal for their use with the console I can adjust my software to compensate. 

See https://github.com/dmadison/NintendoExtensionCtrl/issues/33

My controller is one of those that returns this device Id when the appropriate Nintendo device ID query is sent over I2C....

0x81 | 0x81 | 0x81 | 0x81 | 0x00 | 0x00

See that issue link for more info.

I've pushed my current solution to github 

https://github.com/Johnlon/NESInterfaceAndPeripherals/blob/main/controller.c

I will tidy it up and minimise the code. If you have a legit controller then life is simpler.

Discussions