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.

Parents
  • Only a couple of items have to be changed, maybe check to see if you have these. I don't recall having to make any changes to flash or memory placement.

    // LED definitions for PCA10059
    // Each LED color is considered a separate LED
    #define LEDS_NUMBER    4
    
    #define LED1_G         NRF_GPIO_PIN_MAP(0,6)
    #define LED2_R         NRF_GPIO_PIN_MAP(0,8)
    #define LED2_G         NRF_GPIO_PIN_MAP(1,9)
    #define LED2_B         NRF_GPIO_PIN_MAP(0,12)
    
    #define LED_1          LED1_G
    #define LED_2          LED2_R
    #define LED_3          LED2_G
    #define LED_4          LED2_B
    
    #define LEDS_ACTIVE_STATE 0
    
    #define LEDS_LIST { LED_1, LED_2, LED_3, LED_4 }
    
    #define LEDS_INV_MASK  LEDS_MASK
    
    #define BSP_LED_0      LED_1
    #define BSP_LED_1      LED_2
    #define BSP_LED_2      LED_3
    #define BSP_LED_3      LED_4
    
    // There is only one button for the application
    // as the second button is used for a RESET.
    #define BUTTONS_NUMBER 1
    
    #define BUTTON_1       NRF_GPIO_PIN_MAP(1,6)
    #define BUTTON_PULL    NRF_GPIO_PIN_PULLUP
    
    #define BUTTONS_ACTIVE_STATE 0
    
    #define BUTTONS_LIST { BUTTON_1 }
    
    #define BSP_BUTTON_0   BUTTON_1
    
    #define BSP_SELF_PINRESET_PIN NRF_GPIO_PIN_MAP(0,19)

    They are in the separate file "pca10059.h" which is included by specifying BOARD_PCA10059 instead of BOARD_PCA10056 in the project C++ pre-processor.. If you have this already, ignore my answer (posting as fyi for others).

Reply
  • Only a couple of items have to be changed, maybe check to see if you have these. I don't recall having to make any changes to flash or memory placement.

    // LED definitions for PCA10059
    // Each LED color is considered a separate LED
    #define LEDS_NUMBER    4
    
    #define LED1_G         NRF_GPIO_PIN_MAP(0,6)
    #define LED2_R         NRF_GPIO_PIN_MAP(0,8)
    #define LED2_G         NRF_GPIO_PIN_MAP(1,9)
    #define LED2_B         NRF_GPIO_PIN_MAP(0,12)
    
    #define LED_1          LED1_G
    #define LED_2          LED2_R
    #define LED_3          LED2_G
    #define LED_4          LED2_B
    
    #define LEDS_ACTIVE_STATE 0
    
    #define LEDS_LIST { LED_1, LED_2, LED_3, LED_4 }
    
    #define LEDS_INV_MASK  LEDS_MASK
    
    #define BSP_LED_0      LED_1
    #define BSP_LED_1      LED_2
    #define BSP_LED_2      LED_3
    #define BSP_LED_3      LED_4
    
    // There is only one button for the application
    // as the second button is used for a RESET.
    #define BUTTONS_NUMBER 1
    
    #define BUTTON_1       NRF_GPIO_PIN_MAP(1,6)
    #define BUTTON_PULL    NRF_GPIO_PIN_PULLUP
    
    #define BUTTONS_ACTIVE_STATE 0
    
    #define BUTTONS_LIST { BUTTON_1 }
    
    #define BSP_BUTTON_0   BUTTON_1
    
    #define BSP_SELF_PINRESET_PIN NRF_GPIO_PIN_MAP(0,19)

    They are in the separate file "pca10059.h" which is included by specifying BOARD_PCA10059 instead of BOARD_PCA10056 in the project C++ pre-processor.. If you have this already, ignore my answer (posting as fyi for others).

Children
  • 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