您尚未登录。

楼主 #1 2018-04-03 10:43:02

小猪佩奇
会员
注册时间: 2018-03-19
已发帖子: 59
积分: 59

v3s在uboot中i2c上挂载AXP152

如题 v3s在uboot中i2c上如何挂载AXP152?有搞过的大神么,求指点,i2c probe后从设备地址为空。

=> i2c probe
Valid chip addresses:

离线

#2 2018-04-03 10:47:05

awfans
会员
注册时间: 2018-04-03
已发帖子: 264
积分: 264

Re: v3s在uboot中i2c上挂载AXP152

确定你在 u-boot的dts正确开启了i2c ?
如果开了, 你接逻辑分析仪, 看能不能抓到数据。

离线

#3 2018-04-03 10:48:53

awfans
会员
注册时间: 2018-04-03
已发帖子: 264
积分: 264

Re: v3s在uboot中i2c上挂载AXP152

不过我还是认为, 你用官方的SDK + 官方推荐的搭配(V3s + AXP203),
人生苦短,跟着官方走吧。淘宝有V3s + AXP203开发板, 如果觉得贵可以自己照着海豚派画板.

如果只是学习, 还是支持你自己折腾折腾的。

离线

楼主 #4 2018-04-03 10:54:44

小猪佩奇
会员
注册时间: 2018-03-19
已发帖子: 59
积分: 59

Re: v3s在uboot中i2c上挂载AXP152

你好大神 u-boot的dts代码如下:
sun8i-v3s-licheepi-zero.dts:
&i2c0 {
    pinctrl-names = "default";
    pinctrl-0 = <&i2c0_pins_a>;
    status = "okay";
   
    axp152: axp152@30 {
        pinctrl-names = "default";
        compatible = "x-powers,axp152";
        reg = <0x30>;   
        interrupt-parent=<&pio>;
        interrupts=<1 2 IRQ_TYPE_EDGE_FALLING>;
        interrupt-controller;
        status = "okay";       
    };
};

