Hello,
I am running a simple experiment to turn on all GPIO pins to active on the NRF52840.
The code attached works on the NRF52840-DK, and I am able to measure 3v on the GPIO pins (e.g. pin P0.02).
However, when I program an external NRF52840 board, all the GPIO pins read 0.0V. I am able to see the board in NRF connect and get successful programming messages in the termnial. Am I missing something? Is there a difference in how to call the GPIO pins on the dev kit vs. a standalone board?
I am using:
- DK to program the board (by connecting VDD, GND, SWDIO and SWDCLK between the two boards, as well as SWDSEL to VDD on the DK)
- The defult board NRF52840DK_NRF52840 in the build configuration
- SDK 2.7.0-rc1 and Toolchain v2.6.1
- Traces connecting GPIO pins to a pad and measuring voltage between GND and the PAD. Is my hardware setup too naive? Do I need to add something else to make this simple setup work?
I'm a mechanical engineer by trade and doing my best to learn some electronics. So any help is greatly appreciated!
#include <zephyr/kernel.h> #include <zephyr/device.h> #include <zephyr/drivers/gpio.h> #include <zephyr/sys/printk.h> #define SLEEP_TIME_MS 500 void main(void) { const struct device *gpio_dev = DEVICE_DT_GET(DT_NODELABEL(gpio0)); int ret; uint32_t pin; if (gpio_dev == NULL) { printk("Error: Failed to bind to GPIO0\n"); return; } for (pin = 0; pin < 32; pin++) { ret = gpio_pin_configure(gpio_dev, pin, GPIO_OUTPUT_ACTIVE); if (ret < 0) { printk("Error configuring pin %d\n", pin); } } while (1) { k_msleep(SLEEP_TIME_MS); } }