onewire DS18B20 issue

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
Kaa
Posts: 1
Joined: Wed May 04, 2016 3:16 pm

onewire DS18B20 issue

Post by Kaa » Wed May 04, 2016 7:38 pm

I am trying to get the temperature sensor example from the tutorial to work and it seems there is a flaw with the pin attributes:

[code]
>>> import time, machine, onewire
>>> dat = machine.Pin(12)
>>> ds = onewire.DS18B20(onewire.OneWire(dat))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "onewire", line 16, in __init__
AttributeError: 'Pin' object has no attribute 'PULL_NONE'
>>> import port_diag
Flash ID: 1640e0 (Vendor: e0 Device: 4016)
Flash bootloader data:
Byte @2: 00
Byte @3: 40 (Flash size: 4MB Flash freq: 40MHZ)
[/code]

P.S.: I also seem to be unable to activate BBCode here in this forum.

victorclaessen
Posts: 7
Joined: Wed May 04, 2016 2:18 pm

Re: onewire DS18B20 issue

Post by victorclaessen » Wed May 04, 2016 9:57 pm

My board is a Witty Cloud board containing an ESP-12. I am having the exact same issue with the same output.

User avatar
platforma
Posts: 258
Joined: Thu May 28, 2015 5:08 pm
Location: Japan

Re: onewire DS18B20 issue

Post by platforma » Wed May 04, 2016 10:19 pm

I can confirm this also happens on my module:

Code: Select all

>>> import port_diag
Flash ID: 1640c8 (Vendor: c8 Device: 4016)
Flash bootloader data:
Byte @2: 00
Byte @3: 40 (Flash size: 4MB Flash freq: 40MHZ)
Creating the Pin with PULL_UP produces the same result:

Code: Select all

>>> dat = machine.Pin(12, machine.Pin.IN, machine.Pin.PULL_UP)
>>> ds = onewire.DS18B20(onewire.OneWire(dat))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "onewire", line 16, in __init__
AttributeError: 'Pin' object has no attribute 'PULL_NONE'
GPIO_PULL_NONE is indeed not in the pin dict table in modpybin.c:344
Which is called by onewire.py:63 in the constructor self.cache and in depower function in onewire.py:230.

victorclaessen
Posts: 7
Joined: Wed May 04, 2016 2:18 pm

Re: onewire DS18B20 issue

Post by victorclaessen » Sun May 08, 2016 10:13 pm

I built the firmware from source code (latest commit 65402ab1ec05fd552ceae63e2dcac69095ab1338) and now the error is gone. It appears to have been fixed in commit https://github.com/micropython/micropyt ... 48126ea4a0.

I am not allowed to attach .bin files, otherwise I would have posted the firmware file I built. Obviously it is better to build your own, but I can image people not wanting to spend time on that instead of on actually programming in micropython, which is more fun ;)

Post Reply