This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrf_gpio_pin_set() causes reset

I have a modem connected to some pins on an nRF51822 on a custom board. Two pins on the modem are active low. One is a reset pin, the other a VCC control. I want these pins on the Nordic configured as output but I want them high immediately, because at this point I'm not powering up the modem, just init()ing my pins. I don't see any way to set an initial state of the pin at the same instant as configuring it as output (despite the comment in nrf_gpio.h L125), so I simply set them high right after configuring them as output.

nrf_gpio_cfg_output(PIN_SF_RESET);
nrf_gpio_pin_set(PIN_SF_RESET);

nrf_gpio_cfg_output(PIN_SF_VCC_ON);
nrf_gpio_pin_set(PIN_SF_VCC_ON); // This causes a reset!

That last call to nrf_gpio_pin_set() will reset the micro about 80% of the time. This is with the SD enabled and I've just started advertising, in case that makes any difference. I'm on SDK 8.0.0. I've tried this on two identical prototype boards and the same thing happens, so it's not a hardware fault on one board.

What might cause this and how can I avoid it?

Related