-
Notifications
You must be signed in to change notification settings - Fork 29
Pin drive strength is not the same V1 and V2 #83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
DaveAtKitronik
added a commit
to KitronikLtd/micropython-microbit-kitronik-game-zip-64
that referenced
this issue
Aug 10, 2021
As a workaround for microbit-foundation/micropython-microbit-v2#83 it was suggested by the micropython team to poke the pin configuration register directly (under the nose of CODAL). Whilst this works Im not convinced its a 'good idea' as a change to the underlying system could render this 'fix' broken. It has been tested on V1 and V2 and doesn't appear to have any bad side effects.
I suggest to change the pin drive strength by writing directly to nRF GPIO registers, using |
The equivalent C code to set high drive is: uint32_t s = PORT->PIN_CNF[PIN] & 0xfffff8ff;
s |= 3 << 8;
PORT->PIN_CNF[PIN] = s; |
Here's a function that should be able to set the high drive on a pin (I've not tested it though): def set_high_drive(port_id, pin_id):
addr = 0x5000_0000 + port_id * 0x300 + 0x700 + pin_id * 4
machine.mem32[addr] = (machine.mem32[addr] & 0xffff_f8ff) | 3 << 8 For P0.00 to P0.31 use |
I may have duped this with #216 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reported by a customer - the ZIP64 does not function correctly with microPython on a V2 microbit.
This is the same as a resolved issue in makecode. (microsoft/pxt-microbit#3825).
We added:
#if MICROBIT_CODAL
uBit.io.P0.setHighDrive(true);
#endif
in a c++ shim to fix it there. Not sure where a fix would be applied in microPython - to the neopixel code (baked in), or to just expose the ability to change the pin drive strength from the python code
The text was updated successfully, but these errors were encountered: