Jump to content

I2c no-driver BananaPi M1


Roland Sabata

Recommended Posts

Hello, I just started to use my old BananaPi M1  (Armbian 23.8 Bookworm) to check sensor values by onewire and i2c. At last there was no problem with onewire

 

But I cannot get I2c to work. 

 

 /boot/armbianEnv.txt

overlay_prefix=sun7i-a20
overlays=i2c2 w1-gpio
param_w1_pin=PI3

 

For onewire I had to define "param_w1_pin=PI3" even if my onewire sensor is connected to GPIO7. 

 

for I2C I checked "lsmod | grep i2c" but couldnt find anything. So ieven if it is not correctly activated, I could run "i2cdetect -y 2" and could find my sensor at 0x76 but couldnt communicate with it.

 

I think I need to load "i2c-bcm2708  i2c-dev". How can I get these to run?

 

Or do I have to define the i2c_pins like I did with param_w1_pin ?

 

 

Link to comment
Share on other sites

Hi Roland,

 

What is the name of the sensor that you using and how exactly are you trying to communicate with it via i2c? The Banana Pi M1 is based around the Allwinner A20 which is a completely different SOC to the Raspberry Pi so the i2c-bcm2708 driver will not be compatible. Seeming as i2cdetect works, this suggest that i2c-dev is indeed loaded, as far as I aware it simple under /dev for i2c devices such as /dev/i2c2 which would not exist if i2c-dev has not been loaded.  you can double check this by running sudo dmesg | grep i2c.

 

from my experience you should not need define the pins as this should already be declared in the i2c overlay. if you check the pin control configuration it should show that PB20 and PB21 that they are setup for i2c2. You find this by typing sudo cat /sys/kernel/debug/pinctrl/1c20800.pinctrl/pinmux-pins | grep i2c. the output should look like this:

 

pin 32 (PB0): 1c2ac00.i2c (GPIO UNCLAIMED) function i2c0 group PB0
pin 33 (PB1): 1c2ac00.i2c (GPIO UNCLAIMED) function i2c0 group PB1
pin 52 (PB20): 1c2b400.i2c (GPIO UNCLAIMED) function i2c2 group PB20
pin 53 (PB21): 1c2b400.i2c (GPIO UNCLAIMED) function i2c2 group PB21

 

Best of luck

 

Ryzer

Link to comment
Share on other sites

Hello Ryzer,

 

I tried serveral I2C Sensors. Finally I would like to operate the BME280 Sensor

 

I checked  "sudo dmesg | grep i2c"  and found:

[    2.000754] i2c_dev: i2c /dev entries driver
[    2.186279] axp20x-i2c 1-0034: AXP20x variant AXP209 found
[    2.187691] axp20x-i2c 1-0034: mask_invert=true is deprecated; please switch to unmask_base
[    2.201986] input: axp20x-pek as /devices/platform/soc/1c2ac00.i2c/i2c-1/1-0034/axp20x-pek/input/input0
[    2.213579] axp20x-i2c 1-0034: Backup (RTC) battery charging is disabled
[    2.213768] axp20x-i2c 1-0034: AXP20X driver loaded

sudo dmesg | grep i2c.

In /dev I found:

roland@bananapi:/dev$ ls -la  | grep i2c
crw-rw----  1 root i2c      89,   0  9. Nov 16:17 i2c-0
crw-rw----  1 root i2c      89,   1  9. Nov 16:17 i2c-1
crw-rw----  1 root i2c      89,   2  9. Nov 16:17 i2c-2
crw-rw----  1 root i2c      89,   3  9. Nov 16:17 i2c-3

. thats ok, because I activated all I2c Ports for testing.

 

with "cat /sys/kernel/debug/pinctrl/1c20800.pinctrl/pinmux-pins | grep i2c" . i get:

root@bananapi:~# cat /sys/kernel/debug/pinctrl/1c20800.pinctrl/pinmux-pins | grep i2c
pin 32 (PB0): 1c2ac00.i2c (GPIO UNCLAIMED) function i2c0 group PB0
pin 33 (PB1): 1c2ac00.i2c (GPIO UNCLAIMED) function i2c0 group PB1
pin 50 (PB18): 1c2b000.i2c (GPIO UNCLAIMED) function i2c1 group PB18
pin 51 (PB19): 1c2b000.i2c (GPIO UNCLAIMED) function i2c1 group PB19
pin 52 (PB20): 1c2b400.i2c (GPIO UNCLAIMED) function i2c2 group PB20
pin 53 (PB21): 1c2b400.i2c (GPIO UNCLAIMED) function i2c2 group PB21

 

But I dont understand the output of the last command. Wher e con I find pin53? The banana/rasp.Pi has only 40 pins??

Link to comment
Share on other sites

Hi Roland,

 

Ok it looks like I2C is being set up correctly but I would advise against activating all I2C interfaces at once, in case it leads to problems. As you identified earlier you only need to have I2C2 enabled. Could you please provide the code that you are trying to run to communicate with the BME280 or show what kind of error message you are getting. Unfortunately I don't have that sensor myself to test, I only have a BNO055 9 dof. So far I have had no major issues with I2C unless it has been broken by a recent kernel update. Pin 53 is the physical number on the SOC, not the board pin number on the board. for a more detailed description of the pin mapping see: https://linux-sunxi.org/GPIO as well as checking the schematic of the Banana Pi to see what pins are brought out.

 

Best of luck

 

Ryzer

Link to comment
Share on other sites

vor 12 Stunden schrieb Ryzer:

 

 

Hi, thaks for your help! Now it works. Dont know why, but today I found my sensor on  i2c3. Now I can get my sensor values with :

 

i2cdump -y 3 0x76
i2cset -y 3 0x76 0xf4 0x27
i2cdump -y 3 0x76


root@bananapi:/mnt/daten/image# i2cdump -y 3 0x76
No size specified (using byte-data access)
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
80: 8c 70 89 37 6c 0a fe 06 8a 6e 44 68 32 00 95 8d    ?p?7l????nDh2.??
90: b3 d6 d0 0b 7d 22 af ff f9 ff ac 26 0a d8 bd 10    ????}"?.?.?&????
a0: 00 4b 85 00 00 00 00 00 00 00 00 00 33 00 00 c0    .K?.........3..?
b0: 00 54 00 00 00 00 60 02 00 01 ff ff 1f 4e 08 00    .T....`?.?..?N?.
c0: 00 40 27 ff 00 00 00 00 00 00 00 00 00 00 00 00    .@'.............
d0: 60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    `...............
e0: 00 7c 01 00 11 25 03 1e f0 41 ff ff ff ff ff ff    .|?.?%???A......
f0: ff 00 00 0c 27 00 00 50 3e 00 7e 9e 00 80 00 80    ...?'..P>.~?.?.?

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines