This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to use USB in nRF52840 Dongle as UART?

Hi,

I want to develop simple app that receives data via BLE and send it through UART so I could gather them to file or draw a real-time chart in SerialPlot.

As far as I know, the dongle doesn't have debugger that's used in "NRF_LOG" functions' family and UART RX/TX pins aren't connected anywhere outside.

Anyway, there must be some way (nRF Connect programs the dongle somehow). How to do this in my application? Maybe there's some example that I didn't find?

Or maybe some crazy idea - what if I soldered UART's RX/TX to USB's RX/TX?

Parents
  • 1) Suppose I want to use "heart_rate_collector" example (from "\examples\heart_rate_collector" of "pc-ble-driver" repository) - just to compile the .hex file. What am I supposed to do?
    I tried to follow the "Getting started with examples" from:

    https://github.com/NordicSemiconductor/pc-ble-driver/tree/master/examples

    but it brings me back to problem with ASIO_INCLUDE_DIR, because I have to:

    cmake -G Ninja ..

    due to no makefile in "build/examples" directory. I'm more and more confused.
    2) Does "printf" function from example above send data via USB? Because that's what I'm looking for - to receive data via BLE and redirect them to VCOM on my PC.

  • Hi,

     

    Kubek said:
    cmake -G Ninja ..

    This generates ninja files: https://ninja-build.org/

    To generate gnu makefiles, just omit the "-G" and it will default back to makefiles.

    Kubek said:
    but it brings me back to problem with ASIO_INCLUDE_DIR

    Did you install libasio-dev?

    Kubek said:
    2) Does "printf" function from example above send data via USB? Because that's what I'm looking for - to receive data via BLE and redirect them to VCOM on my PC.

    Did you have a look at the nRF5 SDK usb cdc example, or the examples/peripheral/usbd_ble_uart?

     

    Kind regards,

    Håkon

  • 1)

    Without -G:

    With -G:


    2) I meant "\examples\heart_rate_collector" from "pc-ble-driver" repository, not a nRF SDK examples. But you may suggest any working example from SDK too. If only it's gonna work for me :D 

  • Hi,

     

    it looks like your system does not have catch2 (it is in ubuntu 20.10 and newer):

    https://packages.ubuntu.com/search?suite=default&section=all&arch=any&keywords=catch2&searchon=names

    Kubek said:
    I meant "\examples\heart_rate_collector" from "pc-ble-driver" repository, not a nRF SDK examples. But you may suggest any working example from SDK too. If only it's gonna work for me :D 

    Based on your former description, you want to get bluetooth data printed to your PC. The examples that I posted are USB CDC (ie. usb->uart bridge), and one of them even implements BLE UART + USB CDC. Have you tried the usbd_ble_peripheral example in the nRF5 SDK to see if it fits your requirement?

     

    Kind regards,

    Håkon

  • 1)

    I use Ubuntu 20.04, and I had installed "catch2" before, according to:
    https://github.com/etaler/Etaler/issues/33

    It didn't help me much. If I remember correctly, then I installed "clang-tidy" and wasn't sure if made it correctly (I described it 13 days ago).
    Anyway, I installed "groovy", because it was on the list of packages that might include "catch2". It didn't help too.

    2)

    I tried "usbd_ble_uart" example (on DK, not dongle yet) and I'm confused. Firstly, I attached only "main USB" cable and DK appeared as COM8. And CDC ACM was unavailable. Once I connected "nRF USB" too, logs claimed that USB is ready, but there was no another COM ports available, and logs from handling data recevied via Nordic UART Service claim that CDC ACM is still unavailable.

    I checked in Windows' Device Manager, and seems there's problem with that another USB:

    It's unknown USB device (descriptor request failed).

    I checked that issue here:

    https://devzone.nordicsemi.com/f/nordic-q-a/59010/unknown-usb-device-device-descriptor-request-failed-with-nrf-usb-port-after-sniffer-firmware

    And yes, my DK is Preview one. Does that might be issue?

    Finally, I want to make an application for dongle, not DK - can I just port that example above to PCA100059 and it should work fine? I guess "nRF USB" from DK is quite the same as regular only exiisting USB in dongle?

  • Hi,

     

    Kubek said:
    And yes, my DK is Preview one. Does that might be issue?

    Yes, this is problematic. Preview kit has older engineering silicon, which isn't supported in the SDK.

    Kubek said:

    Finally, I want to make an application for dongle, not DK - can I just port that example above to PCA100059 and it should work fine? I guess "nRF USB" from DK is quite the same as regular only exiisting USB in dongle?

    The dongle does not have a dedicated programmer, but instead uses a bootloader. You will have to adapt the project for PCA10059, as described in this guide (see section with softdevice):

    https://devzone.nordicsemi.com/nordic/short-range-guides/b/getting-started/posts/nrf52840-dongle-programming-tutorial

     

    Kind regards,

    Håkon

  • Okey, so I will try to port example from PCA10056 to PCA10059 on my dongle and program it via NRF Connect Programmer app.

    It's uplifting that this example should work fine and CDC USB is what I'm looking for - it should appear as a regular COM port.

    Anyway - since the sillicon in Preview-DK and actual DK (and the packages sold for soldering on PCB as well, I think) are different, is this a bad idea to use Preview-DK for prototyping? I will have to design a device with a button, a few LEDs, ADC and BLE.

Reply
  • Okey, so I will try to port example from PCA10056 to PCA10059 on my dongle and program it via NRF Connect Programmer app.

    It's uplifting that this example should work fine and CDC USB is what I'm looking for - it should appear as a regular COM port.

    Anyway - since the sillicon in Preview-DK and actual DK (and the packages sold for soldering on PCB as well, I think) are different, is this a bad idea to use Preview-DK for prototyping? I will have to design a device with a button, a few LEDs, ADC and BLE.

Children
  • Hi,

     

    Kubek said:
    Anyway - since the sillicon in Preview-DK and actual DK (and the packages sold for soldering on PCB as well, I think) are different, is this a bad idea to use Preview-DK for prototyping? I will have to design a device with a button, a few LEDs, ADC and BLE.

    It is a strong recommendation to use the same silicon version as you're planning to go into production with.

     

    Kind regards,

    Håkon

  • Hey,
    I tried the example with actual DK, and it works pretty fine. Next I ported it from PCA10056 to PCA10059 and it works fine too. Finally I found solution for my requirements. Now I just need to adjust the examples to my project (just to switch from Nordic UART Service to my custom service) and establish comunication between DK and Dongle, but if I had any extraordinary problem I would start a new thread on the forum.
    Thank you a lot for patience, lots of useful information about all those Nordic's tool.
    After all those experiences, I think that whole Nordic's stuff for BLE etc. needs some extra simple explanations for rookies who have no much experience and feel confused about at the beggining. It's always way much easier when you have a tutor who introduces you into basics and some important details.
    And again, thank you a lot. Seems you have another satisfied egnineer who's gonna recommend Nordic for radio applications :) 

Related