lancaster-university / codal-microbit-v2

CODAL target for the micro:bit v2.x series of devices
MIT License
43 stars 52 forks source link

Pin 0 digital input may be high by default on V2 micro:bit #357

Closed microbit-giles closed 1 year ago

microbit-giles commented 1 year ago

To reproduce:

The HEX file seems to work as expected on a micro:bit V1 - no diamond shown by default. Diamond is shown when 3v pin connected to pin 0, and disappears when disconnected. microbit-screenshot (2)

Are there any mitigations we can add in code, or does this need some other kind of fix?

martinwork commented 1 year ago

I think it must be an old hex file with a bug that has been fixed.

I see the same problem with the downloaded hex, but not with a newly built hex.

microbit-carlos commented 1 year ago

Based on issue https://github.com/lancaster-university/codal-microbit-v2/issues/17 V2 should be configured to match V1 and set the pins default state to pull down:

Looking at the source code we have the default pull configured to down in the target.json files: https://github.com/lancaster-university/codal-microbit-v2/blob/3fa546f7ef5fd34cb9167b41045f8d7b6235b67e/target.json#L26 https://github.com/lancaster-university/codal-microbit-v2/blob/3fa546f7ef5fd34cb9167b41045f8d7b6235b67e/target-locked.json#L18

And the default mode is applied here:

microbit-carlos commented 1 year ago

I think it must be an old hex file with a bug that has been fixed.

I see the same problem with the downloaded hex, but not with a newly built hex.

Ah, thanks @martinwork! As this hex file is hosted in the website we'll have to update it in the CMS to a newer version of MakeCode.

microbit-carlos commented 1 year ago

Okay, so the issue was from an old MakeCode release and has been fixed in current CODAL, so we can close this as fixed.