boards: arm: nrf52840dongle_nrf52840: Use USB CDC as default UART

Enables use of the USB CDC port as the default UART for this board,
as it is a USB dongle and makes more sense to use the on-board USB
port instead of a disconnected/floating UART interface.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
This commit is contained in:
Jamie McCrae 2023-02-09 10:44:44 +00:00 committed by Stephanos Ioannidis
parent 1a5676d338
commit 897d2b8204
4 changed files with 62 additions and 8 deletions

View file

@ -1,6 +1,6 @@
# nRF52840 Dongle NRF52840 board configuration # nRF52840 Dongle NRF52840 board configuration
# Copyright (c) 2018 Nordic Semiconductor ASA # Copyright (c) 2018-2023 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
if BOARD_NRF52840DONGLE_NRF52840 if BOARD_NRF52840DONGLE_NRF52840
@ -22,4 +22,8 @@ config BOARD_HAS_NRF5_BOOTLOADER
If selected, applications are linked so that they can be loaded by Nordic If selected, applications are linked so that they can be loaded by Nordic
nRF5 bootloader. nRF5 bootloader.
config BOARD_SERIAL_BACKEND_CDC_ACM
bool "USB CDC"
default y
endif # BOARD_NRF52840DONGLE_NRF52840 endif # BOARD_NRF52840DONGLE_NRF52840

View file

@ -1,6 +1,6 @@
# nRF52840 Dongle NRF52840 board configuration # nRF52840 Dongle NRF52840 board configuration
# #
# Copyright (c) 2018 Nordic Semiconductor ASA # Copyright (c) 2018-2023 Nordic Semiconductor ASA
# #
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
@ -24,6 +24,44 @@ config FLASH_LOAD_OFFSET
default 0x1000 default 0x1000
depends on BOARD_HAS_NRF5_BOOTLOADER && !USE_DT_CODE_PARTITION depends on BOARD_HAS_NRF5_BOOTLOADER && !USE_DT_CODE_PARTITION
if BOARD_SERIAL_BACKEND_CDC_ACM
config USB_DEVICE_STACK
default y
config USB_CDC_ACM
default y
config UART_CONSOLE
default CONSOLE
config USB_DEVICE_INITIALIZE_AT_BOOT
default y if !MCUBOOT
config SHELL_BACKEND_SERIAL_CHECK_DTR
default SHELL
config USB_DEVICE_REMOTE_WAKEUP
default n
if LOG
# Logger cannot use itself to log
choice USB_CDC_ACM_LOG_LEVEL_CHOICE
default USB_CDC_ACM_LOG_LEVEL_OFF
endchoice
# Set USB log level to error only
choice USB_DEVICE_LOG_LEVEL_CHOICE
default USB_DEVICE_LOG_LEVEL_ERR
endchoice
# Wait 4000ms at startup for logging
config LOG_PROCESS_THREAD_STARTUP_DELAY_MS
default 4000
endif # LOG
if USB_DEVICE_STACK if USB_DEVICE_STACK
# Enable UART driver, needed for CDC ACM # Enable UART driver, needed for CDC ACM
@ -32,6 +70,8 @@ config SERIAL
endif # USB_DEVICE_STACK endif # USB_DEVICE_STACK
endif # BOARD_SERIAL_BACKEND_CDC_ACM
config BT_CTLR config BT_CTLR
default BT default BT

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018 Nordic Semiconductor ASA * Copyright (c) 2018-2023 Nordic Semiconductor ASA
* Copyright (c) 2017 Linaro Limited * Copyright (c) 2017 Linaro Limited
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
@ -14,11 +14,11 @@
compatible = "nordic,nrf52840-dongle-nrf52840"; compatible = "nordic,nrf52840-dongle-nrf52840";
chosen { chosen {
zephyr,console = &uart0; zephyr,console = &cdc_acm_uart;
zephyr,shell-uart = &uart0; zephyr,shell-uart = &cdc_acm_uart;
zephyr,uart-mcumgr = &uart0; zephyr,uart-mcumgr = &cdc_acm_uart;
zephyr,bt-mon-uart = &uart0; zephyr,bt-mon-uart = &cdc_acm_uart;
zephyr,bt-c2h-uart = &uart0; zephyr,bt-c2h-uart = &cdc_acm_uart;
zephyr,sram = &sram0; zephyr,sram = &sram0;
zephyr,flash = &flash0; zephyr,flash = &flash0;
zephyr,code-partition = &slot0_partition; zephyr,code-partition = &slot0_partition;
@ -173,4 +173,8 @@
zephyr_udc0: &usbd { zephyr_udc0: &usbd {
compatible = "nordic,nrf-usbd"; compatible = "nordic,nrf-usbd";
status = "okay"; status = "okay";
cdc_acm_uart: cdc_acm_uart {
compatible = "zephyr,cdc-acm-uart";
};
}; };

View file

@ -18,3 +18,9 @@ CONFIG_GPIO_AS_PINRESET=y
CONFIG_NFCT_PINS_AS_GPIOS=y CONFIG_NFCT_PINS_AS_GPIOS=y
CONFIG_PINCTRL=y CONFIG_PINCTRL=y
# Board Kconfig.defconfig enables USB CDC ACM and should disable USB remote
# wakeup by default. It needs to be disabled here, because the USB nrfx
# driver always overwrites option from Kconfig mentioned above with the
# imply from CONFIG_USB_NRFX.
CONFIG_USB_DEVICE_REMOTE_WAKEUP=n