A20-MICRO: connecting 1-Wire sensors

Started by bizdelnick, March 07, 2014, 10:39:35 AM

Previous topic - Next topic


I'm trying to get working DS1822 sensors (the same as DS18B20 but with additional thermostat feature, that I don't need currently). These sensors worked perfectly with RPi, but not with A20.
Well, what I have:
$ uname -a
Linux a20-micro 3.4.79+ #2 SMP PREEMPT Tue Mar 4 17:51:46 UTC 2014 armv7l GNU/Linux
$ zgrep W1 /proc/config.gz
# CONFIG_W1_MASTER_DS2490 is not set
# CONFIG_W1_MASTER_DS2482 is not set
# CONFIG_W1_MASTER_DS1WM is not set
# CONFIG_W1_SLAVE_SMEM is not set
# CONFIG_W1_SLAVE_DS2408 is not set
# CONFIG_W1_SLAVE_DS2423 is not set
# CONFIG_W1_SLAVE_DS2431 is not set
# CONFIG_W1_SLAVE_DS2433 is not set
# CONFIG_W1_SLAVE_DS2760 is not set
# CONFIG_W1_SLAVE_DS2780 is not set
# CONFIG_W1_SLAVE_DS2781 is not set
# CONFIG_W1_SLAVE_BQ27000 is not set

In script.fex I added
gpio = 15

(I also tried using pins 1 and 2.)
Sensor is connected as described here but with 5.6K pullup resistor.
Sometimes after doing
$ sudo modprobe w1_sunxi
$ sudo modprobe w1_gpio
$ sudo modprobe w1_therm

sensors appear under /sys/bus/w1/devices/, but not always:
$ ls /sys/bus/w1/devices/
22-000000343fa1  w1_bus_master1

22-000000343fa1 here is my sensor. It can disappear at any time for unknown reason and appear again some time later (if several sensors are connected, they appear and disappear together). Even if it present I can not get temperature value:
$ cat  /sys/bus/w1/devices/22-000000343fa1/w1_slave
00 00 00 00 00 00 00 00 00 : crc=00 NO
00 00 00 00 00 00 00 00 00 t=0

I tried to remove the pullup resistor as it seems that internal pullup is enabled by default
$ cat /sys/bus/w1/devices/w1_bus_master1/w1_master_pullup

The output changed a bit (NO was replaced by YES) and reading took a longer time (couple of seconds), but I did not get actual temperature value anyway:
$ cat  /sys/bus/w1/devices/22-000000343fa1/w1_slave
00 00 00 00 00 00 00 00 00 : crc=00 YES
00 00 00 00 00 00 00 00 00 t=0

Does anyone have a success story with 1-Wire devices and A20? I would appreciate any help.


I've faced quite the same issue recently trying to connect a DS18B20.
I couldn't figured out why it wasn't working, so, in the mean time of finding how to resolve that, I decided to use an I2C temp sensor instead, the SA56004, LM86 pin compatible, which has internal sensor plus external using a simple 2N3904.

So, if someone found a solution, that will be nice too.


Well, it seems impossible to get w1_gpio working on A20. So I bought DS2482 that solved my problem.



I think you must also change the config of the gpio-pin in the fex file. Did you try whats mentioned here:

This is just a guess, didn't try it myself.



Sorry to dig up an old thread but has there been any progress on this?
Did anyone get this working?

My LIME2 is on its way and connecting a few DS18B20 sensors would be nice.
If it's not working, what exactly is the blocking issue?


I'm interested in this too as these sensors are very practical and with Arduinos and RPI work like a charm.
I suspect it is just a matter of configuration.



I had similar problem but I solved it by raising the CPU clock to 528Mhz minimum. There are some strange things going on in the kernel:

1. The CPU clock is the same @60Mhz, 120MHz and 240MHz. Clock dividers are OK according to the A20 datasheet.
2. The  udelay call in kernel doesn't work as expected: 480uS delay varies from 1400 to 380uS depending on CPU speed.

These irregularities prevent the W1 drivers from working @ lower clock speeds.

I'm using kernel 3.4.102.




I had the exact same problem and found that it had to do with the pullup resistor.
Your data pin must be pulled-up for this to work. If you don't have a external pull-up, you could set the internal pull-up using '/dev/mem' approach. I did this, and the device was listed, and I was able to talk to it.


Did you build the kernel with W1 support or use the pre built ones ( I'm trying to speak to 1Wire devices using a A20-SOM but no progress so far )