Neno8080 Posted December 11, 2022 Posted December 11, 2022 PRETTY_NAME="Armbian 22.08.7 Bullseye" NAME="Debian GNU/Linux" VERSION_ID="11" VERSION="11 (bullseye)" VERSION_CODENAME=bullseye ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/" Hello everyone and thanks for accepting me in the forum. I recently bought a banana pi M5, intalled armbian but i can't use i2c, I tried to enable i2cA and i2cB from armbian-config without success. I have also tested numerous dts files with no success. Can anyone help me with this? Thank you. 0 Quote
Werner Posted December 11, 2022 Posted December 11, 2022 Providing logs with armbianmonitor -u helps with troubleshooting and significantly raises chances that issue gets addressed. 0 Quote
Igor Posted December 11, 2022 Posted December 11, 2022 6 hours ago, Stefano Castegnaro said: Can anyone help me with this? This is your lucky day Two weeks ago one company approached to us with the same plead. Once the deal is done and they pay the bill, this will start working. 0 Quote
Neno8080 Posted December 11, 2022 Author Posted December 11, 2022 I didn't know about these ways of contributing. Thank you 0 Quote
atone Posted December 22, 2022 Posted December 22, 2022 Hello, I've exactly the same issue as @Neno8080 I've uploaded the logs to https://paste.armbian.com/ajazisoyox Thank you for your help! Kind regards 0 Quote
atone Posted December 23, 2022 Posted December 23, 2022 I think I managed to activate the i2c interfaces using user-overlays, here's what I've done. I'm a beginner, so thank you for correcting me or explaining what I could have done better. The i2c slave device is not answering yet, but it's maybe unrelated. I've found two i2c overlays under /boot/dtb/amlogic/overlay that seem to match with the i2c devices listed by armbian-config and mentioned by @Neno8080: meson-i2cA.dtbo meson-i2cB.dtbo The output of dtc -I dtb -O dts /boot/dtb/amlogic/overlay/meson-i2cA.dtbo is: /dts-v1/; / { compatible = "amlogic,meson-gxbb"; fragment@0 { target-path = "/aliases"; __overlay__ { i2cA = "/soc/bus@c1100000/i2c@8500"; }; }; fragment@1 { target-path = "/soc/bus@c1100000/i2c@8500"; __overlay__ { status = "okay"; }; }; }; And of /boot/dtb/amlogic/overlay/meson-i2cB.dtbo: /dts-v1/; / { compatible = "amlogic,meson-gxbb"; fragment@0 { target-path = "/aliases"; __overlay__ { i2cA = "/soc/bus@c1100000/i2c@87c0"; }; }; fragment@1 { target-path = "/soc/bus@c1100000/i2c@87c0"; __overlay__ { status = "okay"; }; }; }; I wanted to compare it with the actual device tree, so I decompiled /boot/dtb/amlogic/meson-sm1-bananapi-m5.dtb (which seemed right to me) using dtc -I dtb -O dts /boot/dtb/amlogic/meson-sm1-bananapi-m5.dtb > meson-sm1-bananapi-m5.dts I figured out that the symbols for the i2c devices (at the end of the dts file) are different from the above mentioned overlays: i2c3 = "/soc/bus@ffd00000/i2c@1c000"; i2c2 = "/soc/bus@ffd00000/i2c@1d000"; i2c1 = "/soc/bus@ffd00000/i2c@1e000"; i2c0 = "/soc/bus@ffd00000/i2c@1f000"; Activating them with /boot/armbianEnv.txt didn't worked, so I tried using user-overlays. I created i.e. meson-i2c0.dts with the following content: /dts-v1/; / { compatible = "amlogic,meson-axg-i2c"; fragment@0 { target-path = "/soc/bus@ffd00000/i2c@1f000"; __overlay__ { status = "okay"; }; }; }; Same for i2c1, i2c2 and i2c3. And installed them using: sudo armbian-add-overlay meson-i2c0.dts Now if I run sudo i2cdetect -l I got: i2c-3 i2c Meson I2C adapter I2C adapter i2c-1 i2c Meson I2C adapter I2C adapter i2c-4 i2c DesignWare HDMI I2C adapter i2c-2 i2c Meson I2C adapter I2C adapter i2c-0 i2c Meson I2C adapter I2C adapter and querying one of them with i2cdetect -y 0 (i.e.) gives: 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- -- Which is fine to this point, right? I have some spare time in the next few days and willing to contribute on this matter. Thank you to tell me how. 0 Quote
atone Posted January 11, 2023 Posted January 11, 2023 @Igor I tried with latest image, the behavior is still exactly the same as above. Was my proceeding correct? i2c slave still doesn't answer. On other board (BPi M2 Zero) it answers as expected. On BPi M5 it's connected to the pins 3 (CON1-P03/GPIOX_17/I2C_M2_SDA) and 5 (CON1-P05/GPIOX_18/I2C_M2_SCL). Although I analized the meson-sm1-bananapi-m5.dts, I don't understand if it supposed to be i2c0, i2c1, i2c2 or i2c3. But all 4 doesn't answer, so there's maybe an error in the dts. Edit: The electrician doublechecked the wirings, he says that it should be fine. 0 Quote
atone Posted January 12, 2023 Posted January 12, 2023 Could it be that kernel configuration must be adjusted? Here's the output of "cat /boot/config-6.1.4-meson64 | grep -i i2c": CONFIG_NFC_FDP_I2C=m CONFIG_NFC_PN544_I2C=m CONFIG_NFC_PN533_I2C=m CONFIG_NFC_MICROREAD_I2C=m CONFIG_NFC_MRVL_I2C=m CONFIG_NFC_ST21NFCA_I2C=m CONFIG_NFC_ST_NCI_I2C=m CONFIG_NFC_NXP_NCI_I2C=m CONFIG_NFC_S3FWRN5_I2C=m CONFIG_REGMAP_I2C=y # CONFIG_SENSORS_LIS3_I2C is not set CONFIG_NET_DSA_MICROCHIP_KSZ9477_I2C=m CONFIG_NET_DSA_XRS700X_I2C=m CONFIG_NET_DSA_SMSC_LAN9303_I2C=m CONFIG_MCTP_TRANSPORT_I2C=m CONFIG_MDIO_I2C=m # CONFIG_MOUSE_ELAN_I2C is not set # CONFIG_MOUSE_SYNAPTICS_I2C is not set CONFIG_TOUCHSCREEN_AD7879_I2C=m CONFIG_TOUCHSCREEN_AR1021_I2C=m # CONFIG_TOUCHSCREEN_WACOM_I2C is not set # CONFIG_TOUCHSCREEN_WDT87XX_I2C is not set CONFIG_TOUCHSCREEN_SIS_I2C=m CONFIG_RMI4_I2C=m CONFIG_SERIAL_SC16IS7XX_I2C=y CONFIG_TCG_TIS_I2C=m CONFIG_TCG_TIS_I2C_CR50=m CONFIG_TCG_TIS_I2C_ATMEL=m CONFIG_TCG_TIS_I2C_INFINEON=m CONFIG_TCG_TIS_I2C_NUVOTON=m CONFIG_TCG_TIS_ST33ZP24_I2C=m # I2C support CONFIG_I2C=y CONFIG_ACPI_I2C_OPREGION=y CONFIG_I2C_BOARDINFO=y CONFIG_I2C_COMPAT=y CONFIG_I2C_CHARDEV=y CONFIG_I2C_MUX=m # Multiplexer I2C Chip support CONFIG_I2C_ARB_GPIO_CHALLENGE=m CONFIG_I2C_MUX_GPIO=m CONFIG_I2C_MUX_GPMUX=m CONFIG_I2C_MUX_LTC4306=m CONFIG_I2C_MUX_PCA9541=m CONFIG_I2C_MUX_PCA954x=m CONFIG_I2C_MUX_PINCTRL=m CONFIG_I2C_MUX_REG=m CONFIG_I2C_DEMUX_PINCTRL=m CONFIG_I2C_MUX_MLXCPLD=m # end of Multiplexer I2C Chip support CONFIG_I2C_HELPER_AUTO=y CONFIG_I2C_SMBUS=m CONFIG_I2C_ALGOBIT=y CONFIG_I2C_ALGOPCA=m # I2C Hardware Bus support CONFIG_I2C_CCGX_UCSI=m CONFIG_I2C_ALI1535=m CONFIG_I2C_ALI1563=m CONFIG_I2C_ALI15X3=m CONFIG_I2C_AMD756=m CONFIG_I2C_AMD8111=m CONFIG_I2C_AMD_MP2=m CONFIG_I2C_I801=m CONFIG_I2C_ISCH=m CONFIG_I2C_PIIX4=m CONFIG_I2C_NFORCE2=m CONFIG_I2C_NVIDIA_GPU=m CONFIG_I2C_SIS5595=m CONFIG_I2C_SIS630=m CONFIG_I2C_SIS96X=m CONFIG_I2C_VIA=m CONFIG_I2C_VIAPRO=m CONFIG_I2C_SCMI=m # I2C system bus drivers (mostly embedded / system-on-chip) CONFIG_I2C_CADENCE=m CONFIG_I2C_CBUS_GPIO=m CONFIG_I2C_DESIGNWARE_CORE=m # CONFIG_I2C_DESIGNWARE_SLAVE is not set CONFIG_I2C_DESIGNWARE_PLATFORM=m CONFIG_I2C_DESIGNWARE_PCI=m # CONFIG_I2C_EMEV2 is not set CONFIG_I2C_GPIO=m # CONFIG_I2C_GPIO_FAULT_INJECTOR is not set CONFIG_I2C_HISI=m CONFIG_I2C_KEMPLD=m CONFIG_I2C_MESON=y # CONFIG_I2C_NOMADIK is not set CONFIG_I2C_OCORES=m CONFIG_I2C_PCA_PLATFORM=m CONFIG_I2C_RK3X=y CONFIG_I2C_SIMTEC=m CONFIG_I2C_THUNDERX=m CONFIG_I2C_XILINX=m # External I2C/SMBus adapter drivers CONFIG_I2C_DIOLAN_U2C=m CONFIG_I2C_DLN2=m CONFIG_I2C_CP2615=m CONFIG_I2C_PCI1XXXX=m CONFIG_I2C_ROBOTFUZZ_OSIF=m CONFIG_I2C_TAOS_EVM=m CONFIG_I2C_TINY_USB=m CONFIG_I2C_VIPERBOARD=m # Other I2C/SMBus bus drivers CONFIG_I2C_CROS_EC_TUNNEL=y CONFIG_I2C_VIRTIO=m # end of I2C Hardware Bus support CONFIG_I2C_STUB=m CONFIG_I2C_SLAVE=y CONFIG_I2C_SLAVE_EEPROM=m CONFIG_I2C_SLAVE_TESTUNIT=m # CONFIG_I2C_DEBUG_CORE is not set # CONFIG_I2C_DEBUG_ALGO is not set # CONFIG_I2C_DEBUG_BUS is not set # end of I2C support CONFIG_PINCTRL_MCP23S08_I2C=m # I2C GPIO expanders # end of I2C GPIO expanders CONFIG_BATTERY_BQ27XXX_I2C=m CONFIG_SENSORS_LTC2947_I2C=m CONFIG_SENSORS_NCT6775_I2C=m CONFIG_SENSORS_OCC_P8_I2C=m CONFIG_MFD_AXP20X_I2C=m CONFIG_MFD_MADERA_I2C=m CONFIG_MFD_DA9052_I2C=y CONFIG_MFD_MC13XXX_I2C=m CONFIG_HTC_I2CPLD=y CONFIG_MFD_SIMPLE_MFD_I2C=m CONFIG_MFD_TPS65912_I2C=y CONFIG_MFD_ARIZONA_I2C=m CONFIG_MFD_WM831X_I2C=y CONFIG_MFD_WM8350_I2C=y CONFIG_MFD_ATC260X_I2C=m CONFIG_MFD_RSMU_I2C=m CONFIG_VIDEO_V4L2_I2C=y CONFIG_I2C_SI470X=m CONFIG_I2C_SI4713=m # IR I2C driver auto-selected by 'Autoselect ancillary drivers' CONFIG_VIDEO_IR_I2C=m CONFIG_VIDEO_I2C=m # I2C encoder or helper chips CONFIG_DRM_I2C_CH7006=m CONFIG_DRM_I2C_SIL164=m # CONFIG_DRM_I2C_NXP_TDA998X is not set CONFIG_DRM_I2C_NXP_TDA9950=m # end of I2C encoder or helper chips # CONFIG_DRM_I2C_ADV7511 is not set CONFIG_DRM_SSD130X_I2C=m CONFIG_SND_HDA_SCODEC_CS35L41_I2C=m CONFIG_SND_SOC_I2C_AND_SPI=m CONFIG_SND_SOC_ADAU1372_I2C=m CONFIG_SND_SOC_ADAU1761_I2C=m CONFIG_SND_SOC_ADAU7118_I2C=m CONFIG_SND_SOC_CS35L41_I2C=m CONFIG_SND_SOC_CS35L45_I2C=m CONFIG_SND_SOC_CS42L51_I2C=m CONFIG_SND_SOC_CS4271_I2C=m CONFIG_SND_SOC_CS42XX8_I2C=m CONFIG_SND_SOC_ES8328_I2C=m CONFIG_SND_SOC_MAX98373_I2C=m CONFIG_SND_SOC_PCM1789_I2C=m CONFIG_SND_SOC_PCM179X_I2C=m CONFIG_SND_SOC_PCM186X_I2C=m CONFIG_SND_SOC_PCM3060_I2C=m CONFIG_SND_SOC_PCM3168A_I2C=m CONFIG_SND_SOC_PCM512x_I2C=m CONFIG_SND_SOC_SIGMADSP_I2C=m CONFIG_SND_SOC_SRC4XXX_I2C=m CONFIG_SND_SOC_SSM2602_I2C=m CONFIG_SND_SOC_TLV320AIC23_I2C=m CONFIG_SND_SOC_TLV320AIC32X4_I2C=m CONFIG_SND_SOC_TLV320AIC3X_I2C=m CONFIG_SND_SOC_WM8731_I2C=m CONFIG_SND_SOC_WM8804_I2C=m # I2C HID support CONFIG_I2C_HID_ACPI=m CONFIG_I2C_HID_OF=m CONFIG_I2C_HID_OF_ELAN=m CONFIG_I2C_HID_OF_GOODIX=m # end of I2C HID support CONFIG_I2C_HID_CORE=m # I2C RTC drivers CONFIG_RTC_I2C_AND_SPI=y # SPI and I2C RTC drivers # CONFIG_MOST_I2C is not set # CONFIG_CROS_EC_I2C is not set CONFIG_ADXL313_I2C=m CONFIG_ADXL345_I2C=m CONFIG_ADXL355_I2C=m CONFIG_ADXL367_I2C=m CONFIG_ADXL372_I2C=m CONFIG_BMA400_I2C=m CONFIG_BMC150_ACCEL_I2C=m CONFIG_FXLS8962AF_I2C=m CONFIG_IIO_ST_ACCEL_I2C_3AXIS=m CONFIG_KXSD9_I2C=m CONFIG_MMA7455_I2C=m CONFIG_BME680_I2C=m CONFIG_SCD30_I2C=m CONFIG_SPS30_I2C=m CONFIG_IIO_MS_SENSORS_I2C=m CONFIG_IIO_ST_SENSORS_I2C=m CONFIG_AD5696_I2C=m CONFIG_BMG160_I2C=m CONFIG_FXAS21002C_I2C=m CONFIG_MPU3050_I2C=m CONFIG_IIO_ST_GYRO_I2C_3AXIS=m CONFIG_HTS221_I2C=m # CONFIG_BMI160_I2C is not set CONFIG_BOSCH_BNO055_I2C=m CONFIG_FXOS8700_I2C=m CONFIG_INV_ICM42600_I2C=m # CONFIG_INV_MPU6050_I2C is not set CONFIG_IIO_ST_LSM9DS0_I2C=m CONFIG_ST_UVIS25_I2C=m CONFIG_BMC150_MAGN_I2C=m CONFIG_IIO_ST_MAGN_I2C_3AXIS=m CONFIG_SENSORS_HMC5843_I2C=m CONFIG_SENSORS_RM3100_I2C=m CONFIG_BMP280_I2C=m # CONFIG_MPL115_I2C is not set CONFIG_VL53L0X_I2C=m CONFIG_CRYPTO_DEV_ATMEL_I2C=m Particularly following lines are concerning: CONFIG_I2C_MUX=m CONFIG_I2C_MUX_GPIO=m CONFIG_I2C_GPIO=m Would it explain the behavior in my precedent post? And don't know if there are other important missing configurations. Do I have to build the complete image to test? Or can I build the kernel locally? I would really, really appreciate some hints as I have no experience with Linux, Kernel building, etc. Mux are used for I2C in DT. From meson-sm1-bananapim5.dts: i2c0-sda-c { phandle = <0x63>; mux { groups = "i2c0_sda_c"; function = "i2c0"; bias-disable; drive-strength-microamp = <0xbb8>; }; }; i2c0-sck-c { phandle = <0x64>; mux { groups = "i2c0_sck_c"; function = "i2c0"; bias-disable; drive-strength-microamp = <0xbb8>; }; }; Here's the complete meson-sm1-bananapi-m5.dts Thank you for your help, really appreciate. 0 Quote
atone Posted January 12, 2023 Posted January 12, 2023 I also noticed that the pins for the i2c busses are not set in the DT. At the end of the meson-sm1-bananapi-m5.dts following symbols are defined but never used: i2c0_sda_c_pins = "/soc/bus@ff600000/bus@34400/pinctrl@40/i2c0-sda-c"; i2c0_sck_c_pins = "/soc/bus@ff600000/bus@34400/pinctrl@40/i2c0-sck-c"; i2c0_sda_z0_pins = "/soc/bus@ff600000/bus@34400/pinctrl@40/i2c0-sda-z0"; i2c0_sck_z1_pins = "/soc/bus@ff600000/bus@34400/pinctrl@40/i2c0-sck-z1"; i2c0_sda_z7_pins = "/soc/bus@ff600000/bus@34400/pinctrl@40/i2c0-sda-z7"; i2c0_sck_z8_pins = "/soc/bus@ff600000/bus@34400/pinctrl@40/i2c0-sck-z8"; ... And this is the definition of a i2c bus: i2c@1c000 { compatible = "amlogic,meson-axg-i2c"; status = "disabled"; reg = <0x00 0x1c000 0x00 0x20>; interrupts = <0x00 0x27 0x01>; #address-cells = <0x01>; #size-cells = <0x00>; clocks = <0x02 0x18>; phandle = <0x121>; }; If I compare to these patches here or here and to the documentation, seems to me that the link between busses and pins (pinctrl-0, pinctrl-names / scl-gpios, sda-gpios) is missing. I really would appreciate a feedback, because I've really no idea if I'm looking in the right direction and if what I'm saying makes sense. 0 Quote
micsa Posted February 24, 2023 Posted February 24, 2023 well, I struggled a little bit with these i2c dts files, too, but it didn't work... so, I created a dts file with software i2c (i2c-gpio) for my hardware rtc i2c module: // Overlay for i2c_gpio bitbanging host bus. /dts-v1/; /plugin/; / { compatible = "amlogic,meson-gxbb"; fragment@0 { target-path = "/"; __overlay__ { i2c_gpio: i2c@2 { compatible = "i2c-gpio"; gpios = <&gpio 82 0 /* sda */ &gpio 83 0 /* scl */ >; i2c-gpio,delay-us = <2>; /* ~100 kHz */ #address-cells = <1>; #size-cells = <0>; ds3231: rtc@68 { status = "okay"; compatible = "ds3231"; reg = <0x68>; }; }; }; }; }; according to gpioinfo and the banana pi m5 wiki, the CON1-P03 is the I2C_M2_SDA and CON1-P05 is the I2C_M2_SCL. line 81: "CON1-P26" unused input active-high line 82: "CON1-P03" unused input active-high line 83: "CON1-P05" unused input active-high line 84: "CON1-P32" unused input active-high After this, I have: root@bpim5:~# i2cdetect -l i2c-0 i2c DesignWare HDMI I2C adapter i2c-1 i2c i2c@2 I2C adapter root@bpim5:~# i2cdetect -y 1 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- -- (the UU was 0x68, but it's currently used by the rtc module) so, when I load the rtc_ds1307.ko kernel module, it automatically detects the device and the /dev/rtc1 appears... 1 Quote
Hammerill Posted April 23 Posted April 23 Thank you so much Micsa! This config really "just" worked for me. Now Banana Pi detects either my DS3231 or DS1307 clock. 0 Quote
Recommended Posts
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.