sun8i-v3s.dtsi
        pio: pinctrl@01c20800 {
            compatible = "allwinner,sun8i-v3s-pinctrl";
            reg = <0x01c20800 0x400>;
            interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>,
                     <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>;
            clocks = <&ccu CLK_BUS_PIO>, <&osc24M>, <&osc32k>;
            clock-names = "apb", "hosc", "losc";
            gpio-controller;
            #gpio-cells = <3>;
            interrupt-controller;
            #interrupt-cells = <3>;

            i2c0_pins_a: i2c0@0 {
                pins = "PB6", "PB7";
                function = "i2c0";
                allwinner,drive = <SUN4I_PINCTRL_10_MA>;
                allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
            };

        i2c0: i2c@01c2ac00 {
            compatible = "allwinner,sun6i-a31-i2c";
            reg = <0x01c2ac00 0x400>;
            interrupts = <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>;
            clocks = <&ccu CLK_BUS_I2C0>;
            resets = <&ccu RST_BUS_I2C0>;
            status = "disabled";
            #address-cells = <1>;
            #size-cells = <0>;
        };

awfans 说:

确定你在 u-boot的dts正确开启了i2c ?
如果开了, 你接逻辑分析仪, 看能不能抓到数据。

离线

#5 2018-04-03 11:17:55

awfans
会员
注册时间: 2018-04-03
已发帖子: 264
积分: 264

Re: v3s在uboot中i2c上挂载AXP152

有没有逻辑分析仪?

离线

楼主 #6 2018-04-03 11:28:21

小猪佩奇
会员
注册时间: 2018-03-19
已发帖子: 59
积分: 59

Re: v3s在uboot中i2c上挂载AXP152

有,我试试

awfans 说:

有没有逻辑分析仪?

离线

#7 2018-04-03 11:37:31

awfans
会员
注册时间: 2018-04-03
已发帖子: 264
积分: 264

Re: v3s在uboot中i2c上挂载AXP152

逻辑分析仪是调试神器哦

离线

楼主 #8 2018-04-03 14:34:54

小猪佩奇
会员
注册时间: 2018-03-19
已发帖子: 59
积分: 59

Re: v3s在uboot中i2c上挂载AXP152

没有数据,是不是我i2c没配置好,应该怎么配置啊~求指点

awfans 说:

确定你在 u-boot的dts正确开启了i2c ?
如果开了, 你接逻辑分析仪, 看能不能抓到数据。

离线

#9 2018-04-03 15:22:25

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,248
积分: 9197

Re: v3s在uboot中i2c上挂载AXP152

小猪佩奇 说:

没有数据,是不是我i2c没配置好,应该怎么配置啊~求指点

awfans 说:

确定你在 u-boot的dts正确开启了i2c ?
如果开了, 你接逻辑分析仪, 看能不能抓到数据。

引脚上拉了吗?





离线

楼主 #10 2018-04-03 15:42:46

小猪佩奇
会员
注册时间: 2018-03-19
已发帖子: 59
积分: 59

Re: v3s在uboot中i2c上挂载AXP152

上拉了。我看drivers/power/Kconfig 如下
choice
    prompt "Select Sunxi PMIC Variant"
    depends on ARCH_SUNXI
    default AXP209_POWER if MACH_SUN4I || MACH_SUN5I || MACH_SUN7I
    default AXP221_POWER if MACH_SUN6I || MACH_SUN8I_A23 || MACH_SUN8I_A33
    default AXP818_POWER if MACH_SUN8I_A83T
    default SUNXI_NO_PMIC if MACH_SUN8I_H3 || MACH_SUN50I

config SUNXI_NO_PMIC
    bool "board without a pmic"
    ---help---
    Select this for boards which do not use a PMIC.

config AXP152_POWER
    bool "axp152 pmic support"
    depends on MACH_SUN5I
    select CMD_POWEROFF
    ---help---
    Select this to enable support for the axp152 pmic found on most
    A10s boards.
问题是不是出在这?

晕哥 说:
小猪佩奇 说:

没有数据,是不是我i2c没配置好,应该怎么配置啊~求指点

awfans 说:

确定你在 u-boot的dts正确开启了i2c ?
如果开了, 你接逻辑分析仪, 看能不能抓到数据。

引脚上拉了吗?

离线

#11 2018-04-03 15:49:29

awfans
会员
注册时间: 2018-04-03
已发帖子: 264
积分: 264

Re: v3s在uboot中i2c上挂载AXP152

obj-$(CONFIG_AXP152_POWER)    += axp152.o

axp152有生成吗?

离线

楼主 #12 2018-04-03 15:57:38

小猪佩奇
会员
注册时间: 2018-03-19
已发帖子: 59
积分: 59

Re: v3s在uboot中i2c上挂载AXP152

没有,menuconfig默认选的是board without a pmic。
obj-$ choice
    prompt "Select Sunxi PMIC Variant"
    depends on ARCH_SUNXI
    default AXP209_POWER if MACH_SUN4I || MACH_SUN5I || MACH_SUN7I
    default AXP221_POWER if MACH_SUN6I || MACH_SUN8I_A23 || MACH_SUN8I_A33
    default AXP818_POWER if MACH_SUN8I_A83T
    default SUNXI_NO_PMIC if MACH_SUN8I_H3 || MACH_SUN50I
没有匹配上AXP152,我加上的话 有AXP152生成 但是编译报错

awfans 说:

obj-$(CONFIG_AXP152_POWER)    += axp152.o

axp152有生成吗?

离线

#13 2018-04-03 16:07:24

awfans
会员
注册时间: 2018-04-03
已发帖子: 264
积分: 264

Re: v3s在uboot中i2c上挂载AXP152

可以把错误贴上来

离线

楼主 #14 2018-04-03 16:47:41

小猪佩奇
会员
注册时间: 2018-03-19
已发帖子: 59
积分: 59

Re: v3s在uboot中i2c上挂载AXP152

错误如下:
arch/arm/mach-sunxi/built-in.o: In function `pmic_bus_read':
/home/z/v3s/u-boot/arch/arm/mach-sunxi/pmic_bus.c:62: undefined reference to `i2c_read'
arch/arm/mach-sunxi/built-in.o: In function `pmic_bus_write':
/home/z/v3s/u-boot/arch/arm/mach-sunxi/pmic_bus.c:77: undefined reference to `i2c_write'
scripts/Makefile.spl:288: recipe for target 'spl/u-boot-spl' failed
make[1]: *** [spl/u-boot-spl] Error 1
Makefile:1319: recipe for target 'spl/u-boot-spl' failed
make: *** [spl/u-boot-spl] Error 2
感觉是我menuconfig配置问题

awfans 说:

可以把错误贴上来

离线

#15 2018-04-03 17:09:10

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,248
积分: 9197

Re: v3s在uboot中i2c上挂载AXP152

https://github.com/linux-sunxi/u-boot-sunxi/issues/95

Download again the config file, it has been updated.
CONFIG_SPL_I2C_SUPPORT=y has to be added.

手动改下 .config 试一试





离线

#16 2018-04-03 17:10:38

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,248
积分: 9197

离线

页脚

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

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