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 Reply Children
  • Seeing as the disconnect reason is implying that it is the phone that initiates the disconnection/stops responding, can you check out the log in the nRF Toolbox app, to see if you get any more information from that side. If we're not able to see anything useful from that log information either, will you be able to provide a sniffer trace of the connection, so that we might have a look at some more details of the connection? If you have a DK you may use the nRF Sniffer for BLE in order to do so, or you can use a dedicated sniffer if you have that available.

    Best regards,

    Simon

  • Dear Simonr:

       I don't have DK or dedicate BLE sniffer. I will try to find one but I am not sure if I can get one. 

    Seeing as the disconnect reason is implying that it is the phone that initiates the disconnection/stops responding

      I have some different thoughts about this comment: the phone side just connect with NUS service and  know nothing about SD card operation, how can phone side "disconnect/stops responding" when 52832 conduct SD card operation? Even if the disconnect is initialed by phone side, I think 52832 must have some abnormal action to cause it.

      BTW I have a suggestion to speed up this issue analyze: Since the reference code (the link sent by you) has same issue, could you please help to try it on your side? Because I think you have more professional device (such as sniffer) and more professional skill than my side.  

       Thank you very much for your kindly help.

Related