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

NRF_ERROR_INVALID_STATE on sd_ble_cfg_set on production board

Hi,

I've been developing software that uses pc-ble-driver and a PCA10040 devkit to act as a central. My software is based off the heart rate v5 example written in C, and the SD API v5 connectivity firmware is on the devkit. This software is working in our dev environment that uses the devkit. I'm attempting to port my C++ software to an embedded board running OpenWrt on a WiFi chip that communicates with a NRF52832 chip. I've cross-compiled my OpenWrt package, and my software is running on the OpenWrt device.

Oddly, we get an NRF_ERROR_INVALID_STATE on the OpenWrt device when running sd_ble_cfg_set. This function returns NRF_SUCCESS in our development environment. According to the documentation, this error returns when the BLE stack has already been initialized. In our case, what does this mean? Is it possible other software initialized the ble stack prior to our call? Note that this same error appears in the heartrate collector v5 example!

Further, we're unable to connect to devices on our production board. We receive error 3e: BLE_HC_CONN_FAILED_TO_BE_ESTABLISHED. I suspect its possible this is linked to the issue above. This also isn't an issue in our dev environment.  We have successfully connected to peripherals and discovered services and characteristics. We are able to scan and handle adv reports on the production board.

Is it also possible the firmware on the NRF52832 chip on our production board (where we have issues) is a different and unexpected version (say, v3 instead of v5)? According to our production board vendor, the firmware on the chip comes "burned from the (Nordic's) factory."

  • Hi,

    Oddly, we get an NRF_ERROR_INVALID_STATE on the OpenWrt device when running sd_ble_cfg_set. This function returns NRF_SUCCESS in our development environment. According to the documentation, this error returns when the BLE stack has already been initialized. In our case, what does this mean? Is it possible other software initialized the ble stack prior to our call? Note that this same error appears in the heartrate collector v5 example!

    This sounds a bit strange to me, but my best guess would be that something is not reset or in the correct state, like it is on the DK. Could you try to call sd_rpc_conn_reset() first, to see if that makes any difference?

    Is it also possible the firmware on the NRF52832 chip on our production board (where we have issues) is a different and unexpected version (say, v3 instead of v5)? According to our production board vendor, the firmware on the chip comes "burned from the (Nordic's) factory."

    All chips comes blank from Nordic factories. If it contains any FW, this is programmed by a 3rd party. Are you using Nordic chips directly, or a module from a module partner?

    Best regards,
    Jørgen

  • Terribly sorry. I contacted the vendor and while we received an ambiguous answer my feeling is the firmware on the chip is an edited connectivity firmware and this is the reason for the issue. We flashed the chip with the 5.1 api and now it looks like things are working as expected. Now I'm just trying to figure out why our chip came with this edited firmware. 

    But this is resolved. Thank you.

Related