NRF52840 Dongle no USB logs - Matter light example

Hello everyone,

I'm currently trying to run a matter light bulb application (from the SDK in "nrf/samples/matter/light_bulb"). I've got the SDK version 2.0.0 environment set up on Windows 10, working in VS Code, and have managed to compile .hex images to flash. I'm getting a "zephyr.hex" file as output, which I am then flashing with the GUI Programmer v3.0.3.

I had to use the prj_no_dfu.conf file as the regular prj.conf would not build (I believe this is intentional as the Dongle has no debug capabilities).

I've also tried adding these lines to the bottom of the conf file, as I've seem them used in the "zephyr\samples\subsys\usb\console" example application (as suggested here:  How to config Zephyr if want to output debug message through USB port on nrf52840 dongle)

This also produced no output however! Building the console application itself works and produces output however.

Lastly I tried adding an "app.overlay" file in the root of my application with the following contents:

Again, no output unfortunately!

When I plug the device into my Windows machine, I see no lights flashing and no devices appear in Device Manager until I press the reset button on the board. Then the board's red LED enters a slow "breathing" mode, and I see the device appear as a USB Serial Device. I've tried connecting to the CLI using putty and setting the baud rate to 115200 (as per https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/matter/nrfconnect_examples_cli.html) but the console just hangs with no output at all.

I've had a similar experience plugging the device into a different Ubuntu machine. Plugging the dongle directly into USB seems to have no effect - no new entries appear in /dev or when I run lsusb. Pressing the reset button yields the same breathing LED, and I can now see the /dev/ttyACM0 and corresponding entry in lsusb:

Any help would be greatly appreciated!T

Thanks,

