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

nRF52840 Dongle programming for Windows

I need to write a Windows program that talks to the nRF52840 Dongle.  Is there a .dll or .lib or source code for communicating with the Dongle?  I have programmed the dongle with s140_nrf52_6.1.0_softdevice.hex.  I can not find any documentation of the actual interface that is seen on the PC.  Is it just operated via commands over the COM port?  Are these commands documented?  Where can I find this documentation?

I also need an application to use the nRF52840 Dongle in a pass-through UART mode.  Do I need to load a different hex file into it for that?  Where can I get that?  Is there documentation of the GATT service and characteristic UUIDs for this code?

Thanks!

  • More: I found the GATT definitions for ble_app_uart, which looks like the code I need for the pass-through mode.  Can I program ble_app_uart_pca10056_s140.hex into the PCA10059 dongle?  How do I do that?  I tried using nrfutil, but it would not program my dongle.

    I tried these commands to build a package and then program the dongle:

    nrfutil pkg generate --hw-version 52 --application-version 4 --sd-req 0xA9 --application ble_app_uart_pca10056_s140.hex app_dfu_package.zip

    nrfutil dfu serial -pkg app_dfu_package.zip -p COM4 -b 115200

    Is there a package I can download for this?

  • Hi,

    You can program the nRF52840 with the connectivity firmware (ser_s140_usb_hci) if you want to control it from a PC over USB. On the PC side you would use the pc-ble-driver, or a higher level application that use it (such as nRF Connect for Desktop or nrfutil). The pc-ble-driver then communicates with the nRF using the serialization API.

    What exactly do you mean by passthrough UART mode? UART to BLE? If so, then the NUS service used in the ble_app_uart example that you already found is what you need. You can program the SDK example, but as the nRF52840 dongle does not have an onboard debugger this needs to be done via USB DFU, as explained under  Getting started and Programming in the nRF52840 dongle documentation. Not that there are some issues with the current version of the nRF Connect programmer, so you may be better of using the nrfutil command line tool at this point in time.

  • Sorry, I am still having some problems.

    1. I searched for ser_s140_usb_hci that you mention but I don't find it anywhere.  Can you provide a link?  What is it?

    2. nRF Connect only shows 5 apps I can run.  One of them (Bluetooth Low Energy) installs software on the dongle before running and runs successfully.  This is the only way I have found to put code containing SoftDevice into the dongle.  I have read the Getting Started and Programming links.

    3. I have tried to use the Programmer app launched by nRF Connect.  This gives me the error "Only a single writable region is supported".  Why is this?  I can program an app that does not use SoftDevice, but, for example, connectivity_2.0.1_1m_with_s132_5.0.hex in pc-ble-driver-master\hex\sd_api_v5 contains SoftDevice and will not program this way.

    4. I have tried nrfjprog, but I get this error: "ERROR: There is no debugger connected to the PC."

    5. I have tried nrfutil.  I first ran this command to make a DFU package (no errors):

    nrfutil pkg generate --hw-version 52 --sd-req 0x9D --application-version 5 --application connectivity_2.0.1_1m_with_s132_5.0.hex app_dfu_package.zip

    I then ran this command:

    nrfutil dfu usb_serial -pkg app_dfu_package.zip -p COM4 -b 115200

    which, after some chatter, gives this error:

    pc_ble_driver_py.exceptions.NordicSemiException: Extended Error 0x07: The array of supported SoftDevices for the update does not contain the FWID of the current SoftDevice.

    I pushed the button on the dongle to make the red light flash before doing this.  How do I use nrfutil to program the Dongle?

  • Here is some more info:

    I managed to make a package that nrfutil will program into the Dongle using this command:

    nrfutil pkg generate --hw-version 52 --sd-req 0x8C --application-version 5 --application connectivity_2.0.1_1m_with_s132_5.0.hex app_dfu_package.zip

    This is confusing because the documentation output from nrfutil says FWID 0x8C is the code for s132_nrf52_3.0.0, and the code for s132_nrf52_5.0.0 should be 0x9D.  Is this a documentation bug?

    In any case, after programming the dongle with this, I no longer see any COM ports from the dongle.

    Now what do I do?

    Is is possible for you to give me a list of programs to run with command line arguments to get to the point where I can see a com port from the dongle that communicates with my bluetooth device that is handling the other end of the BLE_UART?

  • Hi, 

    You will not get the NUS to UART over USB out of the box, as we do not have any such example for the nRF52840 dongle. You have to implement it yourself. Either by making a NUS to USB serial bridge firmware for the nRF52840 yourself, or by using the connectivity firmware and pc-ble-driver approach that we have discussed. In that case you have to implement most of the functionality on the PC side (including the Nordic UART firmware), as the nRF52840 will simply be a connectivity chip.

    Alternatively, if this is something you want to get done quickly for using it as a debug tool or similar, you would be much better of getting a nRF52840 DK (or another nRF52 DK for that matter), which has onboard debugger that has the UART over USB to NUS "bridge" already implemented (via the onboard Segger debugger IC that does the USB-UART bridging).

    Regarding the --sd-req option to nrfutil this depend on the SoftDevice that is already programmed to the device, so assuming it is version 3, then you should state that your app requires it.

Related