This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF51DK USB serial allows for printing logs (via RTT), but what about writing to the nrf51422 and receiving commands via USB, how is that done?

Hey, 

I am using nRF51DK  and have used it to print logs for debugging (via RTT)

If I wish now to have a full terminal capability, and to write to the nrf51422 as well just using the USB interface of the DK, receiving commands and messages from the PC via USB to the nrf51422 , how is that done?

I didn't find any example or a description for such an implemention,

Thanks!

  • Hi,

    More recent versions of the nRF5 SDK includes a CLI, which can use both RTT and UART. This is not supported in the older SDK's though, including SDK 12.3, which i is the latest supporting nRF51. For the nRF51 I suspect the simplest would be to make a terminal implementation based on UART, but I do not have any examples to refer to.

  • Hey Einar,

    Do you mean using different IO for implementation of UART unrelated to the USB interface?

    in what SDK version there is support for UART over the existing USB terminal?

    Thanks!

  • Hi,

    Ron said:
    Do you mean using different IO for implementation of UART unrelated to the USB interface?

    No. The USB interface on the DK is connected to the onboard debugger. This also acts as a USB-UART bridge, so you can use both UART as well as RTT to interface with the nRF. Both are valid options.

    Ron said:
    in what SDK version there is support for UART over the existing USB terminal?

    That is supported in all nRF5 SDK versions I believe, and certainly in SDK 12.3 and newer (and much older). But this is for logging only, so no CLI interface. It is possible to implement it, but it is not present in that SDK. You could refer to NRF_LOG_GETCHAR() if you want to look at this approach though, as it allows you to read single characters. Expanding on this would give you proper two-way communication. (Or you could do it in a completely different way if you prefer so).

  • Hey Einar,

    So there is no example for the implementation of the USB-UART bridge, are there any other descriptions/notes you can direct me to? in the sdk_config.h  should nRF_Log be enabled or disabled?

    Thanks again

  • Hi,

    Ron said:
    So there is no example for the implementation of the USB-UART bridge, are there any other descriptions/notes you can direct me to?

    Any UART example in the SDK can be used with the USB-UART bridge. The default UART pin configuration in the SDK examples use the pins connected to the onboard debugger, so this will work out of the box. You can refer to for instance the UART example. (This will not give you terminal, but you will have bidirectional UART communication).

    Ron said:
    in the sdk_config.h  should nRF_Log be enabled or disabled?

    That depends on which approach you use. If you want to use UART with nrf_log, then you cannot also use it for something else, as there is just one UART peripheral. So in the UART example I link to above, nrf_log cannot be used.

Related