OS Error 16

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
Post Reply
nedla2004
Posts: 5
Joined: Sun Sep 06, 2015 12:33 am

OS Error 16

Post by nedla2004 » Sun Sep 18, 2016 9:15 pm

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.

User avatar
deshipu
Posts: 1347
Joined: Thu May 28, 2015 5:54 pm

Re: OS Error 16

Post by deshipu » Mon Sep 19, 2016 4:28 pm

What does "i2c.scan()" say?

nedla2004
Posts: 5
Joined: Sun Sep 06, 2015 12:33 am

Re: OS Error 16

Post by nedla2004 » Wed Sep 21, 2016 12:52 am

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.

User avatar
deshipu
Posts: 1347
Joined: Thu May 28, 2015 5:54 pm

Re: OS Error 16

Post by deshipu » Wed Sep 21, 2016 6:52 am

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?

nedla2004
Posts: 5
Joined: Sun Sep 06, 2015 12:33 am

Re: OS Error 16

Post by nedla2004 » Wed Sep 21, 2016 8:50 pm

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.

Post Reply