Pin8 not being detected on a V2 mircobit but OK on V1

Issue #226 resolved
Simon Walters created an issue

Hi

Was trying new Eggbit https://4tronix.co.uk/blog/?p=2485 on a V2 and could get red, yellow, blue buttons to work but not the green on pin 8.

Switched to using Makecode and all good

Switched to a V1 and all good

4tronix said that there was an issue over event detection in early days of V2 so maybe some check is needed?

Simon

Comments (15)

  1. John Maloney repo owner

    Thank you for reporting this. I’ve confirmed that pin 8 is not working correctly on the micro:bit. The reason is not totally obvious, but I will look into it.

  2. John Maloney repo owner

    I found the problem. Pin 8 was defaulting to use by the NFC system so it couldn’t be used as a GPIO. It will be fixed in the next pilot release (https://microblocks.fun/downloads/pilot/).

    (Note: Pilot releases allow people to to try new features or bug fixes before they appear in a stable release.)

  3. Simon Walters reporter

    Just tried the pilot release on my Pi4 and pin 8 still not responding for me on a V2 microbit

    Using this as my test - the Eggbit has 4 buttons connected to 12,8,14 and 16 - only 8 isn't bringing up smiley face 😞

  4. Simon Walters reporter

    HOLD THE BUS 🙂

    I just tried a V1 to make sure it was all working on that and it did (as its always done)

    Then when I switched back to my V2 - that too worked!!!!!

    Bliddy gremlins!!! :)

  5. Simon Walters reporter

    Ok - this is very peculiar

    I removed the microbit from my Eggbit (to make sure it was a V2 )- and put it back in)

    I reloaded my program (as above) and pressed Green play and now it’s back to not working

    I’m obviously getting some glitches when unplugging/plugging/restarting in certain ways

    But it seems to work reliably as long as I go thru a particular power on sequence 🙂

    Lets put this one down to PEBKAC / peripheral issue and I agree it’s resolved :)

  6. John Maloney repo owner

    There was definitely a software issue with pin 8 on the v2 back when you reported this; you were not imagining it. But it sounds as though there could be a script startup issue with the micro:bit V2.

    I just now (after you did your tests) updated the stable release of the stand-alone apps to 1.1.16. If you are using an earlier version of the stand-alone app, you might try upgrading. You should also make sure that the MicroBlocks firmware on your v2 board is v120. Finally, make sure that the board is connected (green circle behind USB icon) and that the “when” scripts are running (greenish highlights around the scripts).

    Let me know if you continue to have problems.

  7. Simon Walters reporter

    So this morning - I downloaded latest release standalone for Pi

    Ran it

    Updated firmware

    Checked it was V120

    Loaded program

    Green around USB icon

    Pressed green play

    Pin8 not working

    Disconnected USB lead

    reconnected

    Pressed play

    Now working

    I think I need to get myself a breakout connector board to find out whether this is a peripheral hardware issue or not

  8. John Maloney repo owner

    I just checked pin 8 on my micro:bit v2 and it is working for me. I first tried a variation of your program:

    As expected, the display was blank when pin 8 was connected to ground and the smiley face appeared when it was connected to 3.3v. With a wire connected to pin 8 but not connected to anything on the other end, the smiley face flickered but was mostly on. (That corresponds to electrical noise on the “floating” input pin.)

    Here’s another way to check an input pin:

    I enabled the pullup resistor so when the wire is not connected to ground the pin is actively pulled high. When connected to ground, it goes low:

  9. Simon Walters reporter

    OK - got my breakout board connector

    This is with 22k pulldown resistor on pins 12 and 8 and then connecting 3V to pin 12 and 8 in sequence (eggbit use 10k but can’t find any of them!)

    This sequence fails:

    plug microbit in

    update firmware

    press play

    pin 12 works - pin 8 doesn’t

    carrying on - pressing stop and play - no difference

    unplug - re-plug - press play - all works

    Now, at the end of the day - if all I have to do is make sure I power off/on again after a firmware update - then it’s not really an issue

    But I’d be interested to see if you can replicate this behaviour in case its a fault with my V8 board

    Simon

  10. John Maloney repo owner

    Great detective work! I was able to reproduce the behavior using your sequence, and I now understand what’s happening.

    Super techy details: Pin 8 of the nRF52 defaults to being connected to the internal NFC reader logic inside the nRF52 chip. In that state, it cannot be used as a general purpose I/O pin. (The v1 microbit was based on the nRF51 chip which didn’t have the NFC feature.)

    When MicroBlocks first starts, it changes the pin configuration to make pin 8 an I/O pin, but that change does not take effect until the next “hard reset” of the chip – i.e. the next time the board is power cycled or the reset button is pressed. As far as I can tell, there isn’t any way to force the change to take effect under software control.

    In short, you’ve discovered one of the only two ways to get pin 8 working again after a firmware install: power cycling the chip! The other way is to press the reset button.

    I wonder if MakeCode has a better way to handle this problem?

  11. Simon Walters reporter

    I’m a great fan of Sherlock Holmes and always strive to live up to his standards :)

  12. Log in to comment