您尚未登录。

#1 Re: 全志 SOC » v3s怎么实现模拟i2c---荔枝派 » 2025-07-31 22:10:34

@海石生风
暂时告一段落 谢谢大佬

#2 Re: 全志 SOC » v3s怎么实现模拟i2c---荔枝派 » 2025-07-30 14:07:50

qxxz 说:
林34 说:

v3s怎么实现模拟i2c,使用linux-5.2-y内核,勾选了 <*> GPIO-based bitbanging I2C           
设备树怎么写?

有没有大佬分享一下

上面有完整的了

#3 Re: 全志 SOC » v3s怎么实现模拟i2c---荔枝派 » 2025-07-30 14:07:34

使用硬件的i2c,挂载设备后,偶尔会出现i2c i2c-0: mv64xxx: I2C bus locked, block: 1, time_left: 0导致控制设备失败,所以才想使用模拟i2c。

#4 Re: 全志 SOC » v3s怎么实现模拟i2c---荔枝派 » 2025-07-30 11:25:52

@海石生风
修改后:
i2c_gpio0: i2c-gpio-0 {
            compatible = "i2c-gpio";
            sda-gpios = <&pio 2 2 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
            scl-gpios = <&pio 2 3 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
            i2c-gpio,delay-us = <5>;  //100khz
            #address-cells = <1>;
            #size-cells = <0>;
            status = "okay";
        };
在板子上运行查看日志:
root@licheepiw:/#: dmesg | grep i2c
[    0.036596] i2c-gpio soc:i2c-gpio-0: error trying to get descriptor: -2
[    1.110930] i2c /dev entries driver
[    1.274979] i2c-gpio soc:i2c-gpio-0: using lines 66 (SDA) and 67 (SCL)
设备下也出现了该i2c
root@licheepiw:/#: ls /dev/i
i2c-0   i2c-1   input/
使用i2cdetect -y 1命令查看总线上的设备,发现相较于硬件i2c读取的很慢,(不是设置了100khz了吗)
查看日志发现的错误:
    i2c-gpio soc:i2c-gpio-0: error trying to get descriptor: -2
是i2c-gpio-0没定义吗,要咋定义呀

#5 Re: 全志 SOC » v3s怎么实现模拟i2c---荔枝派 » 2025-07-29 12:50:19

海石生风 说:

源码目录的文档:Documentation/devicetree/bindings/i2c/i2c-gpio.yaml
或在线内核文档:https://www.kernel.org/doc/Documentation/devicetree/bindings/i2c/i2c-gpio.txt

sun8i-v3s.dtsi:516-523
        i2c3_gpio: i2c3_gpio{
            sda-gpios = <&pioC 2 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
            scl-gpios = <&pioC 3 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
            i2c-gpio,delay-us = <2>;  //100khz
            #address-cells = <1>;
            #size-cells = <0>;
            status = "okay";
        };

我这样配置设备树之后:make dtbs
DTC     arch/arm/boot/dts/sun8i-v3s-licheepi-zero.dtb
Error: arch/arm/boot/dts/sun8i-v3s.dtsi:517.26-27 syntax error
FATAL ERROR: Unable to parse input tree
make[2]: *** [arch/arm/boot/dts/sun8i-v3s-licheepi-zero.dtb] 错误 1
make[1]: *** [dtbs] 错误 2
编译显示sda-gpios = <&pioC 2 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;这行配置有错

make: *** [sub-make] 错误 2

#6 全志 SOC » v3s怎么实现模拟i2c---荔枝派 » 2025-07-23 15:45:00

林34
回复: 12

v3s怎么实现模拟i2c,使用linux-5.2-y内核,勾选了 <*> GPIO-based bitbanging I2C           
设备树怎么写?

#7 全志 SOC » 荔枝派zero通过otg与PC共享网络无法实现 麻了 » 2025-06-06 10:47:38

林34
回复: 1

按照 https://wiki.sipeed.com/soft/Lichee/zh/Zero-Doc/application/otg2PC.html 的教程,编译了内核并烧录进了tf卡,使用串口进行调试发现没有usb0
网卡,通过usb接入电脑,电脑也未显示任何设备接入(使用的是git clone -b zero-5.2.y --depth 1 https://github.com/Lichee-Pi/linux.git
的内核)
晕晕晕

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn