circuitpython: Huzzah GPIO16 crash

I have a Feather Huzzah and a project which will require all of the pins . . . so I need to use GPIO16 as an input . . . but, when I use the following lines of code in a python program or type them into the REPL, the Huzzah crashes

import board
import digitalio
button = digitalio.DigitalInOut(board.GPIO16)

The output on the REPL shows

[code]Fatal exception 9(LoadStoreAlignmentCause):
epc1=0x4023a85f, epc2=0x00000000, epc3=0x00000000, excvaddr=0x000000fe, depc=0x00000000

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x40100000, len 30908, room 16
tail 12
chksum 0x44
ho 0 tail 12 room 4
load 0x3ffe8000, len 1084, room 12
tail 0
chksum 0xfa
load 0x3ffe8440, len 3248, room 8
tail 8
chksum 0x2f
csum 0x2f

I have tried this with Circuitpython 2.2.4 and 3.0.0, both of which crash. This should just work and is given in an example with the Featherwing OLED which connects button B to GPIO16 (along with a physical pull-up 100k resistor).

Has anyone else experienced/fixed this problem . . . or do I have a faulty board?

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 29 (5 by maintainers)

Most upvoted comments

Preliminary “Its Working” Update

I’ve got most of digitalio worked out I think. Will try to get the PR in tonight.

Test REPL:

Press any key to enter the REPL. Use CTRL-D to soft reset.

Adafruit CircuitPython 3.0.0-alpha.1-509-g58ba741-dirty on 2018-04-25; ESP module with ESP8266
>>> import time, board, digitalio
>>> b = digitalio.DigitalInOut(board.GPIO16)
>>> print(b.direction, ';', b.value)
digitalio.Direction.INPUT ; False
>>> b.direction = digitalio.Direction.OUTPUT
>>> print(b.direction, ';', b.value)
digitalio.Direction.OUTPUT ; False
>>> for i in range(5):
...     b.value = True
...     time.sleep(.5)
...     b.value = False
...     time.sleep(.5)
...
...
>>>

And result:

esp8266_gpio16_digitalinout_success

Want to do some re-reading before I test input.

You are clearly ahead of me. Carry on. 😃

If you need another Huzzah to hack on/destroy please order it on us.

And I have reproduced it on mine. I am convinced this is a CP bug. Now to find it! I have used OLED feather wings on esp8266s but I’m not sure if it was ever with CP. I’ll try to review this an see if I can find any clues to when GPIO16 became in issue. It also may be worth trying it under Arduino just to see if it works. It may be a day or two before I can get to this but I’m interested in following up on it.