1

I have a Raspberry Pi 4 B and I'm trying to set up in I2C Connection with an MCP23018-E/SP I/O-Port-Expander via GPIO02 and GPIO03. I have enabled I2c on the Raspi by:

  • adding: dtparam=i2c1=on to /boot/config.txt

            dtparam=i2s=on      to    /boot/config.txt
    
            dtparam=i2c_arm=on  to    /boot/config.txt 
    
            dtoverlay=i2c1,pin2_3(tried it as well without the last three)
    
  • added all modules in /etc/modules

  • enabled automatic load of i2c kernel at boot

  • installed i2c-tools, python-smbus.

for
$ ls -l /dev/i2c-*
I get:
crw-rw--- 1 root i2c 89, 0 Okt 05 18:00 /dev/i2c-1

So my bus should be set up correctly. I know, you have to use the alternative functions for the GPIO Pins to get I2C, so I set:

  • raspi-gpio set 02 a0
  • raspi-gpio set 03 a0 (because SDA1/SCL1 are Alternate functions for GPIO 02 and GPIO 03. I get as well for raspi-gpio get 02,03 that the SDA/SCL are enabled.

I tried it aswell for different Pins, whose alternate function can provide an i2c buses, but none of them show a result for i2cdetect -y 1

I looked at the channels with an oscilloscope, and from my point of view, the Raspi is NOT sending SDA and SCL, there are both just high at 3,3 V.

I really tried everything to send the I2C signals, but it will not work and I don't have a different device to check my circuit, but I'm pretty sure on the hardware side everything is correctly wired.

Any help would be really helpful.

PJ_2810

1 Answer 1

1

Most of what you have configured is not needed and may be part of the problem.

Don't add modules to /etc/modules, don't set the GPIO mode with raspi-gpio or similar, don't enable automatic load of I2C kernel at boot.

Remove everything you have done and just add the following line to /boot/config.txt.

dtparam=i2c_arm=on

Reboot and check that the device /dev/i2c-1 exists. If it does you are ready to go.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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