Problem Description:
I am trying to configure and control an LED connected to pin P1.07 on my nRF52 device, but I am experiencing issues. When I configure pin P1.07 as an output, I am unable to turn the LED on and off. However, if I use a pin on port P0 (e.g., P0.07), everything works correctly.
I noticed that the ports I had connected to P1 on my hardware were not functioning properly. I had conducted tests with the nRF52840 demo board using pins on P0, but due to layout issues, I had to use the external pins connected to P1 when I built the hardware. Now, I have the circuit and software ready, but the P1 ports are not working.
To isolate the problem, I stripped down all my code and tried to simply turn on an LED connected to pin P1.07.
Current Configuration:
- SDK: Zephyr 2.6.1
- Board: Custom board for my hardware
- Example Project: Nordic BLE HIDS Keyboard
- GPIO Configuration: I have enabled
CONFIG_GPIO_NRF_P1=y
in theprj.conf
file.
Code Used:
#include <hal/nrf_gpio.h> // Include if using nRF specific features #define LED_1 NRF_GPIO_PIN_MAP(1, 7) void main(void) { const struct device *dev = device_get_binding("GPIO_1"); gpio_pin_configure(dev, LED_1, GPIO_OUTPUT); while (1) { gpio_pin_set(dev, LED_1, 1); k_sleep(K_MSEC(500)); gpio_pin_set(dev, LED_1, 0); k_sleep(K_MSEC(500)); } }
Checks Performed:
- I verified that
CONFIG_GPIO_NRF_P1=y
is enabled in theprj.conf
file. - I checked the Device Tree to ensure that
gpio1
is enabled:
&gpio1 { status = "okay"; };
Symptoms:
- The LED does not turn on when using pin P1.07.
- The code works correctly when using a pin on port P0 (e.g., P0.07).
Questions:
- Are there additional configurations necessary to use the pins on port P1 on nRF52 devices?
- Do I need to modify other settings in the Device Tree or elsewhere to properly enable port P1?
Thank you in advance for any help or suggestions!