dtoverlay=i2c-gpio for Le Potato?
I'm using i2c to talk to a sensor, but another peripheral is blocking the primary i2c pins. On my RPi3B+, I added this line to /boot/config.txt, which defines /dev/i2c-6 using the pins I want:
dtoverlay=i2c-gpio,bus=6,i2c_gpio_scl=9,i2c_gpio_sda=10
How can I port this configuration to Le Potato? `ldto enable i2c-b` sort-of works, but it hard-codes pins 27-28. I want to share the same pinout between RPi and LePotato, and everyone says to avoid pins 27-28 on RPi: "i2c-0 is NOT available for use from the ARM on Pi3. Bad things will happen if you try."
For reference, my code is at https://github.com/pmarks-net/exhale
dtoverlay=i2c-gpio,bus=6,i2c_gpio_scl=9,i2c_gpio_sda=10
How can I port this configuration to Le Potato? `ldto enable i2c-b` sort-of works, but it hard-codes pins 27-28. I want to share the same pinout between RPi and LePotato, and everyone says to avoid pins 27-28 on RPi: "i2c-0 is NOT available for use from the ARM on Pi3. Bad things will happen if you try."
For reference, my code is at https://github.com/pmarks-net/exhale
Comments
$ cat exhale/lepotato/i2c-exhale.dts
/*
Trying to emulate this RasPi config:
dtoverlay=i2c-gpio,bus=6,i2c_gpio_scl=9,i2c_gpio_sda=10
The bus=6 feature is RasPi-exclusive, so we'll have to discover the
correct bus number from /sys/devices/platform/i2c-exhale/i2c-*
How to install this:
git clone https://github.com/libre-computer-project/libretech-wiring-tool
cp -v exhale/lepotato/i2c-exhale.dts libretech-wiring-tool/libre-computer/aml-s905x-cc/dt/
cd libretech-wiring-tool
make
sudo ./ldto enable i2c-exhale # enable immediately
sudo ./ldto merge i2c-exhale # enable on boot
*/
/dts-v1/;
/plugin/;
#include <dt-bindings/gpio/gpio.h>
/ {
fragment@0 {
target-path = "/";
__overlay__ {
i2c_gpio: i2c-exhale {
compatible = "i2c-gpio";
/* Pin numbers from "lgpio header 7J1", Line column. */
gpios = <&gpio 87 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN) /* sda GPIOX_8 */
&gpio 88 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN) /* scl GPIOX 9 */
>;
/* SCL frequency is (500 / udelay) kHz */
i2c-gpio,delay-us = <10>; /* ~50 kHz */
#address-cells = <1>;
#size-cells = <0>;
};
};
};
};