Skip to content

Instantly share code, notes, and snippets.

@hidsh
Created August 13, 2025 15:43
Show Gist options
  • Save hidsh/92d8fb54f720d38e41b1662ae6bee991 to your computer and use it in GitHub Desktop.
Save hidsh/92d8fb54f720d38e41b1662ae6bee991 to your computer and use it in GitHub Desktop.
zephyr button w/ "static" pinctrl example for xiao_ble (seeed xiao nrf52840)
# zephyr/samples/basic/button/boards/custom.conf
#
# "static" pinctrl to use external-uart breakout (AE-FT2232 / FTDI FT2232D) as /dev/ttyUSB0
# this file is to switch USB-CDC-ACM (/dev/ttyACM0) --> external uart (/dev/ttyUSB0)
# disable USB CDC ACM
CONFIG_USB_DEVICE_STACK=n
CONFIG_USB_DEVICE_STACK_NEXT=n
CONFIG_BOARD_SERIAL_BACKEND_CDC_ACM=n
# enable UART console
CONFIG_UART_CONSOLE=y
CONFIG_CONSOLE=y
// zephyr/samples/basic/button/boards/xiao_ble.overlay
//
// adopt from zephyr/boards/nordic/nrf52dk/nrf52dk_nrf52810.dts
/ {
buttons {
compatible = "gpio-keys";
button0: button_0 {
label = "Push button switch 0";
gpios = <&gpio0 5 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; // P0.05 XIAO #6 D5 --> push switch
zephyr,code = <INPUT_KEY_0>;
};
};
aliases {
sw0 = &button0;
uart-0 = &uart0; // add this alias for the console
};
chosen {
zephyr,console = &uart0; // explicitly set UART0 as console
};
};
// "static" pinctrl to use external-uart breakout (AE-FT2232 / FTDI FT2232D) as /dev/ttyUSB0
&pinctrl {
uart0_default: uart0_default {
group1 {
psels = <NRF_PSEL(UART_TX, 1, 15)>; // P1.15 XIAO #11 D10 TX --> AE-FT2232 #39 RXD (cross)
};
group2 {
psels = <NRF_PSEL(UART_RX, 1, 14)>; // P1.14 XIAO #10 D9 RX --> AE-FT2232 #40 TXD (cross)
bias-pull-up;
};
};
uart0_sleep: uart0_sleep {
group1 {
psels = <NRF_PSEL(UART_TX, 1, 15)>,
<NRF_PSEL(UART_RX, 1, 14)>;
low-power-enable;
};
};
};
// Enable UART0
&uart0 {
status = "okay";
current-speed = <115200>;
pinctrl-0 = <&uart0_default>;
pinctrl-1 = <&uart0_sleep>;
pinctrl-names = "default", "sleep";
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment