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

Nrf51822 build ble with softdevice

Hi, i want to build my ble app with softdevice. As a result, I want to have a single .hex file that contains the sofdevice. And i am going to flash it to the nrf51822 using ST_Link v2 with openocd.

- My OS is ARCH Linux, my compiler is gcc-arm-none-eabi-7-2018-q2-update and my editor is VIM.

I am using SDK_12.3.

i just want to add the /nRF5_SDK_12.3.0_d7731ad/components/softdevice/s130/hex/s130_nrf51_2.0.1_softdevice.hex to the /nRF5_SDK_12.3.0_d7731ad/examples/ble_peripheral/ble_app_template/pca10028/s130/armgcc/Makefile.

How i can make this. Or any document/examples for this.

Parents
  • I tried what you said. but my app didn't work. When I compiled using mbed, it worked (Because mbed provides softdevice together with the app and a single .hex file). I'm trying to do it by combining it as mbed did.

  • How, exactly, did you do the merge?

    Are you certain that you had the correct SoftDevice Hex?

    How do you know that the reason your app "didn't work" was because of the SoftDevice merge?

  • Ok. I'm going to write the my instructions. All the roads I've tried.

    1-) inside "/nRF5_SDK_12.3.0_d7731ad/examples/ble_peripheral/ble_app_template/pca10028/s130/armgcc" folder (no errors)

         - $make # it give me "_build/nrf51822_xxac.hex" file

         #openocd

         - reset halt

         - nrf51 mass_erase

         - program /nRF5_SDK_12.3.0_d7731ad/components/softdevice/s130/hex/s130_nrf51_2.0.1_softdevice.hex verify

         - reset halt       # sometimes i don't use it.

         - program /nRF5_SDK_12.3.0_d7731ad/examples/ble_peripheral/ble_app_template/pca10028/s130/armgcc/_build/nrf51822_xxac.hex verify

         - reset

    And this didn't work. my phone didn't seems my ble device.

    2-) I used mergehex for merging this files.

    "/nRF5_SDK_12.3.0_d7731ad/examples/ble_peripheral/ble_app_template/pca10028/s130/armgcc/_build/nrf51822_xxac.hex"

    And

    "/nRF5_SDK_12.3.0_d7731ad/components/softdevice/s130/hex/s130_nrf51_2.0.1_softdevice.hex"

    $mergehex /nRF5_SDK_12.3.0_d7731ad/components/softdevice/s130/hex/s130_nrf51_2.0.1_softdevice.hex  /nRF5_SDK_12.3.0_d7731ad/examples/ble_peripheral/ble_app_template/pca10028/s130/armgcc/_build/nrf51822_xxac.hex -o out.hex

    And opload nrf51822 with:

       -$openocd

        - reset halt

        - nrf51 mass_erase

         - program out.hex verify

        - reset

    This didn't work either.(no errors)

    3) Just uploading this file. (no errors)

        - $openocd

        - reset halt

        - nrf51 mass_erase

         - program /nRF5_SDK_12.3.0_d7731ad/examples/ble_peripheral/ble_app_template/hex/ble_app_template_pca10028_s130.hex verify

         - reset

    It worked smoothly and seen by my phone. (no errors)

    4-) I goes to the mbed and i compile this file. "https://os.mbed.com/teams/Bluetooth-Low-Energy/code/BLE_LED/?platform=Nordic-nRF51-DK"

    - i compiled it and it gives me "BLE_LED_NRF51822.hex" file. And i upload it the nrf51822 with:

     -$openocd

        - reset halt

        - nrf51 mass_erase

        - program /Downloads/BLE_LED_NRF51822.hex verify

    This worked without any problems. Because mbed gives me ble app .hex file and softdevice .hex files together inside a single .hex file.(no errors)

    My idea is that when I tried to flash ble_app in step 1 the previously installed softdevice .hex file may be deleted. Steps 3 and 4 worked. The reason I installed the ble_app file in the softdevice .hex file to be found.

    What can i do?

Reply
  • Ok. I'm going to write the my instructions. All the roads I've tried.

    1-) inside "/nRF5_SDK_12.3.0_d7731ad/examples/ble_peripheral/ble_app_template/pca10028/s130/armgcc" folder (no errors)

         - $make # it give me "_build/nrf51822_xxac.hex" file

         #openocd

         - reset halt

         - nrf51 mass_erase

         - program /nRF5_SDK_12.3.0_d7731ad/components/softdevice/s130/hex/s130_nrf51_2.0.1_softdevice.hex verify

         - reset halt       # sometimes i don't use it.

         - program /nRF5_SDK_12.3.0_d7731ad/examples/ble_peripheral/ble_app_template/pca10028/s130/armgcc/_build/nrf51822_xxac.hex verify

         - reset

    And this didn't work. my phone didn't seems my ble device.

    2-) I used mergehex for merging this files.

    "/nRF5_SDK_12.3.0_d7731ad/examples/ble_peripheral/ble_app_template/pca10028/s130/armgcc/_build/nrf51822_xxac.hex"

    And

    "/nRF5_SDK_12.3.0_d7731ad/components/softdevice/s130/hex/s130_nrf51_2.0.1_softdevice.hex"

    $mergehex /nRF5_SDK_12.3.0_d7731ad/components/softdevice/s130/hex/s130_nrf51_2.0.1_softdevice.hex  /nRF5_SDK_12.3.0_d7731ad/examples/ble_peripheral/ble_app_template/pca10028/s130/armgcc/_build/nrf51822_xxac.hex -o out.hex

    And opload nrf51822 with:

       -$openocd

        - reset halt

        - nrf51 mass_erase

         - program out.hex verify

        - reset

    This didn't work either.(no errors)

    3) Just uploading this file. (no errors)

        - $openocd

        - reset halt

        - nrf51 mass_erase

         - program /nRF5_SDK_12.3.0_d7731ad/examples/ble_peripheral/ble_app_template/hex/ble_app_template_pca10028_s130.hex verify

         - reset

    It worked smoothly and seen by my phone. (no errors)

    4-) I goes to the mbed and i compile this file. "https://os.mbed.com/teams/Bluetooth-Low-Energy/code/BLE_LED/?platform=Nordic-nRF51-DK"

    - i compiled it and it gives me "BLE_LED_NRF51822.hex" file. And i upload it the nrf51822 with:

     -$openocd

        - reset halt

        - nrf51 mass_erase

        - program /Downloads/BLE_LED_NRF51822.hex verify

    This worked without any problems. Because mbed gives me ble app .hex file and softdevice .hex files together inside a single .hex file.(no errors)

    My idea is that when I tried to flash ble_app in step 1 the previously installed softdevice .hex file may be deleted. Steps 3 and 4 worked. The reason I installed the ble_app file in the softdevice .hex file to be found.

    What can i do?

Children
Related