LINUX 3.X 1-WIRE

本文介绍如何为DS28E01一维总线设备配置Linux内核驱动,包括修改设备树、内核配置及加载模块等步骤,并验证驱动是否正确安装。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

PLATFORM:LINUX 3.14 AM437X
Deivce:  ds28e01

1.设备树 

  STEP1:

    onewire {
            compatible      = "w1-gpio";
            pinctrl-names   = "default";
            pinctrl-0       = <&dallas_w1_pins>;
            status          = "okay";
            /* 1-wire test pin GPIO4_0*/
            gpios           = <&gpio4 0 0>;
            #if 0                
                /* enno 1-wire ds28e01 USB1_DRVVBUS.GPIO3_13*/
                gpios           = <&gpio3 13 0>;
            #endif         
    };
    
    STEP2:
    /* 1-wire test pin */
    dallas_w1_pins: pinmux_dallas_w1_pins {
        pinctrl-single,pins = <0x1B0 (PIN_INPUT | INPUT_EN | MUX_MODE7) >;/* AE17= GPIO4_0 = cam0_hd.GPIO4_0,MODE7 TLD437X TEST */  
    };
#if 0
    /* 1-wire ds28e01 USB1_DRVVBUS.GPIO3_13 */
    dallas_w1_pins: pinmux_dallas_w1_pins {
        pinctrl-single,pins = <0x2C4 (PIN_INPUT | INPUT_EN | MUX_MODE7) >;/* F25 = GPIO3_13/gpio0_25 = USB1_DRVVBUS.GPIO3_13, MODE7 not use*/  
    };
#endif     

2.修改步骤
  1.make menuconfig
     -> Device Drivers                                                    
         -> Dallas's 1-wire support                            
           -> 1-wire Bus Masters  

       < > Matrox G400 transport layer for 1-wire                         
     < > DS2490 USB <-> W1 transport layer for 1-wire                  
     < > Maxim DS2482 I2C to 1-Wire bridge                             
     < > Maxim DS1WM 1-wire busmaster                                  
     <M> GPIO 1-wire busmaster                                        
     < > OMAP HDQ driver  

    即.config
    CONFIG_W1_MASTER_GPIO=M
  2.修改kernel    
    路径:xxxx/kernel/drivers/w1/w1_family.h
    第40行添加:#define W1_FAMILY_DS28E01    0x2F    
    
    $insmod w1-gpio.ko
    $insmod w1_ds28e04.ko

3.确认挂载成功
    $cd /sys/bus/w1/devices
    $ls

note1:
    如果有设备,则挂载成功,/sys/bus/w1/devices文件下除了w1_bus_master1文件,还有其他的
    例如:2f-00000123e80e
    2f---------------->family   (2  Bytes)
    00000123e80e ----->id       (12 Bytes)
    如果没有相应family的驱动,则添加默认驱动
        *debug内核调试信息:w1_master_driver w1_bus_master1: Family 2f for 2f.00000123e80e.09 is not registered
        *解决方法:添加ds28e01 family的驱动,添加0x2f
    09---------------->crc      (2  Bytes)    
    2f.00000123e80e.09->1-wire 64 Bits地址
    
    
参考:

http://linux-sunxi.org/1-Wire
sha1加密驱动:
http://blog.youkuaiyun.com/wangjasonlinux/article/details/8993408







评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值