I cannot find this answered anywhere on here, if it is, please direct me to it.
I'm using the NRF52840 Dongle and I have added some code to make the Zephyr Console come out on the USB:
LOG_MODULE_REGISTER(app, CONFIG_CHIP_APP_LOG_LEVEL);
BUILD_ASSERT( DT_NODE_HAS_COMPAT( DT_CHOSEN( zephyr_console ), zephyr_cdc_acm_uart ),
"Console device is not ACM CDC UART device" );
void console_init()
{
const struct device *const dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_console));
uint32_t dtr = 0;
usb_enable( NULL );
while ( !dtr )
{
uart_line_ctrl_get( dev, UART_LINE_CTRL_DTR, &dtr );
k_sleep(K_MSEC(100));
}
LOG_INF("Console Initialised: %s\n", CONFIG_ARCH);
}
int main()
{
console_init();
}
This works well, but when booting, the whole application blocks until I attached to the console.
Which is good for development.
I guess I could disable the console but what I would really like to do is have the console on the USB but have the application run as normal and then if I need to, I can attach to the console if there is any funny behavior.
I cannot use UART0 as that is being used for communications with another MCU.