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

Program hangs at sd_ble_gattc_write() of nrf51-ble-driver_win_0.5.0

Hi there,

I am using the nrf51-ble-driver_win_0.5.0 to communicate with peripherals via the PCA10028.

My problem is when I call sd_ble_gattc_write() in my Windows application as fast as I can, this function at times does not exit with no return. Hence, my program is stuck in an infinite loop.

Would it be possible for Nordic to add some form of timeout to prevent the host applications from hanging? Or would Nordic make the driver source code available? It is possible to terminate the driver by executing it on another thread, but it would make the program horribly complicated.

Thanks in advance.

Parents
  • This is actually a known problem in nrf51-ble-driver_win_0.5.0, sd_ble_gattc_write() should return error if the buffers are full, but this is not always the case. The developers are working on it.

    You could wait for the TX_COMPLETE event, between every write, but this will reduce the throughput drastically (only one packet per connection event).

    Source code is in the comment.

  • Hi Ole,

    Thanks a lot for your response. Will go through the source code soon, though do appreciate greatly Nordic solves it since it takes time to understand someone else's code.

    Yes I could use BLE_EVT_TX_COMPLETE, but as you mentioned, it drastically reduces throughput. Also, the nrf51-ble-driver_win_0.5.0 readme states that BLE_EVT_TX_COMPLETE "should not be used since they are handled in the connectivity firmware". Would using BLE_EVT_TX_COMPLETE cause unpredictable/unwanted behaviour or it is just purely a waste of time?

Reply
  • Hi Ole,

    Thanks a lot for your response. Will go through the source code soon, though do appreciate greatly Nordic solves it since it takes time to understand someone else's code.

    Yes I could use BLE_EVT_TX_COMPLETE, but as you mentioned, it drastically reduces throughput. Also, the nrf51-ble-driver_win_0.5.0 readme states that BLE_EVT_TX_COMPLETE "should not be used since they are handled in the connectivity firmware". Would using BLE_EVT_TX_COMPLETE cause unpredictable/unwanted behaviour or it is just purely a waste of time?

Children
No Data
Related