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

How to compile 'connectivity firmware' from SDK example ?

Hi,

I  tried to use BLE DFU with nrfutil on my nrf52832 custom boards, but always get the result of 'Failed to open. Error code: 13', so I am trying to build the connectivity firmware from SDK ble_connectivity example for better debugging.
Things I have tried:
- nrfutil is able to perform serial DFU with both my 2 boards. (one board need to change UART pin setting, and another need to disable HWFC)

- Both 2 boards are not able to do BLE DFU with default connectivity firmware (I have erased the chip then used nrfutil with '-f' argument to flash the fw, and confirm the fw is written)

- Patch the SDK and build the ble_connectivity example, enable RTT log out, check the UART response. The board is able to received data, but seems they are always repeat the first negotiation.
 

I am not sure if I was doing right with the SDK build, these are my procedures:
1. Download nRF5_SDK_15.2.0_9412b96
2. Clone pc-ble-driver from github, and switch to the branch 'v4.0.0'
3. Patch the sdk with the following command 'git apply --ignore-whitespace ../pc-ble-driver/hex/nRF5_SDK_15.2.0_connectivity.patch', and confirm there are no errors and make sure the SDK files are patched.
4. Open ble_connectivity example projects with SES, use my custom board settings and build. I have tried 'examples\connectivity\ble_connectivity\pca10040\ser_s132_hci' , 'ser_s132v3_hci' and 'ser_s132v5_hci'

Questions:
1. Is the above procedures correct?
2. Why there is no 'ser_s132v6_hci' project? But there are compiled hex files under '\hex\sd_api_v6\' of the pc-ble-driver v4.0.0 branch.
3. What SDK project/board type will be built if I used the CMAKE method mentioned in the README.md of the 'pc-ble-driver'? (At the 'Compiling-connectivity-HEX-files' section)
https://github.com/NordicSemiconductor/pc-ble-driver#Compiling-connectivity-HEX-files
4. Which version of the nrfutil is suggested? I have tried the python pip installed one, and another exe file downloaded from the v5.0.0 release.
https://github.com/NordicSemiconductor/pc-nrfutil/releases
5. And which version of the 'ser_s132vxx_hci'  project is corresponded to the suggested version of the nrfutil?

