Beaglebone Black and MPC23017 PortExpander via I2C
See original GitHub issueI’m not able to access a MPC via I2C on the Beaglebone Black with the python3 circuitpython library. Beaglebone Black has 3x I2C Ports. 2x are accessable via header. The Pins are P9_17 SCL1 / P9_18 SDA1, and P9_19 SCL2 / P9_20 SDA1.
I want to use the MCP23017 Library to expand the GPIO of the Beaglebone with 2x different I2C-Ports. My first try was to detect simply just one and failed. This is how I want to access the MCP:
import board
import busio
from adafruit_mcp230xx.mcp23017 import MCP23017
i2c = busio.I2C(board.SCL, board.SDA)
mcp = MCP23017(i2c, address = 0x20) # MCP23017
I see the devices with i2cdetect -y -r 1
if i connect them with P9_17 / P9_18.
and with i2cdetect -y -r 2
if i connect them with P9_19 / P9_20.
i2detect -l
shows me all 3x ports.
i2c-1 i2c OMAP I2C adapter I2C adapter
i2c-2 i2c OMAP I2C adapter I2C adapter
i2c-0 i2c OMAP I2C adapter I2C adapter
My guessing, the standard board.SCL and board.SDA is pointing at the I2C Port which is not accessable over the P9 header:
ValueError: No I2C device at address: 20
Loading the Board-Pins I get following results:
>>> import board
>>> dir (board)
['CE0', 'CE1', 'I2C', 'LED_USR0', 'LED_USR1', 'LED_USR2', 'LED_USR3', 'MISO', 'MISO_1', 'MOSI', 'MOSI_1', 'P8_10', 'P8_11', 'P8_12', 'P8_13', 'P8_14', 'P8_15', 'P8_16', 'P8_17', 'P8_18', 'P8_19', 'P8_20', 'P8_21', 'P8_22', 'P8_23', 'P8_24', 'P8_25', 'P8_26', 'P8_27', 'P8_28', 'P8_29', 'P8_3', 'P8_30', 'P8_31', 'P8_32', 'P8_33', 'P8_34', 'P8_35', 'P8_36', 'P8_37', 'P8_38', 'P8_39', 'P8_4', 'P8_40', 'P8_41', 'P8_42', 'P8_43', 'P8_44', 'P8_45', 'P8_46', 'P8_5', 'P8_6', 'P8_7', 'P8_8', 'P8_9', 'P9_11', 'P9_12', 'P9_13', 'P9_14', 'P9_15', 'P9_16', 'P9_17', 'P9_18', 'P9_19', 'P9_20', 'P9_21', 'P9_22', 'P9_23', 'P9_24', 'P9_25', 'P9_26', 'P9_27', 'P9_28', 'P9_29', 'P9_30', 'P9_31', 'P9_41', 'P9_42', 'SCK', 'SCK_1', 'SCL', 'SCLK', 'SCLK_1', 'SDA', 'SPI', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'ap_board', 'board_id', 'detector', 'pin', 'sys']
>>>
Using the direct pin where my MPC is connected right now, I get following error:
ValueError: No Hardware I2C on (scl,sda)=(P9_19, P9_20)
Valid I2C ports: ((1, I2C1_SCL, I2C1_SDA), (2, I2C2_SCL, I2C2_SDA))
Tried P9_17 / P9_18 as well of course. Same result. Maybe I’m simply just using the wrong addressing of the pin? I tried some but couldn’t get it to work.
Please help!
Issue Analytics
- State:
- Created 3 years ago
- Comments:31 (1 by maintainers)
Top GitHub Comments
No problem - Take you’re time. I try to determent my problem with the fluctuating recognition of the MPC and its cause.
Berlin is very nice, good choice. The prices are very cheap for a huge city like that (except the flats 😉. But still not comparable with Munich. Awesome nightlife and a lot of things to do. Im living in germany too, more landscape like in the northern region of Bavaria near “Weiden in der Oberpfalz”. Welcome to Germany, I’m pretty sure you will like it here.
@pdp7 I dont know what to say, it works perfectly! I can’t thank you enough Drew. Thanks for all your efforts. Sorry for my hardware issue, I testet with just one MPC connected, but murphys law, it was exactly the damaged one out of ten. I should have tested one more. Additionally, I’m able to use both I2C for MPC23017s on the beaglebone black now, thanks alot!