Richard.

  • I have been working with these dongles for a couple of months to develop novel HA devices.  Unfortunately they are much harder to use than the DK board.  I've only ever used Zigbee samples (not Matter) but many of the same concepts should apply.

    I had to use the prj_no_dfu.conf file as the regular prj.conf would not build (I believe this is intentional as the Dongle has no debug capabilities).

    I have OTA DFU working on the nRF52840 Dongle with Zigbee.  In order to do this, I had to:

    1. Connect SWIO/SWCLK/GND to my J-Link debugger
    2. Erase the builtin Open Bootloader
    3. Add a "raw_dongle" board definition that changes the flash layout / bootloader params and adds A/B slots at fixed locations
    4. Enable building the mcuboot child image
    5. Figure out all of the other details involved in signing + pushing an update image

    But at this point you'll probably just want to stick with prj_no_dfu.conf

    I've also tried adding these lines to the bottom of the conf file

    I might have missed it, but do you have CONFIG_USB_CDC_ACM=y ?

    Lastly I tried adding an "app.overlay" file in the root of my application with the following contents:

    The cdc_acm_udc0 stuff is most likely needed (it was for me).  Check build/zephyr/zephyr.dts to make sure it's showing up in the final DTS.

    If you can't get it working via USB initially, it's pretty easy to bring out a serial console on e.g. P0.09 on these boards.

    Then the board's red LED enters a slow "breathing" mode, and I see the device appear as a USB Serial Device.

    This means it's in Open Bootloader, waiting for you to upload a package via nrfutil.  If Open Bootloader appears as a USB device but your app doesn't, that might mean that the UDC driver isn't getting properly initialized.

  • Hi mytzyiay, thanks for your reply.

    But at this point you'll probably just want to stick with prj_no_dfu.conf

    That certainly does sound like a pain, I think for now I'll definitely stick with "prj_no_dfu.conf" as I currently have no need for firmware updates.

    I might have missed it, but do you have CONFIG_USB_CDC_ACM=y ?

    I've confirmed that I do have CONFIG_USB_CDC_ACM=y (I checked inside "build/zephyr/.config"). I also noticed CONFIG_SERIAL=y is present by default, so removed my unnecessary CONFIG_SERIAL=y line in my "prj_no_dfu.conf".

    Since yesterday I've compared the "build/zephyr/.config" files from both the "console" and "light-bulb" samples after building, and tried manually enabling any different config flags I noticed.

    So far my "prj_no_dfu.conf" now has these lines at the bottom:

    CONFIG_USB_DEVICE_DRIVER=y
    CONFIG_USB_DEVICE_STACK=y
    CONFIG_USB_DEVICE_PRODUCT="Richard's USB device"

    CONFIG_CONSOLE=y
    CONFIG_UART_CONSOLE=y
    CONFIG_UART_LINE_CTRL=y

    CONFIG_MATTER_LOG_LEVEL_ERR=y
    CONFIG_MATTER_LOG_LEVEL_WRN=y
    CONFIG_MATTER_LOG_LEVEL_INF=y

    There is still no USB serial device appearing unfortunately.

    Before, I was wondering if I was getting no output because that Matter "light-bulb" app uses LOG_INF and LOG_ERR functions to perform logging (using "zephyr/logging/log.h"), whereas in the "console" app uses printk instead.

    The config option CONFIG_PRINTK=y is set in both the "lighting-app" and the "console" example - so the printk output should be passed to Zephyr's logging anyway. Additionally, it seems like the issue is more due to the device not presenting itself to the host as a USB serial device, rather than differences in the logging functions used. I've tried inserting printk statements into the Matter device init code but as expected there is no output, because there is still no serial device to read from.

    Reading the docs from Zephyr, you can choose which backend the logging uses.

    I tried adding:

    CONFIG_LOG_BACKEND_UART=y
    CONFIG_LOG_MODE_MINIMAL=n

    ...to "prj_no_dfu.conf" (see: https://docs.zephyrproject.org/latest/kconfig.html#CONFIG_LOG_BACKEND_UART). I'm not even sure if this is right though, does the dongle simulate UART logging over USB?

     

    Furthermore, the CONFIG_LOG_BACKEND_UART value in "build/zephyr/.config" does not even get set, I suspect due to CONFIG_LOG_MODE_MINIMAL=y being present.

    In the Zephyr docs it specifies that CONFIG_LOG_MODE_MINIAL is a direct dependency:

    I've tried setting CONFIG_LOG_MODE_MINIAL=n, but it strangely remains as CONFIG_LOG_MODE_MINIAL=y in "build/zephyr/.config". I also tried setting CONFIG_SHELL_BACKEND_SERIAL=n, to try and trigger the "default" condition shown above, but it doesn't.

    Interestingly, I see no references to any CONFIG_LOG stuff in the "build/zephyr/.config" for the "console" app (probably because it directly uses printk), so this still suggests that all this logging backend stuff is irrelevant anyway right?

    The cdc_acm_udc0 stuff is most likely needed (it was for me). Check build/zephyr/zephyr.dts to make sure it's showing up in the final DTS.

    I think its being added to the device tree, but I'm not sure if this looks correct or not. The "build/zephyr/zephyr.dts" file has the following entries:

    And:

    If Open Bootloader appears as a USB device but your app doesn't, that might mean that the UDC driver isn't getting properly initialized.

    It definitely sounds like this is the problem, I'm just unsure how to change this. Comparing this to the "console" example, I see the device in device manager as soon as I plug it into USB:

    Additionally, it also appears in the NRF Connect Programmer as a device:

    If you can't get it working via USB initially, it's pretty easy to bring out a serial console on e.g. P0.09 on these boards.

    Is this something that would be enabled by default? And would it be the same logs I'd receive over USB?

    Again thanks for your help,
    Richard.

  • Hi ,

    I'm not sure if the Matter light bulb example (from nRF Connect SDK) is preconfigured to use with nRF52840 Dongle. 

    Are you sure you copied the right build - output file to your nRF52840 USB Dongle? 

    In the original chip-repo the correct build-artifact is called merged.hex. Try to upload this file to your nRF52840 Dongle.

    // Last build step
    
    [285/285] Generating zephyr/merged.hex 

    The original chip repo implements the light-bulb example for the nRF52840 USB Dongle.

    Check this out:

    https://github.com/project-chip/connectedhomeip/tree/master/examples/lighting-app/nrfconnect

    and try to build

    connectedhomeip/examples/lighting-app/nrfconnect % west build -b nrf52840dongle_nrf52840 -- -DCONF_FILE=prj_no_dfu.conf

  • I have the same problem!! I don't have log output about matter_light. I am using nrf52840dongle, could you please teach me how to solve this problem?

Related