Hello all,
I use nRF52840 for my custom board. I set P1.11 & P1.12 as UART_RX & UART_TX. But these two pins can not work.
Here is my nrf52840dk_nrf52840.overlay.
&pinctrl { uart0_default: uart0_default { group1 { psels = <NRF_PSEL(UART_TX, 1, 12)>; }; group2 { psels = <NRF_PSEL(UART_RX, 1, 11)>; }; }; uart0_sleep: uart0_sleep { group1 { psels = <NRF_PSEL(UART_TX, 1, 12)>; }; group2 { psels = <NRF_PSEL(UART_RX, 1, 11)>; }; }; };
Here is my main.c.
/* * Copyright (c) 2016 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ #include <stdio.h> #include <zephyr/kernel.h> #include <zephyr/drivers/gpio.h> /* 1000 msec = 1 sec */ #define SLEEP_TIME_MS 1000 /* The devicetree node identifier for the "led0" alias. */ #define LED0_NODE DT_ALIAS(led0) #define LED1_NODE DT_ALIAS(led1) /* * A build error on this line means your board is unsupported. * See the sample documentation for information on how to fix this. */ static const struct gpio_dt_spec led0 = GPIO_DT_SPEC_GET(LED0_NODE, gpios); static const struct gpio_dt_spec led1 = GPIO_DT_SPEC_GET(LED1_NODE, gpios); void main(void) { int ret; if (!device_is_ready(led0.port)) { return; } if (!device_is_ready(led1.port)) { return; } ret = gpio_pin_configure_dt(&led0, GPIO_OUTPUT_ACTIVE); if (ret < 0) { return; } ret = gpio_pin_configure_dt(&led1, GPIO_OUTPUT_ACTIVE); if (ret < 0) { return; } while (1) { ret = gpio_pin_toggle_dt(&led0); printf("blinky\n"); ret = gpio_pin_toggle_dt(&led1); if (ret < 0) { return; } k_msleep(SLEEP_TIME_MS); } }
My project build configuration is nrf52840dk_nrf52840.
Are these two pins used for other peripherals?
Thanks!