UART0 and moving from DK to Dongle

I'm a newbie.

I have an app that works on the nRF52840 DK and wish to move it to the dongle. It sends and receives serial data over UART1 (mapped to P0.02 and P1.10).

I would like to minimize the number of wires soldered to the dongle.

  1. Can I safely use the dongle's USB connector to provide power and ground without changing anything in the app?
  2. Instead of using P0.02 and P1.10 can I send/receive the serial data over the dongle's USB connector?  If so, 
    1. What node (uart0?)?
    2. What other changes will need to be made?
    3. Are there negative implacations (for example: can't reprogram the dongle)?

Thanks

Parents
  • Hello,

    If you haven't already, please try to build your app for the 'nrf52840Dongle_52840' target to see if it works or not. The serial output should automatically default to using USB interface and not UART when you build for this board due to this line here: https://github.com/nrfconnect/sdk-zephyr/blob/ff85910bf8ed1aac0571bca0e7f206782234efbb/boards/arm/nrf52840dongle_nrf52840/nrf52840dongle_nrf52840.dts#L18 

    What node (uart0?)

    cdc_acm_uart

    Are there negative implacations (for example: can't reprogram the dongle)?

    The bootloader will remain present in flash unless you erase it using an external J-Link programmer. This means you can still reprogram the application code through USB - you just have to press the reset button to enter DFU mode first. The red LED will start blinking in DFU mode.

    Best regards,

    Vidar

  • I changed the device in the build configuration to nrf52840dongle_nrf52840

    In the code I changed this line from:

    const struct device *uart1 = DEVICE_DT_GET(DT_NODELABEL(uart1));

    to:
    const struct device *uart1 = DEVICE_DT_GET(DT_NODELABEL(cdc_acm_uart));
    When I Build Configration I get the following errors:

    d:\nrf\observer\build\zephyr\include\generated\devicetree_generated.h:12112:38: error: 'DT_N_S_soc_S_uart_40028000_P_current_speed' undeclared here (not in a function); did you mean 'DT_N_S_soc_S_uart_40002000_P_current_speed'?
    12112 | #define DT_N_NODELABEL_uart1 DT_N_S_soc_S_uart_40028000
    | ^~~~~~~~~~~~~~~~~~~~~~~~~~
    D:\ncs\v2.4.0\zephyr\include\zephyr\devicetree.h:4051:29: note: in definition of macro 'DT_CAT3'
    4051 | #define DT_CAT3(a1, a2, a3) a1 ## a2 ## a3
    | ^~
    D:\ncs\v2.4.0\zephyr\drivers\serial\uart_nrfx_uarte.c:1946:41: note: in expansion of macro 'DT_PROP'
    1946 | #define UARTE_PROP(idx, prop) DT_PROP(UARTE(idx), prop)
    | ^~~~~~~
    D:\ncs\v2.4.0\zephyr\include\zephyr\devicetree.h:4049:24: note: in expansion of macro 'DT_N_NODELABEL_uart1'
    4049 | #define DT_CAT(a1, a2) a1 ## a2
    | ^~
    D:\ncs\v2.4.0\zephyr\include\zephyr\devicetree.h:192:29: note: in expansion of macro 'DT_CAT'
    192 | #define DT_NODELABEL(label) DT_CAT(DT_N_NODELABEL_, label)
    | ^~~~~~
    D:\ncs\v2.4.0\zephyr\drivers\serial\uart_nrfx_uarte.c:1944:41: note: in expansion of macro 'DT_NODELABEL'
    1944 | #define UARTE(idx) DT_NODELABEL(uart##idx)
    | ^~~~~~~~~~~~
    D:\ncs\v2.4.0\zephyr\drivers\serial\uart_nrfx_uarte.c:1946:49: note: in expansion of macro 'UARTE'
    1946 | #define UARTE_PROP(idx, prop) DT_PROP(UARTE(idx), prop)
    | ^~~~~
    D:\ncs\v2.4.0\zephyr\drivers\serial\uart_nrfx_uarte.c:2020:29: note: in expansion of macro 'UARTE_PROP'
    2020 | .baudrate = UARTE_PROP(idx, current_speed), \
    | ^~~~~~~~~~
    D:\ncs\v2.4.0\zephyr\drivers\serial\uart_nrfx_uarte.c:1975:17: note: in expansion of macro 'UARTE_CONFIG'
    1975 | UARTE_CONFIG(idx), \
    | ^~~~~~~~~~~~

    Is there somthing I need to do to proj.cfg?

    Do I still need the device tree overlay where I mapped uart1 to the pins?

Reply
  • I changed the device in the build configuration to nrf52840dongle_nrf52840

    In the code I changed this line from:

    const struct device *uart1 = DEVICE_DT_GET(DT_NODELABEL(uart1));

    to:
    const struct device *uart1 = DEVICE_DT_GET(DT_NODELABEL(cdc_acm_uart));
    When I Build Configration I get the following errors:

    d:\nrf\observer\build\zephyr\include\generated\devicetree_generated.h:12112:38: error: 'DT_N_S_soc_S_uart_40028000_P_current_speed' undeclared here (not in a function); did you mean 'DT_N_S_soc_S_uart_40002000_P_current_speed'?
    12112 | #define DT_N_NODELABEL_uart1 DT_N_S_soc_S_uart_40028000
    | ^~~~~~~~~~~~~~~~~~~~~~~~~~
    D:\ncs\v2.4.0\zephyr\include\zephyr\devicetree.h:4051:29: note: in definition of macro 'DT_CAT3'
    4051 | #define DT_CAT3(a1, a2, a3) a1 ## a2 ## a3
    | ^~
    D:\ncs\v2.4.0\zephyr\drivers\serial\uart_nrfx_uarte.c:1946:41: note: in expansion of macro 'DT_PROP'
    1946 | #define UARTE_PROP(idx, prop) DT_PROP(UARTE(idx), prop)
    | ^~~~~~~
    D:\ncs\v2.4.0\zephyr\include\zephyr\devicetree.h:4049:24: note: in expansion of macro 'DT_N_NODELABEL_uart1'
    4049 | #define DT_CAT(a1, a2) a1 ## a2
    | ^~
    D:\ncs\v2.4.0\zephyr\include\zephyr\devicetree.h:192:29: note: in expansion of macro 'DT_CAT'
    192 | #define DT_NODELABEL(label) DT_CAT(DT_N_NODELABEL_, label)
    | ^~~~~~
    D:\ncs\v2.4.0\zephyr\drivers\serial\uart_nrfx_uarte.c:1944:41: note: in expansion of macro 'DT_NODELABEL'
    1944 | #define UARTE(idx) DT_NODELABEL(uart##idx)
    | ^~~~~~~~~~~~
    D:\ncs\v2.4.0\zephyr\drivers\serial\uart_nrfx_uarte.c:1946:49: note: in expansion of macro 'UARTE'
    1946 | #define UARTE_PROP(idx, prop) DT_PROP(UARTE(idx), prop)
    | ^~~~~
    D:\ncs\v2.4.0\zephyr\drivers\serial\uart_nrfx_uarte.c:2020:29: note: in expansion of macro 'UARTE_PROP'
    2020 | .baudrate = UARTE_PROP(idx, current_speed), \
    | ^~~~~~~~~~
    D:\ncs\v2.4.0\zephyr\drivers\serial\uart_nrfx_uarte.c:1975:17: note: in expansion of macro 'UARTE_CONFIG'
    1975 | UARTE_CONFIG(idx), \
    | ^~~~~~~~~~~~

    Is there somthing I need to do to proj.cfg?

    Do I still need the device tree overlay where I mapped uart1 to the pins?

Children
Related