0

Is it possible to connect two nes i2c nes controllers onto the same i2c bus?

I will guess that is not possible if the i2c addresses of these controllers are hard coded to a common value.

Any ideas?

If it can be done, are there any issues to be concerned about?

Thanks

1
  • Your question was not quite clear to me. I have edited it in an effort to move it closer to proper English, but I may have inadvertently changed your meaning. If you feel this may be the case, please write your question in your native language, and then "translate" it to English with Google translate.
    – Seamus
    Aug 6 at 20:04
1

i2c is a bus in the computer/electronic sense of the word. By definition, a bus is designed to support communication between multiple devices.

However, for the i2c bus, each "slave device" connected to the bus must have a unique address. Please review the fundamentals of the i2c protocol if you are not sure about any of these terms - or need a tutorial.

If the nes i2c nes controller provides no means that allow you to set or change its default i2c address, then you may use only one on a single i2c bus. And therefore, if you need a 2nd (or third or fourth, or ...) nes i2c nes controller, each of them will need to be assigned to a different i2c bus. Please read on to learn how this may be done:

Depending on your situation/use-case, you may be able to configure other unused GPIO pins as i2c buses. If you have an RPi 4 (BCM 2711), this will almost certainly be the case. If you want or need multiple i2c buses on a single RPi, you should begin by reading this documentation - also available on your local filesystem at boot/overlays/README.

Having read that document, you will understand that the RPi provides you the ability to configure multiple i2c buses through its device tree facility, and specifically through the capacity of modifiers known as device tree overlays (a.k.a. dtoverlay) to modify the default hardware configuration. This is easily accomplished by adding existing dtoverlays to the /boot/config.txt file on your RPi.

Consequently, I feel this is the answer to your question:

Answer: "Configure an additional i2c bus in /boot/config.txt by using one of the dtoverlay definitions in boot/overlays/README

Please try this. If you have any specific questions regarding choice or usage of a specific dtoverlay, it may be best to ask those as new questions, but you may also submit a Comment, or edit your original question. ALSO: If you have specific questions, please include your RPi model # and your kernel version!

7
  • 2
    you could also use an I2C multiplexer
    – Bravo
    Aug 7 at 0:08
  • @Bravo: True - do you have an example? Or maybe better, describe that in your answer? :)
    – Seamus
    Aug 7 at 0:15
  • No example - I read a comment in raspberrypi.stackexchange.com/questions/130523/… that mentioned such a thing. I have seen them used (on arduino type devices admittedly) but never used them myself. I can imagine it may complicate things - but if you have only one i2c bus at your disposal, it's the only way to do it :p
    – Bravo
    Aug 7 at 0:25
  • @Bravo: but if you have only one i2c bus... But that's not the case for the RPi. All of them have at least two i2c buses, and RPi 4 has 6 i2c buses and "From the 5.4 kernel onwards the base DT includes the use of i2c_mux_pinctrl" - which I think means RPi has an internal mux in the the device tree (pin config) now. That said, OP didn't disclose RPi model or kernel ver, but most importantly I've never used it, & can't prepare a reliable answer.
    – Seamus
    Aug 7 at 0:51
  • @Bravo: I do appreciate your comments, though. As it turns out there are I2C Muxes, and there are also I2C Switches - which accomplish the same thing in different ways. link
    – Seamus
    Aug 7 at 0:54
0

In the end I bitbanged the protocol for fun (not profit).

Implementation is : https://github.com/Johnlon/NESInterfaceAndPeripherals/blob/main/README.md

Hackaday: https://hackaday.io/project/181036-nes-controller-interface-using-pic16f18446

Video: https://www.youtube.com/watch?v=i5Velt4mQLk

New contributor
John Lonergan is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
1
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review
    – Chenmunka
    17 hours ago

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.