Difference between revisions of "OneWire GPIO bus Master"

From ArmadeusWiki
Jump to: navigation, search
m
Line 1: Line 1:
Informations and HOWTOs for ArmadeuS OneWire support.  
+
Informations and HOWTOs for Armadeus OneWire support.  
  
Author: JanosA
+
Author: [[User:JanosA]]
 
+
 
+
== Supported Board and Software versions ==
+
* Use the latest Armadeus GIT/SF repository (the latest stable release Armadeus 5.2 don't have this patches)
+
* Currently only the APF28DEV board supported, but it's easy to add support to another boards. (Check linux-2.6.35.3/arch/arm/mach-mx28/apf28dev.c file)
+
  
 +
== Supported boards and software versions ==
 +
* Use the latest Armadeus GIT/SF repository or the latest stable release.
 +
* Currently only the [[APF28Dev]] board is upported, but it's easy to add support to another boards. (Check linux-2.6.35.3/arch/arm/mach-mx28/apf28dev.c file)
  
 
== Software installation ==
 
== Software installation ==
Line 26: Line 24:
 
</pre>
 
</pre>
 
* Reflash your Linux kernel
 
* Reflash your Linux kernel
 
  
 
== Hardware Notes ==
 
== Hardware Notes ==
Line 34: Line 31:
 
   * GND is pin 39 on J9
 
   * GND is pin 39 on J9
 
* Add an 1.2k pullup resistor between Vcc and DQ
 
* Add an 1.2k pullup resistor between Vcc and DQ
 
  
 
== How it works ==
 
== How it works ==

Revision as of 08:42, 7 January 2014

Informations and HOWTOs for Armadeus OneWire support.

Author: User:JanosA

Supported boards and software versions

  • Use the latest Armadeus GIT/SF repository or the latest stable release.
  • Currently only the APF28Dev board is upported, but it's easy to add support to another boards. (Check linux-2.6.35.3/arch/arm/mach-mx28/apf28dev.c file)

Software installation

  • Recompile your Linux kernel with OneWire GPIO bus master (and some slave device) support.
$ make linux-menuconfig
Device Drivers  --->
    <*> Dallas's 1-wire support  --->
        1-wire Bus Masters  --->
            <*> GPIO 1-wire busmaster
        1-wire Slaves  --->
            <*> Thermal family implementation
$ make
  • Reflash your Linux kernel

Hardware Notes

  • Connect the OneWire slave directly to the APF28_DEV board J9 connector:
 * Vcc 3.3V is pin 1 on J9 connector
 * DQ is pin 31 on J9 (LCD_D18 / GPIO 1_18)
 * GND is pin 39 on J9
  • Add an 1.2k pullup resistor between Vcc and DQ

How it works

The OneWire bus master driver every 10 seconds scan the bus for new slave devices.

Each detected OneWire slave device have a sub-directory with it's unique ID in "/sys/devices/w1 bus master".

The sub-directory format is <2 digit family ID>-<12 digit unique ID>.

# ls -la /sys/devices/w1\ bus\ master/
total 0
drwxr-xr-x    4 root     root             0 Jan  1 01:06 .
drwxr-xr-x    6 root     root             0 Jan  1 01:05 ..
drwxr-xr-x    3 root     root             0 Jan  1 01:06 28-000001e68904
lrwxrwxrwx    1 root     root             0 Jan  1 01:07 driver -> ../../bus/w1/drivers/w1_master_driver
drwxr-xr-x    2 root     root             0 Jan  1 01:07 power
lrwxrwxrwx    1 root     root             0 Jan  1 01:07 subsystem -> ../../bus/w1
-rw-r--r--    1 root     root          4096 Jan  1 01:07 uevent
-rw-rw-rw-    1 root     root          4096 Jan  1 01:07 w1_master_add
-r--r--r--    1 root     root          4096 Jan  1 01:07 w1_master_attempts
-r--r--r--    1 root     root          4096 Jan  1 01:07 w1_master_max_slave_count
-r--r--r--    1 root     root          4096 Jan  1 01:07 w1_master_name
-r--r--r--    1 root     root          4096 Jan  1 01:07 w1_master_pointer
-rw-rw-rw-    1 root     root          4096 Jan  1 01:07 w1_master_pullup
-rw-rw-rw-    1 root     root          4096 Jan  1 01:07 w1_master_remove
-rw-rw-rw-    1 root     root          4096 Jan  1 01:07 w1_master_search
-r--r--r--    1 root     root          4096 Jan  1 01:07 w1_master_slave_count
-r--r--r--    1 root     root          4096 Jan  1 01:07 w1_master_slaves
-r--r--r--    1 root     root          4096 Jan  1 01:07 w1_master_timeout

You can list the detected slaves from this files:

# cat /sys/devices/w1\ bus\ master/w1_master_slave_count
1
# cat /sys/devices/w1\ bus\ master/w1_master_slaves
28-000001e68904

Let's read the temperature: (The 28-xxx family is a DS18B20 temperature sensor in this example.)

# cat /sys/devices/w1\ bus\ master/28-000001e68904/w1_slave
dd 01 4b 46 7f ff 03 10 1e : crc=1e YES
dd 01 4b 46 7f ff 03 10 1e t=29812

The t=29812 means, the temperature is: 29.812°C