This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Adapt existing Zephyr OpenThread application from nRF52DK to nRF52Dongle

Hello,

I've been given the task of porting an existing application from the nRF52840DK to a nFR52840 Dongle. 

Simplified, the application uses the Shell functionality from Zephyr to control external devices using Thread. The application works satisfactorily on the DK, but I cannot find any resource describing which changes I need to make in order to make the Dongle function in the same way.

I've found this thread describing an approach to using the Dongle for logging using the CLI. 

I've also found this thread touching on an eerily similar issue.

Unfortunately no matter how hard I try to search around looking for the magic configuration option, I can't seem to get anything working.

Here's the prj.conf which works just fine on the DK.

#Enable C++17 support
CONFIG_STD_CPP17=y

# OpenThread settings and dependencies
CONFIG_NETWORKING=y
CONFIG_NET_SOCKETS=y
CONFIG_NET_SOCKETS_POSIX_NAMES=y
CONFIG_NET_SOCKETS_POLL_MAX=4
CONFIG_NET_CONNECTION_MANAGER=y

# Kernel options
CONFIG_MAIN_STACK_SIZE=2048

# CONFIG_ENTROPY_GENERATOR=y
CONFIG_INIT_STACKS=y

# Increase set for threads with meta-irq priority
CONFIG_NUM_METAIRQ_PRIORITIES=1

# Logging
CONFIG_NET_LOG=y
CONFIG_LOG=y
CONFIG_NET_STATISTICS=y

# Network buffers
CONFIG_NET_PKT_RX_COUNT=16
CONFIG_NET_PKT_TX_COUNT=16
CONFIG_NET_BUF_RX_COUNT=80
CONFIG_NET_BUF_TX_COUNT=80

# Network shell
CONFIG_NET_SHELL=y

CONFIG_SHELL_ARGC_MAX=26
CONFIG_SHELL_CMD_BUFF_SIZE=416

CONFIG_CPLUSPLUS=y
CONFIG_LIB_CPLUSPLUS=y
CONFIG_NEWLIB_LIBC=y
CONFIG_MINIMAL_LIBC=n

CONFIG_NET_CONFIG_SETTINGS=y
CONFIG_NET_IPV6_NBR_CACHE=n
CONFIG_NET_IPV6_MLD=n

CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
CONFIG_NET_TX_STACK_SIZE=2048
CONFIG_NET_RX_STACK_SIZE=5120
CONFIG_SHELL_STACK_SIZE=3072

CONFIG_NET_L2_OPENTHREAD=y

CONFIG_OPENTHREAD_DEBUG=y
CONFIG_OPENTHREAD_L2_DEBUG=y
CONFIG_OPENTHREAD_L2_LOG_LEVEL_INF=y
CONFIG_OPENTHREAD_CHANNEL=11
CONFIG_OPENTHREAD_MANUAL_START=y

# Thread by default registers quite a lot addresses.
CONFIG_NET_IF_UNICAST_IPV6_ADDR_COUNT=6
CONFIG_NET_IF_MCAST_IPV6_ADDR_COUNT=8

# nRF board library
CONFIG_DK_LIBRARY=y

# Enable CoAP utils and CoAP protocol
CONFIG_COAP_UTILS=y
CONFIG_OPENTHREAD_COAP=y

# Configure sample logging setting
CONFIG_COAP_CLIENT_LOG_LEVEL_DBG=y
CONFIG_COAP_CLIENT_UTILS_LOG_LEVEL_DBG=y
CONFIG_COAP_UTILS_LOG_LEVEL_DBG=y
CONFIG_COAP_SERVER_LOG_LEVEL_DBG=y
CONFIG_OT_COAP_UTILS_LOG_LEVEL_DBG=y

# Set optimization level
CONFIG_DEBUG_OPTIMIZATIONS=y
CONFIG_COMPILER_OPT="-Wno-psabi"

## USB
# Usb
CONFIG_USB_DEVICE_PRODUCT="USB central interface"
CONFIG_USB_DEVICE_VID=0xA552
CONFIG_USB_DEVICE_PID=0x01A4
CONFIG_USB=y
CONFIG_USB_CDC_ACM=y
CONFIG_USB_UART_CONSOLE=n
CONFIG_USB_DEVICE_STACK=y
CONFIG_USB_DEVICE_LOG_LEVEL_ERR=y
CONFIG_USB_DEVICE_LOG_LEVEL_INF=y

# Uart
CONFIG_SERIAL=y
# CONFIG_USE_SEGGER_RTT=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_UART_CONSOLE_ON_DEV_NAME="UART_0"
CONFIG_UART_LINE_CTRL=y
CONFIG_CONSOLE=y
CONFIG_GPIO=y
CONFIG_STDOUT_CONSOLE=y
# CONFIG_LOG=y
CONFIG_UART_ASYNC_API=y

# Nordic/Soc
CONFIG_ARM_MPU=y
CONFIG_SOC_SERIES_NRF52X=y
# CONFIG_SOC_NRF52840_QIAA=y
CONFIG_NRFX_TIMER=y
CONFIG_NRFX_TIMER0=y
CONFIG_NRFX_PPI=y

# Ram
CONFIG_HEAP_MEM_POOL_SIZE=16384
CONFIG_IDLE_STACK_SIZE=2048
CONFIG_ISR_STACK_SIZE=4096
CONFIG_UART_MUX_RX_STACK_SIZE=1024
CONFIG_HW_STACK_PROTECTION=y

Some changes I've tried:

Added CONFIG_UART_SHELL_ON_DEV_NAME="CDC_ACM_0"

Disabled interrupt-driven UART

Enabled and disabled all sorts of CONSOLE related options

I've tried to run quite a few samples on the Dongle. All console-related samples work, but shell-samples refuse to cooperate.

Could someone point me in the direction of a configuration setting I'm overlooking?

Many thanks for any help

-Robin G

  • An update:

    After rummaging around with all sorts of settings, I've managed to get things working. Apparently this application used both Console and Shell simultaneously.

    In my particular case these were the necessary changes to the prj.conf in case someone else encounters a similar issue:

    # Both of these need to be set to "CDC_ACM_0". "UART_0" did not work here.
    CONFIG_UART_CONSOLE_ON_DEV_NAME="CDC_ACM_0"
    CONFIG_UART_SHELL_ON_DEV_NAME="CDC_ACM_0"
    
    # Line control apparently is not necessary in this case.
    CONFIG_UART_LINE_CTRL=n
    
    # Setting the console to be a UART console in addition was necessary
    CONFIG_UART_CONSOLE=y

    I have yet to test if the actual Thread communication works, but at least now I have some feedback from the Dongle.

Related