I have an application that is utilizing P0.21 as gpio. However, if I use the command "west flash", I P0.21 get configured as a pin reset.
Is it possible to disable this so west doesn't doesn't configure the system for a reset pin?
I have an application that is utilizing P0.21 as gpio. However, if I use the command "west flash", I P0.21 get configured as a pin reset.
Is it possible to disable this so west doesn't doesn't configure the system for a reset pin?
Hi,
You can disable pin reset by sitting CONFIG_GPIO_AS_PINRESET=n
in your prj.conf.
Right, I have that setting, but when I use west flash, the pin gets re-configured as reset. See the "Enabling pin reset" line below.
$ west flash -- west flash: rebuilding ninja: no work to do. -- west flash: using runner nrfjprog Using board 17xxxxxx -- runners.nrfjprog: Flashing file: C:\git\app\build\zephyr\zephyr.hex Parsing image file. Erasing page at address 0x0. Erasing page at address 0x1000. Erasing page at address 0x2000. Erasing page at address 0x3000. Erasing page at address 0x4000. Erasing page at address 0x5000. Erasing page at address 0x6000. Erasing page at address 0x7000. Erasing page at address 0x8000. Erasing page at address 0x9000. Erasing page at address 0xA000. Erasing page at address 0xB000. Erasing page at address 0xC000. Erasing page at address 0xD000. Erasing page at address 0xE000. Erasing page at address 0xF000. Erasing page at address 0x10000. Erasing page at address 0x11000. Erasing page at address 0x12000. Erasing page at address 0x13000. Erasing page at address 0x14000. Erasing page at address 0x15000. Erasing page at address 0x16000. Erasing page at address 0x17000. Erasing page at address 0x18000. Erasing page at address 0x19000. Erasing page at address 0x1A000. Erasing page at address 0x1B000. Erasing page at address 0x1C000. Erasing page at address 0x1D000. Erasing page at address 0x1E000. Erasing page at address 0x1F000. Erasing page at address 0x20000. Applying system reset. Checking that the area to write is not protected. Programming device. Enabling pin reset. Applying pin reset. -- runners.nrfjprog: Board with serial number 17xxxxxx flashed successfully.
Answering my own question. I found the documentation for choosing a flash runner. I also found I was able to list the available flash runners and options using the command west flash -H.
The command to flash without a pin reset is
west flash --softreset
I have to say tho, in case someone else experiences the same problem:
I could not use the west command manually because I used a freestanding app with VS Code and west would always complain about something when I tried it manually.
VS Code seems to use west under the hood, but also runner configurations.
The runner seems to be configured in the board.cmake config file, which in my case was located in the zephyr ncs directory under .../ncs/v2.4.0/zephyr/boards/arm/myBoardID/board.cmake
And there I had to add this one line to solve it:
board_runner_args(nrfjprog "--softreset")
And then the lines
Enabling pin reset. Applying pin reset.
did not show up anymore in the VS Code output of the terminal during flashing.
Note, that I also had to run this command manually in a terminal once in advance in order to get my P0.18 pin working as a CS GPIO pin instead of the Reset-feature.
nrfjprog --eraseall
Note, that, one can also duplicate the already existing board config directory in the ncs file hierarchy to their freestanding app repo folder and rename it slightly (I think it should have a different board name then to be unique?) so one can track this changed board.cmake line in their git repo. I think this is cleaner than having local changes in a local ncs installation which is separate from the app itself.
Also, beware that you than have to change the board ID in your project.
In my case using VS Code, it will ask this setting when I add a new build configuration which sets
CONFIG_BOARD="nrf52840dk_nrf52840"
inside .../app/build/zephyr/.config and therefore knows which board.cmake should be used.