Adafruit feather nRF52840 development board printf to USB

Hello. I have recently ordered a few official samples from Nordic as well as few small samples from Adafruit.

I have realized that Adafruit Feather nRF52840 does not have built in USB->UART converter so that makes it very difficult to troubleshoot the code (not able to do any printf statements directly to the console or any serial terminal). The only way to debug this is to connect the J-Link debugger which is ok but not very convenient when you need to quickly check something.

I have tried to run the zephyr/samples/subsys/usb/cdc_acm and also zephyr_samples/subsys/usb/console but could not get any printf statements to print anything to serial console. I have tried both of these sample projects on Adafruit Feather nRF52840 board as well as nRF8540DK nRF52840 development board from nordic.

Could someone point me in the right direction how can I achieve this? Thanks in advance.

Parents Reply Children
  • I have managed to get console over usb sample project to print to serial terminal. There was one crucial step missing in the instructions or documentation.

    The sample project will only work if the serial terminal has flow control enabled

    By default, I never use flow control for any of the devices that I use serial communication hence I thought I did not need it.

    I have decided to change it just for curiosity and I started seeing messages on the console right away:

    It would probably be good idea to include this in README as it is not obvious that you have enable flow control

    If you do not want to use flow control, you can just comment out the following code in the console sample project:

    	 while (!dtr) {
    	 	uart_line_ctrl_get(dev, UART_LINE_CTRL_DTR, &dtr);
    	 	/* Give CPU resources to low priority threads. */
    	 	k_sleep(K_MSEC(100));
    	 }

    Moreover, I would like to understand what are the differences between console and cdc_acm projects.  By adding 

    / {
    	chosen {
    		zephyr,console = &cdc_acm_uart0;
    	};
    };

    I can also get the cdc_acm project to print to console. 

    cdc_acm seems to be quite a bit more complex compared to console sample project. Could you help me understand what are the differences?

  • Hi Lukas,

    Thanks a lot for sharing your findings! I will pass your notes on to the docs team as feedback.

    Regarding those differences between the two apps, I'll take a closer look and get back to you soon.

    Best regards,

    Raoul

Related