sandeepmistry / arduino-nRF5

Arduino Core for Nordic Semiconductor nRF5 based boards
Other
872 stars 278 forks source link

Fix Arduino.h `portOutputRegister()` and `portModeRegister()` #488

Closed carlosperate closed 2 years ago

carlosperate commented 2 years ago

These functions were using the OUTSET and DIRSET registers instead of OUT and DIR. The SET version of these registers only do something when a "1" is written to any of their bits, writting a "0" does nothing.

From the nRF52833 datasheet:

image image

Found this issue when using some of the Adafruit libraries using a BUSIO_USE_FAST_PINIO macro that enables utilisation of these functions, and noticed that some of the pins were not being driven low, only high. Using this patch locally fixed the issue.

carlosperate commented 2 years ago

For comparison I've also found these other nRF cores using the registers from this PR:

So that should give us some confidence as well.