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

SDK code is getting hanged in do-while loop with NRF_ERROR_NO_MEM

Hi, I am beginner for nRF51822. We are using SDK v10 and S120.

We have an IOT Gateway with it's processor interfaced with nRF51822 radio through UART. We have flashed nRF51822 radio with ble_central application with our changes. The radio on Gateway connects to sensors and reads required data.

If there is a single sensor, the flow is working as expected as only single connection is established. If there are multiple sensors, the processor on GW is establing simultaneous connections (Maximum of 8) by sending ble_gap_connect request to the radio. Then multiple ble_gattc_read requests are being sent to read corresponding data from different sensors. In this scenario we have observed that radio code is getting hanged occassionally and not responding to further gattc_read commands.

I have tried to debug the issue by enabling RTT logs. Found that the code is getting blocked in do-while loop which is calling ser_hal_transport_tx_pkt_alloc().

do
{
err_code = ser_hal_transport_tx_pkt_alloc(&p_tx_buf, (uint16_t *)&tx_buf_len);
}
while (NRF_ERROR_NO_MEM == err_code);

ser_hal_transport_tx_pkt_alloc() was returning NRF_ERROR_NO_MEM as m_tx_state was set to HAL_TRANSP_TX_STATE_TX_TRANSMITTING. I have tried to understing state machine of m_tx_state. But couldn't figure out what was causing m_tx_state to stuck is single state.

What could cause this issue and had anyone faced similar issue ?

Related