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

hang in device_instance_find() in SDK7.2

Hi,

I recently tried SDK7.2 on PCA10028 board in order to make sure that SDK7.2 works well before I migrate my project to SDK7.2 codebase. My project code didn't work as expected once I resolved all the compilation issues. The issue was in the bonding procedure, the firmware was hung somewhere (the bonding was established between PCA10028 board and iPhone4S). I observed that the DM Log was on by default; when I disabled DM Logs the issue went away.

Later on I enabled DM Logs to further debug and after putting several debug printfs in device_manager_peripheral.c, I saw that the issue happened at the following DM_TRC whenever p_addr was NULL. If I put a condition that the DM_TRC is executed only when p_addr is not NULL, the issues goes away.

static api_result_t device_instance_find(ble_gap_addr_t const * p_addr, uint32_t * p_device_index, uint16_t div) { api_result_t err_code; uint32_t index;

err_code = NRF_ERROR_NOT_FOUND;

if(p_addr)   // My change to avoid the hang issue
DM_TRC("[DM]: Searching for device 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X.\r\n",
       p_addr->addr[0], p_addr->addr[1], p_addr->addr[2], p_addr->addr[3],
       p_addr->addr[4], p_addr->addr[5]);

for (index = 0; index < DEVICE_MANAGER_MAX_BONDS; index++)
{
    DM_LOG("[DM]:[DI 0x%02X]: Device type 0x%02X.\r\n",
           index, m_peer_table[index].peer_id.id_addr_info.addr_type);

Any idea why NULL pointer referencing would cause this issue? Has anybody else seen this as well? Any pointers would be a great help.

Thanks, Sam

Related