BPI-R2 PRO GPIO config with python

Hello, for my project I need to use the Banana Pi R2-Pro GPIO and SPI functionalities. I am trying to install the RPi.GPIO python library but nothing seems to work. I run the Armbian bookworm desktop image. I tried the SINOVOIP/RPi.GPIO library (https://github.com/BPI-SINOVOIP/RPi.GPIO), and it fails to install with “error: command ‘/usr/bin/aarch64-linux-gnu-gcc’ failed with exit code 1”. Any suggestions on how to work around this issue? Thanks

If anyone is freelancing and interested to help me out with this, please DM!

Sorry for hijacking your thread, but I can’t create new topic. Still, related - I am trying to make GPIO/I2C working with BMP280 sensor. But despite having wiring right, the sensor is not detected. What I do:

I am using GPIO pins 1,3,5,9, to connect VCC, GND, SCL, SDA pins on BMP280.

Then, I do run this: echo bmp280 0x76 > /sys/class/i2c-adapter/i2c-0/new_device

I do get this in DMESG:

[Thu Mar 27 08:48:32 2025] bmp280 1-0076: supply vddd not found, using dummy regulator
[Thu Mar 27 08:48:32 2025] bmp280 1-0076: supply vdda not found, using dummy regulator
[Thu Mar 27 08:48:32 2025] bmp280 1-0076: GPIO lookup for consumer reset
[Thu Mar 27 08:48:32 2025] bmp280 1-0076: using lookup tables for GPIO lookup
[Thu Mar 27 08:48:32 2025] bmp280 1-0076: No GPIO consumer reset found
[Thu Mar 27 08:48:32 2025] i2c i2c-1: new_device: Instantiated device bmp280 at 0x76

I tried to set the sensor for I2C-1 and I2C-2 as well, and also tried higher memory binding to 0x77. Nothing works. I can’t read the sensor:

root@ap-unimatrix:/usr/src# i2cdetect -y 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                         

Also, scanning I2C-0 spams DMESG by this:

[Thu Mar 27 09:36:41 2025] mediatek-hdmi-ddc 11013000.i2c: ddc failed!
[Thu Mar 27 09:36:41 2025] mediatek-hdmi-ddc 11013000.i2c: i2c ack err!
[Thu Mar 27 09:36:41 2025] mediatek-hdmi-ddc 11013000.i2c: ddc failed!
[Thu Mar 27 09:36:41 2025] mediatek-hdmi-ddc 11013000.i2c: i2c ack err!
[Thu Mar 27 09:36:41 2025] mediatek-hdmi-ddc 11013000.i2c: ddc failed!
[Thu Mar 27 09:36:41 2025] mediatek-hdmi-ddc 11013000.i2c: i2c ack err!
[Thu Mar 27 09:36:41 2025] mediatek-hdmi-ddc 11013000.i2c: ddc failed!
[Thu Mar 27 09:36:41 2025] mediatek-hdmi-ddc 11013000.i2c: i2c ack err!
[Thu Mar 27 09:36:41 2025] mediatek-hdmi-ddc 11013000.i2c: ddc failed!
[Thu Mar 27 09:36:41 2025] mediatek-hdmi-ddc 11013000.i2c: i2c ack err!
[Thu Mar 27 09:36:41 2025] mediatek-hdmi-ddc 11013000.i2c: ddc failed!
[Thu Mar 27 09:36:41 2025] mediatek-hdmi-ddc 11013000.i2c: i2c ack err!
[Thu Mar 27 09:36:41 2025] mediatek-hdmi-ddc 11013000.i2c: ddc failed!
[Thu Mar 27 09:36:41 2025] mediatek-hdmi-ddc 11013000.i2c: i2c ack err!
[Thu Mar 27 09:36:41 2025] mediatek-hdmi-ddc 11013000.i2c: ddc failed!
[Thu Mar 27 09:36:41 2025] mediatek-hdmi-ddc 11013000.i2c: i2c ack err!
[Thu Mar 27 09:36:41 2025] mediatek-hdmi-ddc 11013000.i2c: ddc failed!

As for GPIO Pins being claimed by i2c interfaces, it looks like they are assigned to bogus func1 interface instead:

root@ap-unimatrix:/usr/src# cat /sys/kernel/debug/pinctrl/1000b000.pinctrl/pinmux-pins | grep .i2c
pin 57 (SDA1): 11008000.i2c (GPIO UNCLAIMED) function func1 group SDA1
pin 58 (SCL1): 11008000.i2c (GPIO UNCLAIMED) function func1 group SCL1
pin 75 (SDA0): 11007000.i2c (GPIO UNCLAIMED) function func1 group SDA0
pin 76 (SCL0): 11007000.i2c (GPIO UNCLAIMED) function func1 group SCL0
pin 124 (HDMISCK): 11013000.i2c (GPIO UNCLAIMED) function func1 group HDMISCK
pin 125 (HDMISD): 11013000.i2c (GPIO UNCLAIMED) function func1 group HDMISD

@frank-w Any clue? Any hint on where to look? You’ve experimented with GPIO on this board after all. Do I need DTS overlay to work with I2C?

Note: I am using BPi-R2, not BPi-R2 Pro. So GPIO mapping on Pro variant could be different.

R2 (and afair r2pro too) have i2c enabled in dts without needing overlay. But afaik you needed an additional switch maybe -r) for i2cdetect. I had an i2c display on my r2 for long time.

I2c0 is mapped to hdmi (internal i2c,not the gpio i2c0) because hdmi driver is loaded before i2c. So gpio i2c0 is i2c1 in system afaik

OK, that helps, so I know my device would be mapped to i2c-1. So I can use bellow:

echo bmp280 0x76 > /sys/class/i2c-adapter/i2c-1/new_device

or:

echo bmp280 0x77 > /sys/class/i2c-adapter/i2c-1/new_device

This way, I have no error messages about interface scanning in the logs. But I still can’t interface with the sensor, and i2cdetect doesn’t recognize it, despite using -r switch (i2cdetect -y -r -a 1).

root@ap-unimatrix:~# echo bmp280 0x76 > /sys/class/i2c-adapter/i2c-1/new_device
root@ap-unimatrix:~# dmesg | tail -n 6
[Thu Mar 27 15:31:28 2025] bmp280 1-0076: supply vddd not found, using dummy regulator
[Thu Mar 27 15:31:28 2025] bmp280 1-0076: supply vdda not found, using dummy regulator
[Thu Mar 27 15:31:28 2025] bmp280 1-0076: GPIO lookup for consumer reset
[Thu Mar 27 15:31:28 2025] bmp280 1-0076: using lookup tables for GPIO lookup
[Thu Mar 27 15:31:28 2025] bmp280 1-0076: No GPIO consumer reset found
[Thu Mar 27 15:31:28 2025] i2c i2c-1: new_device: Instantiated device bmp280 at 0x76
root@ap-unimatrix:~# i2cdetect -y -r -a 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
root@ap-unimatrix:~# 

I interfaced my i2c display on i2c bus 2…not sure if it was i2c0 or 1 of SoC,but it was on gpio header.

Thanks. Will try as well. I also have to check wheter SD0 needs to be pulled through resistor. So far I omitted this.

OK, found my old 10k (1w, 1%) resistor strip, but it is degraded (I kept it in garden house over winter). So test of setting the address using pull-ups (as SD0 and CSB needs to be pulled apparently) have to wait for mid-week for new set to test it with. Someone also told me that for that price, I was supposed to order at least 10 pcs of this sensor, and maybe 5 would be working ;-( Nice.

Res: