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

nRF52840 combining ble_app_blinky + ble_app_buttonless_dfu

I am working with an nRF52840 on a custom board. Our device has a number of sensor attached in various ways including spim, twim, uart. I've used the ble_app_blinky as a starting point, and have a app that is doing things periodically, but has integrated a number of custom ble services which interact with a ble app. For testing, I've been typically been using nRF Connect on an Android tablet. The app has morphed over a period of a few weeks, but is functional. However, I've also been using the open bootloader and usb to update the firmware.

Recently, I've adapted the ble_app_buttonless_dfu to work on our custom board. I've also adapted the secure_bootloader project for our board. Along these lines, I've been able to use the DFU tool in the nRF toolbox app for Android to update the device firmware.

The next step was to integrate the buttonless dfu into our previously working app. I've ran into some trouble, and need some advice on how to proceed.

I have made a few clones of the app so I can experiment, and describe the behavior I am seeing. It appears much of the base code in ble_app_blinky and ble_app_buttonless_dfu is similar. The primary difference I see is the advertising mechanism. I have one version using the advertising scheme from the buttonless dfu app. When I run this version, after the  advertising_start() function, the app will report:

<error> app: Fatal error
<warning> app: System reset

and then reboot. This process repeats continually.

A second clone of the app uses the advertising scheme from the ble_app_blinky project. The calls are very different as are the data structures. When I run the app in this case, it gets through all the initialization code, and appears to run correctly. However, when I try to "connect" using a nrf connect, the app will immediately report the same fatal error and reset. The app will run just fine right until I try to connect.

The sdk_config.h files for each project is based on the base project's files, but have been modified to make the code run. The ble_app_blinky version is much more complex. I've attempted to use that one as the starting point, and have added the missing parts so the project compiles and runs. This is the place I've usually needed to edit to make things work in other projects.

I also made a third clone, but this time used the buttonless_dfu's sdk_config.h as the starting point, and added the missing content from the ble_app_blinky's config file. This project is currently failing much earlier. I have code which uses a button to trigger some code. The call to ble_lbs_init() is causing immediate failure and reboot.

Sorry for the long message, but been stumped on making any progress on this.

Parents
  • The NRF_ERROR_NO_MEM would refer to this function in the code.

    static void conn_params_error_handler(uint32_t nrf_error)
    {
       APP_ERROR_HANDLER(nrf_error);
    }

    In that firmware, the app would work indefinitely right until I would try to connect via BLE, then I would get the error.

     

    I will need to try to add in the additional code in the main for loop() again. I disabled the timer which was causing the connection issue.

    In the meantime, I added the NUS service and code which supports data transfers. The outbound transfer code is in the main for loop and it seems to work just fine. 

Reply
  • The NRF_ERROR_NO_MEM would refer to this function in the code.

    static void conn_params_error_handler(uint32_t nrf_error)
    {
       APP_ERROR_HANDLER(nrf_error);
    }

    In that firmware, the app would work indefinitely right until I would try to connect via BLE, then I would get the error.

     

    I will need to try to add in the additional code in the main for loop() again. I disabled the timer which was causing the connection issue.

    In the meantime, I added the NUS service and code which supports data transfers. The outbound transfer code is in the main for loop and it seems to work just fine. 

Children
Related