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

nRF Dongle stops after impementing ble_nus

Hi,

I have created a project with nRF52840 DK  that reads sensors data and transmits them with BLE UART to my smartphone. Everything works fine.

Then, I tried to do the same thing with the nRF Dongle. Initially, I took the ble_app_template example and modified the .emProject file and flash_placement.xml file

as mentioned in the guides shown in the following links :

https://devzone.nordicsemi.com/tutorials/b/getting-started/posts/nrf52840-dongle-programming-tutorial

https://www.novelbits.io/nrf52840-usb-dongle-tutorial-2/

The dongle started advertising (blinking green LED) and  my smartphone could recognize it as I expected . So far so good.

Next I initialized the ble_nus the same way it is implemented in the ble_app_uart example for the DK. I also enabled the app_uart and app_fifo in the sdk_config (since NUS needs them enabled).

When I built and uploaded the .hex and softdevice files with nRF Connect GUI to the Dongle it could not advertise. The green LED was not blinking and I could not Identify the dongle peripheral from my smartphone as before.

I connected the dongle to the nRF52 DK  (P19 connector) and started a debug session. I noticed that an error occurs when the program reaches to services_init() function, inside the ble_nus_init() function, at the characteristic_add() function. At this point the function returns an error (0x00000004) and the characteristic is not added. Then the program goes to app_error_fault_handler and halts .

I cannot understand what I do wrong here. Any ideas?

Thank you for your time.

  • The global errors are defined in (components\softdevice\s140\headers\) nrf_error.h:

    #define NRF_ERROR_NO_MEM    (NRF_ERROR_BASE_NUM + 4)  ///< No Memory for operation

    My guess would be that you have not increased the config NRF_SDH_BLE_VS_UUID_COUNT in your sdk_config.h file. You will most likely also have to increase the RAM size allocated for the softdevice when increasing this.

    Also notice that the default UART pins from the development kits are used for LEDs in the Dongle hardware. You should use different pins when configuring app_uart, or you might see errors on the UART peripheral. There is also no UART to USB interface on the dongle, like there are in the DK. If you want to interface the Dongle to a terminal through the USB interface, you will have to do that using the USBD CDC ACM library. There is a ready made example for ble_app_uart with USBD support in the SDK, which should be easily adaptable to use with the Dongle - see this tutorial.

  • Hi, again, I think I have found what causes the dongle not to advertise but I will need your help to understand why.

    1. When I upload  the ble_uart project and the softdevice(from project options -->  loader) to the dongle with the debugger of the DK, the dongle will not advertise and it cannot be discovered by smartphone. 

    2. When I upload the same project to the dongle with nRFConnect the dongle starts advertising with no problem.

    I believe that it has something to do  with the bootloader of the dongle because

    in  1st case, I erase the bootloader from the dongle so as I can run a debug session through debug-out connector.

    In 2nd case, I reload the bootloader to the dongle so that I can upload the project's .hex file and soft device with nRF connect.

    One more possibility  is that, in the 1st case the soft device .hex is not being *uploaded to the dongle along with the project's .hex file.

    * The way I upload the softdevice to the dongle is by setting the soft-device .hex file path in the project's options loader session of the debug tab.

    Thank you for your time

Related