09/01/2021 at 00:16 •
The hardware is fully unit tested and I've updated the project documentation updated including details of the I2C implementation including an annotated trace of the I2C bus.
08/30/2021 at 04:56 •
The git repo has more details https://github.com/Johnlon/NESInterfaceAndPeripherals/blob/main/README.md
The adapter design supports two NES controllers and also has a random number generator, both of which are needed by my CHIP-8 emulation.
I will probably add a couple more functions to it, namely a 16 bit clock or stop watch.
08/18/2021 at 17:38 •
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.
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
I will tidy it up and minimise the code. If you have a legit controller then life is simpler.