Page 1 of 1

OS Error 16

Posted: Sun Sep 18, 2016 9:15 pm
by nedla2004
When I run this code from the REPL:
>>> i2c = pyb.I2C(1, pyb.I2C.MASTER)
>>> i2c.mem_write(4, 90, 0x5e)
I get this error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: 16
I am trying to use the LCD buttons, and I have the LCD in correctly. Any help is appreciated.

Re: OS Error 16

Posted: Mon Sep 19, 2016 4:28 pm
by deshipu
What does "i2c.scan()" say?

Re: OS Error 16

Posted: Wed Sep 21, 2016 12:52 am
by nedla2004
deshipu wrote:What does "i2c.scan()" say?
When I run

Code: Select all

i2c.scan
I get

Code: Select all

[90]
, but now,

Code: Select all

i2c.mem_write(4, 90, 0x5e)
works fine, and

Code: Select all

i2c.mem_read(1, 90, 0)[0]
gives me

Code: Select all

OSError: 116
Thanks for your help.

Re: OS Error 16

Posted: Wed Sep 21, 2016 6:52 am
by deshipu
It's hard to be sure without using a logic analyzer, but it looks like the device is responding with a NACK to your write request. Are you sure it's the right register you are trying to write to, and the right value? What is the device in question exactly? Do you have a datasheet for it? Do you have a small complete working snippet of code that demonstrates the issue?

Re: OS Error 16

Posted: Wed Sep 21, 2016 8:50 pm
by nedla2004
I am using the standard LCD, and just following the tutorial, which can be found here: http://docs.micropython.org/en/latest/p ... _skin.html.