bbcmicrobit / micropython

Port of MicroPython for the BBC micro:bit
https://microbit-micropython.readthedocs.io
Other
603 stars 284 forks source link

pin 16 is mal-configured after a Ctrl-D soft reboot in REPL #642

Closed rhubarbdog closed 5 years ago

rhubarbdog commented 5 years ago

when I switch on my microbit pin 16 is configured as write digital logic level 0 at least that's what my logic level analysis is showing (I'm using 2 LEDs wired as follows) logic_level

When i crash into my program (which doesn't use pin16) by pressing Ctrl-C in a REPL session and type pin16.read_digital() it returns 0, but you can observe the effect of the PULL_DOWN resistor as the blue LED dims.

If I press the reset button on the back of the microbit or issue command microbit.reset() in a REPL session. pin16 becomes a .write_digital(0) pin and the pin usage table in software is correctly updated. As when I crash into my program pin16.read_digital() causes the PULL_DOWN resistors to be switched in on and the pin is now configured as a .read_digital() pin

If in a REPL session I reset the the microbit with Ctrl-D the pin physically becomes a .write_digial(0) pin. but the pin usage matrix isn't correctly updated because when i crash the program pressing Ctrl-C and type pin16.read_digital() the PULL_DOWN resistor hasn't been switched on and the pin is still configured as a write pin.

dpgeorge commented 5 years ago

Can you please elaborate what "mal-configured" means in this case?

rhubarbdog commented 5 years ago

hi sorry about that i accidentally pressed enter on a newly created issue which logs it i should have tabbed into the comment field

dpgeorge commented 5 years ago

Thanks for the details. I could confirm the problem, namely that pin16 is inadvertently configured to an output on hard reset or soft reset. Should be fixed by 37ab24e88eadd47f653662828da5916057c0cc05