Hi, My question is how to config p21 as a gpio?
Hi, My question is how to config p21 as a gpio?
I just test with sdk example: nRF5_SDK_11.0.0_89a8197\examples\peripheral\spi\pca10040, just modified the spi io config
... and .. is that a question? Have you ensured the UICR has been erased or not? Have you checked the reset pin configuration in the UICR to make sure it's not configured as a reset pin? If it was ever configured as one, it will stay configured as one.
ok, if value of NRF_UICR->PSELRESET[0] and NRF_UICR->PSELRESET[1] should be reset to 0xffffffff, now it is 0x15
That's what I said, you need to erase the UICR which will reset it back to 0xffffffff. Just perform a full erase on the chip with whatever tools you're using, and then reload the softdevice and your code. As long as you no-longer have that #define, it won't replace the value back to 0x15 when you run and the pin will work as normal. if it does put it back, you still have the define defined.
Note also that P0.21 is connected to the debug in, so if (unlikely) you are using an external debugger, it may hold that pin high. Looking at the schematic, I believe that is not the case as long as you are using the on-board debugger, which you probably are.
ok! it is solved after erase all with nrfgo, thanks!