Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSError: [Errno 19] ENODEV on WeMos D1 Mini #1

Open
mcauser opened this issue Dec 14, 2016 · 4 comments
Open

OSError: [Errno 19] ENODEV on WeMos D1 Mini #1

mcauser opened this issue Dec 14, 2016 · 4 comments

Comments

@mcauser
Copy link

mcauser commented Dec 14, 2016

Thanks for the library! I'm going to use to to upgrade an old RC car with an ESP8266 and use this as the controller.

I am getting consistent OSError: [Errno 19] ENODEV errors when I use your library with MicroPython v1.8.6-172 on a WeMos D1 Mini v2.1.0

>>> from machine import Pin, I2C
>>> import time
>>> import nunchuck
>>> i2c = I2C(scl=Pin(5),sda=Pin(4),freq=100000)
>>> i2c.scan()
[82]
>>> nun = nunchuck.Nunchuck(i2c)
>>> print(nun.joystick_x(), nun.joystick_y())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "nunchuck.py", line 103, in joystick_y
  File "nunchuck.py", line 47, in __poll
  File "nunchuck.py", line 42, in update
OSError: [Errno 19] ENODEV

In def update(self):, I added a small delay, and now it's working reliably for me now.

def update(self):
    self.i2c.writeto(self.address, b'\x00')
    time.sleep_us(10)
    self.i2c.readfrom_into(self.address, self.buffer)
  • time.sleep_us(3) OSError 19s after 2-10 calls.
  • time.sleep_us(5) OSError 19s after 10-50 calls.
  • time.sleep_us(10) works consistently.

I am using one of these little Wiichuck adapters:

wiichuck

https://littlebirdelectronics.com.au/products/wiichuck-adapter

@kfricke
Copy link
Owner

kfricke commented Dec 14, 2016

TBH i have not yet had time to test this on my ESPs.

Thanks for this report and possible solution. 10 µs should not really harm in any way with I2C communication. i will try to dig for the dependency for your delay in the datasheet of the Nunchuck chip.

We hopefully will find a report including photos of your project on the µPy forum!?

@mcauser
Copy link
Author

mcauser commented Dec 14, 2016

Tested on two of my WeMos D1 Minis, V2 and V2.1.0 boards, also upgraded to MicroPython v1.8.6-183-ge8f2db7
I forgot the Nunchuk had an accelerometer. Win!

I'll be sure to document the build on the forum and share the code on my GitHub.

@jmeri
Copy link

jmeri commented Jul 12, 2017

Tested this code on an ESP-12E, and found out it was working only intermittently. Sometimes I could get readings, sometimes couldn't, and nunchuck_test was totally unusable. Then, I switched the I2C-bus to other pins than 4 and 5, and it worked like a charm! Pins 4 & 5 seem to be ok otherwise, haven't shown them to my scope yet...
Anyway, thank you fo the code!

@JonPenner
Copy link

ESP-01 running MicroPython v1.9.4, also had the 'OSError: [Errno 19] ENODEV' bug. I tried sleep_us values of 10 and 20 with no success. 50 makes it work, but I'm sure I can find a smaller number.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants