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

f_write/f_close cause BLE disconnect

Hardware: nrf52832

SDK: 16.0.0 with FreeRtos, 

Softdevice: S132 7.0

I set configMAX_PRIORITIES to 5 and modified nrf_sdh_freertos_init to set BLE task priority to 4.

My sd card maintain task priority is set to 2.

For BLE NUS service:

#define MIN_CONN_INTERVAL MSEC_TO_UNITS(20, UNIT_1_25_MS) /**< Minimum acceptable connection interval (20 ms), Connection interval uses 1.25 ms units. */
#define MAX_CONN_INTERVAL MSEC_TO_UNITS(75, UNIT_1_25_MS) /**< Maximum acceptable connection interval (75 ms), Connection interval uses 1.25 ms units. */
#define SLAVE_LATENCY 0 /**< Slave latency. */
#define CONN_SUP_TIMEOUT MSEC_TO_UNITS(4000, UNIT_10_MS) /**< Connection supervisory time-out (4 seconds). */

The NUS service and SD card function works fine when test them separately. But if Operate SD card during NUS connection, I got disconnect with reason:0x8

I have tried to enlarge INTERVAL to 120ms/175ms, also tried to change SLAVE_LATENCY to 4. Problem still exist.

I searched internet and NRF Dev Zone, found some similar question, but none of them can resolve my problem. So I have to raise a new question here. 

 

Parents
  • Hi

    You should not edit the SoftDevice's priority levels at all, as that might cause trouble for your application. If the SD card operations are able to interrupt the BLE activities that might cause trouble when the radio is active. You can see the interrupt priority levels documentation here for some more details on the matter.

    Your disconnect reason (0x8 BLE_HCI_CONNECTION_TIMEOUT)  points to that the other device has stopped responding, and I'm guessing this is because the SD card operations are allowed to interrupt the radio. What devices are you testing this on?

    Best regards,

    Simon

Reply
  • Hi

    You should not edit the SoftDevice's priority levels at all, as that might cause trouble for your application. If the SD card operations are able to interrupt the BLE activities that might cause trouble when the radio is active. You can see the interrupt priority levels documentation here for some more details on the matter.

    Your disconnect reason (0x8 BLE_HCI_CONNECTION_TIMEOUT)  points to that the other device has stopped responding, and I'm guessing this is because the SD card operations are allowed to interrupt the radio. What devices are you testing this on?

    Best regards,

    Simon

Children
  • Dear Simonr:

       Thank you very much for your support. Since it is night time on my location, I am out of office now. So I can not access detail source code. 

       About "should not edit SoftDevice's priority", do you mean the "interrupt priority" or "freeRtos task priority"?

       I have not change any interrupt priority. And for task priority, since the default BLE task priority is set to 2 and the LOG task priority is 1, there is no room for my tasks ( I have 2-3 tasks ). So I do following change:

    set configMAX_PRIORITIES to 5 and modified nrf_sdh_freertos_init to set BLE task priority to 4.
  • What devices are you testing this on?

    I buy a Development Board from internet and the board is marked "PCA10040 compatible". I can provide schem of the board when I back to office tomorrow.

    and I'm guessing this is because the SD card operations are allowed to interrupt the radio

      I think this guess is reasonable. What can I do to verify or avoid this happen?

Related