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

nRF51822 GPIO, Pin P0.26 and P0.27 Unavailable with SoftDevice

Hi all,

I have a working prototype of a service which enables a number of characteristics for the control of motors and relays. The motors work great, and are controlled using GPIO to an h-bridge. I went to add the switches in exactly the same manner, but found that while enabled, the SoftDevice was not found in the Master Control Panel.

I have a helper method to enable output with high drive (the current is actually very low, it's going to a 2.5V logic level MOSFET gate pin)

void nrf_gpio_cfg_high_drive_output(uint32_t pin_number) {
    //lint -e{845} // A zero has been given as right argument to operator '|'" 
    NRF_GPIO->PIN_CNF[pin_number] = (GPIO_PIN_CNF_SENSE_Disabled <<     GPIO_PIN_CNF_SENSE_Pos)
                                            | (GPIO_PIN_CNF_DRIVE_H0H1 << GPIO_PIN_CNF_DRIVE_Pos)
                                            | (GPIO_PIN_CNF_PULL_Pulldown << GPIO_PIN_CNF_PULL_Pos)
                                            | (GPIO_PIN_CNF_INPUT_Disconnect << GPIO_PIN_CNF_INPUT_Pos)
                                            | (GPIO_PIN_CNF_DIR_Output << GPIO_PIN_CNF_DIR_Pos);
}

Here's where it gets interesting. The switch enable function looks like this

void switches_init() {		
		rev_switch_init(&switches[0], 21);
		rev_switch_init(&switches[1], 22);
		//rev_switch_init(&switches[2], 26);
		//rev_switch_init(&switches[3], 27);
		rev_switch_init(&switches[2], 12);
		rev_switch_init(&switches[3], 12);
		rev_switch_init(&switches[4], 12);
}

The above code works fine, and I can see the device in MCP. The switch init calls the helper function on the pin number and sets the state enumerator. When I uncomment pins 26 or 27, the device fails to respond. Unfortunately, I can't find any indication that the pins are in use by the SoftDevice (the S110 specification doesn't contain the characters "pin "). In addition, it says that GPIO P0 and GPIOTE are fully available while the SD is loaded.

So, what are the next steps for this? Thanks to another thread, I was able to step through all of the initialization code and err_code was never returning any issues. Is there a way to see why the SD would not be found?

For some background, this was taken almost entirely from nAN-36 (the ble_lbs template program) as the LED interface was pretty similar to what I am attempting to do. I have not uncommented any of the BSP related items. Any tips would be appreciated.

Thanks, -Alex

Related