Thanks,
Dabinn

  • Update the RTT log.
    Tested with 'ser_s132v3_hci', SDK 15.2.0 patched with pc-ble-driver v4.0.0, and nrfutil 4.0.0

    ------ test board started -----------
    <info> app: BLE connectivity started
    <warning> UARTE: Function: nrfx_uarte_init, error code: NRF_SUCCESS.
    <info> UARTE: Transfer rx_len: 1.
    <debug> UARTE: Rx data:
    <debug> UARTE:  00                     |.       
    <info> UARTE: Function: nrfx_uarte_rx, error code: NRF_SUCCESS.
    <debug> app: sdh enabled.
    <info> UARTE: Transfer tx_len: 8.
    <debug> UARTE: Tx data:
    <debug> UARTE:  C0 00 2F 00 D1 01 7E C0|../...~.
    <info> UARTE: Function: nrfx_uarte_tx, error code: NRF_SUCCESS.
    
    
    
    
    -------- nrfutil started to run --------------
    <info> UARTE: Transfer rx_len: 1.
    <debug> UARTE: Rx data:
    <debug> UARTE:  C0                     |.       
    <info> UARTE: Function: nrfx_uarte_rx, error code: NRF_SUCCESS.
    <info> UARTE: Transfer rx_len: 1.
    <debug> UARTE: Rx data:
    <debug> UARTE:  00                     |.       
    <info> UARTE: Function: nrfx_uarte_rx, error code: NRF_SUCCESS.
    <info> UARTE: Transfer rx_len: 1.
    <debug> UARTE: Rx data:
    <debug> UARTE:  2F                     |/       
    
    <info> UARTE: Transfer rx_len: 1.
    
    
    <debug> UARTE: Rx data:
    <debug> UARTE:  01                     |.       
    <info> UARTE: Function: nrfx_uarte_rx, error code: NRF_SUCCESS.
    <info> UARTE: Transfer rx_len: 1.
    <debug> UARTE: Rx data:
    <debug> UARTE:  7E                     |~       
    <info> UARTE: Function: nrfx_uarte_rx, error code: NRF_SUCCESS.
    <info> UARTE: Transfer rx_len: 1.
    <debug> UARTE: Rx data:
    <debug> UARTE:  C0                     |.       
    <info> UARTE: Function: nrfx_uarte_rx, error code: NRF_SUCCESS.
    onse.
    
    
    
    
    <info> UARTE: Transfer rx_len: 1.
    <debug> UARTE: Rx data:
    <debug> UARTE:  00                     |.       
    <info> UARTE: Function: nrfx_uarte_rx, error code: NRF_SUCCESS.
    <info> UARTE: Transfer rx_len: 1.
    <debug> UARTE: Rx data:
    <debug> UARTE:  C1                     |.       
    <info> UARTE: Function: nrfx_uarte_rx, error code: NRF_SUCCESS.
    <info> UARTE: Transfer rx_len: 1.
    <debug> UARTE: Rx data:
    <debug> UARTE:  03                     |.       
    
    <info> UARTE: Transfer rx_len: 1.
    
    
    
    <info> UARTE: Transfer rx_len: 1.
    <debug> UARTE: Rx data:
    <debug> UARTE:  C0                     |.       
    <info> UARTE: Function: nrfx_uarte_rx, error code: NRF_SUCCESS.
    <info> UARTE: Transfer rx_len: 1.
    <debug> UARTE: Rx data:
    <debug> UARTE:  00                     |.       
    <info> UARTE: Function: nrfx_uarte_rx, error code: NRF_SUCCESS.
    <info> UARTE: Transfer rx_len: 1.
    <debug> UARTE: Rx data:
    <debug> UARTE:  3F                     |?       
    
    <info> UARTE: Transfer rx_len: 1.
    
    <info> UARTE: Transfer rx_len: 1.
    <debug> UARTE: Rx data:
    <debug> UARTE:  C1                     |.       
    <info> UARTE: Function: nrfx_uarte_rx, error code: NRF_SUCCESS.
    <info> UARTE: Transfer rx_len: 1.
    <debug> UARTE: Rx data:
    <debug> UARTE:  03                     |.       
    <info> UARTE: Function: nrfx_uarte_rx, error code: NRF_SUCCESS.
    <info> UARTE: Transfer rx_len: 1.
    <debug> UARTE: Rx data:
    <debug> UARTE:  FC                     |.       
    
    
    
    <info> UARTE: Transfer rx_len: 1.
    <debug> UARTE: Rx data:
    <debug> UARTE:  C0                     |.       
    <info> UARTE: Function: nrfx_uarte_rx, error code: NRF_SUCCESS.
    <info> UARTE: Transfer rx_len: 1.
    <debug> UARTE: Rx data:
    <debug> UARTE:  00                     |.       
    <info> UARTE: Function: nrfx_uarte_rx, error code: NRF_SUCCESS.
    <info> UARTE: Transfer rx_len: 1.
    <debug> UARTE: Rx data:
    <debug> UARTE:  3F                     |?       
    
    <info> UARTE: Transfer rx_len: 1.
    
    
    
    <debug> UARTE: Rx data:
    <debug> UARTE:  FC                     |.       
    <info> UARTE: Function: nrfx_uarte_rx, error code: NRF_SUCCESS.
    <info> UARTE: Transfer rx_len: 1.
    <debug> UARTE: Rx data:
    <debug> UARTE:  11                     |.       
    <info> UARTE: Function: nrfx_uarte_rx, error code: NRF_SUCCESS.
    <info> UARTE: Transfer rx_len: 1.
    <debug> UARTE: Rx data:
    <debug> UARTE:  C0                     |.       
    <info> UARTE: Function: nrfx_uarte_rx, error code: NRF_SUCCESS.
    <info> UARTE: Transfer rx_len: 1.
    <debug> UARTE: Rx data:
    <debug> UARTE:  C0                     |.       
    <info> UARTE: Function: nrfx_uarte_rx, error code: NRF_SUCCESS.
    <info> UARTE: Transfer rx_len: 1.
    <debug> UARTE: Rx data:
    <debug> UARTE:  00                     |.       
    <info> UARTE: Function: nrfx_uarte_rx, error code: NRF_SUCCESS.
    <info> UARTE: Transfer rx_len: 1.
    <debug> UARTE: Rx data:
    <debug> UARTE:  3F                     |?       
    
    <info> UARTE: Transfer rx_len: 1.
    
    
    
    <info> UARTE: Transfer rx_len: 1.
    <debug> UARTE: Rx data:
    <debug> UARTE:  FC                     |.       
    <info> UARTE: Function: nrfx_uarte_rx, error code: NRF_SUCCESS.
    <info> UARTE: Transfer rx_len: 1.
    <debug> UARTE: Rx data:
    <debug> UARTE:  11                     |.       
    <info> UARTE: Function: nrfx_uarte_rx, error code: NRF_SUCCESS.
    <info> UARTE: Transfer rx_len: 1.
    <debug> UARTE: Rx data:
    <debug> UARTE:  C0                     |.       
    
    <info> UARTE: Transfer rx_len: 1.
    <debug> UARTE: Rx data:
    <debug> UARTE:  C0                     |.       
    <info> UARTE: Function: nrfx_uarte_rx, error code: NRF_SUCCESS.
    <info> UARTE: Transfer rx_len: 1.
    <debug> UARTE: Rx data:
    <debug> UARTE:  00                     |.       
    <info> UARTE: Function: nrfx_uarte_rx, error code: NRF_SUCCESS.
    <info> UARTE: Transfer rx_len: 1.
    <debug> UARTE: Rx data:
    <debug> UARTE:  3F                     |?       
    
    <info> UARTE: Transfer rx_len: 1.
    
    <info> UARTE: Transfer rx_len: 1.
    <debug> UARTE: Rx data:
    <debug> UARTE:  C1                     |.       
    <info> UARTE: Function: nrfx_uarte_rx, error code: NRF_SUCCESS.
    <info> UARTE: Transfer rx_len: 1.
    <debug> UARTE: Rx data:
    <debug> UARTE:  03                     |.       
    <info> UARTE: Function: nrfx_uarte_rx, error code: NRF_SUCCESS.
    <info> UARTE: Transfer rx_len: 1.
    <debug> UARTE: Rx data:
    <debug> UARTE:  FC                     |.       
    
    
    
    <info> UARTE: Transfer rx_len: 1.
    <debug> UARTE: Rx data:
    <debug> UARTE:  C0                     |.       
    <info> UARTE: Function: nrfx_uarte_rx, error code: NRF_SUCCESS.
    <info> UARTE: Transfer rx_len: 1.
    <debug> UARTE: Rx data:
    <debug> UARTE:  00                     |.       
    <info> UARTE: Function: nrfx_uarte_rx, error code: NRF_SUCCESS.
    <info> UARTE: Transfer rx_len: 1.
    <debug> UARTE: Rx data:
    <debug> UARTE:  3F                     |?       
    
    <info> UARTE: Transfer rx_len: 1.
    
    <info> UARTE: Transfer rx_len: 1.
    <debug> UARTE: Rx data:
    <debug> UARTE:  C1                     |.       
    <info> UARTE: Function: nrfx_uarte_rx, error code: NRF_SUCCESS.
    <info> UARTE: Transfer rx_len: 1.
    <debug> UARTE: Rx data:
    <debug> UARTE:  03                     |.       
    <info> UARTE: Function: nrfx_uarte_rx, error code: NRF_SUCCESS.
    <info> UARTE: Transfer rx_len: 1.
    <debug> UARTE: Rx data:
    <debug> UARTE:  FC                     |.       
    
    
    
    <info> UARTE: Transfer tx_len: 8.
    <debug> UARTE: Tx data:
    <debug> UARTE:  C0 00 2F 00 D1 01 7E C0|../...~.
    <info> UARTE: Function: nrfx_uarte_tx, error code: NRF_SUCCESS.
    <debug> sphy_hci: EVT:Tx packet sent.
    <info> UARTE: Transfer rx_len: 1.
    <debug> UARTE: Rx data:
    <debug> UARTE:  C0                     |.       
    <info> UARTE: Function: nrfx_uarte_rx, error code: NRF_SUCCESS.
    <info> UARTE: Transfer rx_len: 1.
    <debug> UARTE: Rx data:
    <debug> UARTE:  00                     |.       
    
    <info> UARTE: Transfer rx_len: 1.
    <debug> UARTE: Rx data:
    <debug> UARTE:  2F                     |/       
    <info> UARTE: Function: nrfx_uarte_rx, error code: NRF_SUCCESS.
    <info> UARTE: Transfer rx_len: 1.
    
    
    
    
    
    <debug> sphy_hci: EVT:RX Link Control packet (length:6)
    <debug> sphy_hci: Link control. Sync Resposnse recieved.
    <info> UARTE: Transfer tx_len: 9.
    <debug> UARTE: Tx data:
    <debug> UARTE:  C0 00 3F 00 C1 03 FC 11|..?.....
    <debug> UARTE:  C0                     |.       
    <info> UARTE: Function: nrfx_uarte_tx, error code: NRF_SUCCESS.
    

  • Answer my self's questions.
    > 1. Is the above procedures correct?
    the CMAKE mothod update additional parameters to 2 files: 
    components/serialization/common/ser_config.h - UART speed
    examples/connectivity/ble_connectivity/main.c  - Firwemare number
    > 2. Why there is no 'ser_s132v6_hci' project? But there are compiled hex files under '\hex\sd_api_v6\' of the pc-ble-driver v4.0.0 branch.
    Softdevice 6 uses 'ser_s132_hci' project.
    v2 and 2.1 uses SDK11.
    > 3. What SDK project/board type will be built if I used the CMAKE method mentioned in the README.md of the 'pc-ble-driver'? (At the 'Compiling-connectivity-HEX-files' section)
    All type and all softdevices.
    > 4. Which version of the nrfutil is suggested? I have tried the python pip installed one, and another exe file downloaded from the v5.0.0 release.
    Not sure, 4.0 or 5.0.
    > 5. And which version of the 'ser_s132vxx_hci'  project is corresponded to the suggested version of the nrfutil?
    Not sure. The firmware comes with nrfutil still uses Softdevice 3.

  • Hi,

    Best regards

    Jared 

  • Hi,

    • I am running on Windows 10, does it needs to run as administrator?
    • Yes, one flashed connectivity FW, and the second flashed working bootloader and is availible in DFU mode ('DfuTarg' can be seen via mobile app)
    • Thank you, now I am testing with 2 SD versions, 3.1.0 and 6.1.0 , which would be suggested? Or they both work fine with nrfutil?
      And I used '4.0.0' for cmake connectivity_version parameter, is that correct? 
      cmake -G "Visual Studio 15" -DCMAKE_TOOLCHAIN_FILE=%VCPKG_ROOT%\scripts\buildsystems\vcpkg.cmake -DCOMPILE_CONNECTIVITY=1 -DCONNECTIVITY_VERSION=4.0.0 ..
  • I have built a working  'ser_s132v3_hci' by modifying the baud rate to 38400 in ser_config.h. And also modify nrfutil 5.0 to use the same baund rate. The DFU BLE is successful with this setup.
    But  'ser_s132_hci' (SD 6.0) is still not working. The board reboots when nrfutil try to 'ble_enable'. Is SD 6.0 supported by pc-ble-driver? I saw only sd_api_v2 and sd_api_v3 under pc_ble_driver_py directory.

    nrfutl output:

    File "D:\pc-nrfutil\nordicsemi\dfu\dfu_transport_ble.py", line 116, in open
        self.adapter.driver.ble_enable(ble_enable_params)
    File "C:\Python27\lib\site-packages\wrapt\wrappers.py", line 603, in __call__
        args, kwargs)
    File "C:\Python27\lib\site-packages\pc_ble_driver_py\ble_driver.py", line 127, in wrapper
        raise NordicSemiException('Failed to {}. Error code: {}'.format(wrapped.__name__, err_code))
    pc_ble_driver_py.exceptions.NordicSemiException: Failed to ble_enable. Error code: 3

    RTT log:
    <info> app: BLE connectivity started
    <debug> nrf_sdh: State request: 0x00000000
    <debug> nrf_sdh: State change: 0x00000000
    <debug> nrf_sdh: State change: 0x00000001
    <debug> app: sdh enabled.
    <debug> sphy_hci: EVT:Tx packet sent.
    <debug> sphy_hci: EVT:Tx packet sent.
    <info> app: BLE connectivity started
    <debug> nrf_sdh: State request: 0x00000000
    <debug> nrf_sdh: State change: 0x00000000
    <debug> nrf_sdh: State change: 0x00000001
    <debug> app: sdh enabled.
    <debug> sphy_hci: EVT:RX Link Control packet (length:6)
    <debug> sphy_hci:  00 2F 00 D1 01 7E      |./...~  
    <debug> sphy_hci: Link control. Sync received, sending Sync Response.
    <debug> sphy_hci: EVT:Tx packet sent.
    <debug> sphy_hci: EVT:RX Link Control packet (length:7)
    <debug> sphy_hci:  00 3F 00 C1 03 FC 11   |.?..... 
    <debug> sphy_hci: EVT:RX Link Control packet (length:7)
    <debug> sphy_hci:  00 3F 00 C1 03 FC 11   |.?..... 
    <debug> sphy_hci: EVT:RX Link Control packet (length:7)
    <debug> sphy_hci:  00 3F 00 C1 03 FC 11   |.?..... 
    <debug> sphy_hci: EVT:RX Link Control packet (length:7)
    <debug> sphy_hci:  00 3F 00 C1 03 FC 11   |.?..... 
    <debug> sphy_hci: EVT:Tx packet sent.
    <debug> sphy_hci: EVT:RX Link Control packet (length:6)
    <debug> sphy_hci:  00 2F 00 D1 02 7D      |./...}  
    <debug> sphy_hci: Link control. Sync Resposnse recieved.
    <debug> sphy_hci: EVT:RX Link Control packet (length:7)
    <debug> sphy_hci:  00 3F 00 C1 03 FC 11   |.?..... 
    <debug> sphy_hci: EVT:Tx packet sent.
    <debug> sphy_hci: EVT:RX Link Control packet (length:7)
    <debug> sphy_hci:  00 3F 00 C1 04 7B 11   |.?...{. 
    <debug> sphy_hci: EVT:RX Link Control packet (length:7)
    <debug> sphy_hci:  00 3F 00 C1 03 FC 11   |.?..... 
    <info> app: BLE connectivity started
    <debug> nrf_sdh: State request: 0x00000000
    <debug> nrf_sdh: State change: 0x00000000
    <debug> nrf_sdh: State change: 0x00000001
    <debug> app: sdh enabled.
    ( device dead / reboot )

Related