Unable to read/write to memory mcp23017

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
pequnio3
Posts: 5
Joined: Sun Feb 14, 2021 7:10 pm

Unable to read/write to memory mcp23017

Post by pequnio3 » Mon Feb 15, 2021 12:15 am

Hello,

I have a Feather Huzzah esp8266 connected to a cqrobot mcp23017 board. I am attempting to read/write the memory from the mcp, however it returns an error.

Code: Select all

from machine import Pin, I2C
i2c = I2C(scl=Pin(5), sda=Pin(4))
i2c.scan()
# output:
# [37]

i2c.readfrom_mem(37,0x00,1)

# Error 
# Traceback (most recent call last):
# File "<stdin>", line 1, in <module>
# OSError: [Errno 19] ENODEV

It also fails when I attempt a writeto_mem operation. Any ideas what is causing this?

Thank you!

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: Unable to read/write to memory mcp23017

Post by jimmo » Mon Feb 15, 2021 3:24 am

pequnio3 wrote:
Mon Feb 15, 2021 12:15 am
It also fails when I attempt a writeto_mem operation. Any ideas what is causing this?
The fact that you see it in the scan indicates that the pull-ups etc are correct, and the device is responding.

Perhaps it needs some configuration before you can access that register. Have you seen https://github.com/mcauser/micropython-mcp23017

pequnio3
Posts: 5
Joined: Sun Feb 14, 2021 7:10 pm

Re: Unable to read/write to memory mcp23017

Post by pequnio3 » Mon Feb 15, 2021 10:42 pm

Thats the library I was attempting to use with it however, just trying to initialize it got me the shown error, and I was able to trace it back to that readfrom_mem command. Could the device be malfunctioning in someway? I am using this dev board for it:

http://www.cqrobot.wiki/index.php/MCP23 ... sion_Board

Post Reply