Hello :) The default setting for the console on the nRF52840 is over UART0. I can easily print logging messages to the console and I have also implemented a function to parse incoming serial messages. See the code below:
I want to be able to send any messages via the serial terminal to the device and I want the device to be able to parse incomming messages and take any required action. For example. I may want so end a serial command "Turn on LED1" and the device can parse the message and turn on the LED1...
For my application, I want to reconfigure UART0 to communicate with external device instead of logging and console and I want to use USB for this instead.
So the plan is:
UART0 - Communication with external device 1
UART1 - Communication with external device 2
USB - Logging and parsing commands
I have looked at the Console over USB example (zephyr/samples/subsys/usb/console) to check how to setup the console over the USB and I came up with the project below:
https://github.com/krupis/nrf52_learning/tree/USB_debug
The full code:
nrf52840dk_nrf52840.overlay:
prj.conf:
The result:
I can see that the logging via the USB is working as expected. If I connect the USB to the nRF USB port instead of the nRF debug USB, I can see that the logs are coming through:
My questions:
Question 1:
I have read through the USB documentation (https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.2-dev1/zephyr/reference/usb/uds.html) but it is still not fully clear to me how can I implement serial command parsing via the USB. I want to be able to send the commands via the serial terminal and I expect some callback to be triggered that receives the data (Simillarly to how the UART_RX_RDY event is triggered when the data is received using UART ASYNC method) and I can then parse the data accordingly. Could someone point me in the right direction on how to get this implemented as I could not find any relevant example projects to get started with.
Question 2:
I would like to understand how can I change the COM port name that my device appears as. Currently it appears as a USB Serial Device (COM41). Can I change this to any name I want?
Question 3:
What is the purpose of
As they do not seem to show up anywhere?