I developed a small test app by adding logging and a blinking LED to the Console over CDC ACM UART Sample. The LED blinks, and I can see the logs by connecting to the USB CDC ACM. However, if I try enabling Zigbee support in the app, the USB CDC ACM no longer shows up on the host, and the LED does not light up. I am developing on nRF52840 Dongle, so I have limited debugging capabilities. What could be the cause of the app not starting at all when Zigbee is enabled?
main.c:
#include <zephyr.h>
#include <drivers/gpio.h>
#include <zephyr/kernel.h>
#include <zephyr/usb/usb_device.h>
#include <zephyr/drivers/uart.h>
#include <zephyr/logging/log.h>
/* This was added to enable Zigbee support. */
#include <zigbee/zigbee_app_utils.h>
/* ---------------------------------------- */
BUILD_ASSERT(DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_console), zephyr_cdc_acm_uart),
"Console device is not ACM CDC UART device");
LOG_MODULE_REGISTER(app, LOG_LEVEL_INF);
/* The devicetree node identifier for the "led0" alias. */
#define LED0_NODE DT_ALIAS(led0)
static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(LED0_NODE, gpios);
/* This was added to enable Zigbee support. */
void zboss_signal_handler(zb_uint8_t param)
{
zigbee_default_signal_handler(param);
zb_buf_free(param);
}
/* ---------------------------------------- */
void main(void)
{
int ret;
LOG_INF("Starting Blinky");
if (usb_enable(NULL)) {
return;
}
if (!device_is_ready(led.port)) {
return;
}
ret = gpio_pin_configure_dt(&led, GPIO_OUTPUT_ACTIVE);
if (ret < 0) {
return;
}
LOG_INF("Blinky started");
while (1) {
LOG_INF("Hello World! %s", CONFIG_ARCH);
ret = gpio_pin_toggle_dt(&led);
if (ret < 0) {
return;
}
k_sleep(K_SECONDS(1));
}
}
prj.conf:
CONFIG_GPIO=y # Enable CDC ACM UART console CONFIG_USB_DEVICE_STACK=y CONFIG_USB_DEVICE_PRODUCT="Test" CONFIG_SERIAL=y CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y CONFIG_UART_LINE_CTRL=y CONFIG_LOG=y CONFIG_LOG_BACKEND_UART=y # Enable Zigbee CONFIG_ZIGBEE=y CONFIG_ZIGBEE_APP_UTILS=y CONFIG_ZIGBEE_ROLE_END_DEVICE=y
nrf52840dongle_nrf52840.overlay:
/ {
chosen {
zephyr,entropy = &rng;
zephyr,console = &cdc_acm_uart0;
};
};
&zephyr_udc0 {
cdc_acm_uart0: cdc_acm_uart0 {
compatible = "zephyr,cdc-acm-uart";
label = "CDC_ACM_0";
};
};
Hardware: nRF52840 Dongle
Host OS: macOS 13.0
Toolchain: nRF Connect SDK v2.1.2
