Unable to Program/Control NRF52840

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);
    }
}

Parents
  • Hi

    What are you powering this external board with when measuring the power on the pins exactly? Based on your description it sounds like maybe your HW design isn't correct. Can you upload your HW files (schematics and PCB layout) so we can review them for you? I understand if you don't want to upload your HW design in a public ticket open to anyone, but you can open a private one that we will handle with confidentiality on our end where only Nordic engineers will be able to see it.

    Potentially, it could also be that you need to make your own board file for your board. We have the Nordic Developer Academy with various courses for learning how to use the nRF Connect SDK that among other things describe how to set up custom board/config files.

    Best regards,

    Simon

Reply
  • Hi

    What are you powering this external board with when measuring the power on the pins exactly? Based on your description it sounds like maybe your HW design isn't correct. Can you upload your HW files (schematics and PCB layout) so we can review them for you? I understand if you don't want to upload your HW design in a public ticket open to anyone, but you can open a private one that we will handle with confidentiality on our end where only Nordic engineers will be able to see it.

    Potentially, it could also be that you need to make your own board file for your board. We have the Nordic Developer Academy with various courses for learning how to use the nRF Connect SDK that among other things describe how to set up custom board/config files.

    Best regards,

    Simon

Children
Related