Hi to all,
i am working on a project that in it i want use nrf51822 as a peripheral device. i implemented a code but i have a problem, central(cc2540) and peripheral(nrf51822) randomly disconnect sometime and i do not have any idea to why this problem can occur, can any one that had faced with this problem and solved that share his experience with me to solve this problem??, can the disconnection problem happen because of below reasons:
1- my clock setting is as below:
#define NRF_CLOCK_LFCLKSRC {.source = NRF_CLOCK_LF_SRC_XTAL, \ .rc_ctiv = 0, \ .rc_temp_ctiv = 0, \ .xtal_accuracy = NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM}, can clock setting related to disconnection problem and if yes how can i change this part of code to solve the problem.
2- when i receive BLE_EVT_USER_MEM_REQUEST event from below stack i response with this code
case BLE_EVT_USER_MEM_REQUEST: err_code = sd_ble_user_mem_reply(m_conn_handle, NULL); APP_ERROR_CHECK(err_code);, as you can see i send null when i receive BLE_EVT_USER_MEM_REQUEST request, can disconnection problem occur because of this part of code??
3-somewhere in the code i use nrf_malloc and nrf_free to allocate memory dynamically and mem_manger module setting is as :
#define MEMORY_MANAGER_SMALL_BLOCK_COUNT 4 #define MEMORY_MANAGER_SMALL_BLOCK_SIZE 32 #define MEMORY_MANAGER_MEDIUM_BLOCK_COUNT 2 #define MEMORY_MANAGER_MEDIUM_BLOCK_SIZE 256and this setting setted in sdk_config.h, and because lack of memory i did not changed these default values. is soft device use mem_module to allocate memory also?? and can disconnection problem occur because i am using from this resource with softdevice??
the above items was my guesses about disconnection problem.
thanks