How i can get the Softdevice memory map?

Hi all,

Please refer below my development info.

 softdevice : s132 nrf52_6.1.1

 SDK : nRF5_SDK15.3.0

 Board : customized board(Using internal clock, NRF52832)

I added external nor flash(8Mbits) to my board.


External flash can store some data and display it when users connect their own phones.

I am now debugging this firmware. but there are some problems.

if the connection is lost when i am reading data from the external storage flash, the BLE stops.

Here is the keil debug mode assembly.

In this situation, there are no reactions of button or timeout.

0x0000DE6A is softdevice area. So, i can't handle it.

and,

I used sniffer.

this is the log.


actually, i am not used to debugging in this program.

i don't know why my board run strange.

Could i get the softdevice memory map?

or any suggestions?

thanks

Best Regards,

Parents Reply Children
  • Hi Sigurd,

    1) Yes. this is a log file when it happens.

    MBN52832_LOG.pcapng

    2) In this situation, p_ble_evt->header.evt_id is BLE_GAP_EVT_CONNECTED.

    Data remains in the nus queue. I think that's why BLE is busy.

    The main loop don't run. So, i can't check it.

    above picture in my qeustion, the assembly show it run softdevice area.

    How i can check the softdevice?

    3) The nRF Connect app doesn't stop. However I can't connect to my board.

    The BLE freezes. So, I should detach battery if i want to restart.

  • Hi,

    From the log, it seems like the nRF52 stopped sending notifications. The BLE link was still alive after that, but then shortly after the master/central device disconnected the link.

    YoungMin said:
    Data remains in the nus queue. I think that's why BLE is busy.

    Are you usign ble_nus_data_send() to send data? Did it return any error-codes?

  • Hi,

    The error-code is NRF_ERROR_RESOURCES(0x00000013).

    So, Could I think that this problem is caused by notification being disabled during sending data?

  • YoungMin said:
    So, Could I think that this problem is caused by notification being disabled during sending data?

    I'm not seeing the central disabling it, so from the peripheral side of things, it shouldn't be an issue to continue sending notifications. The NRF_ERROR_RESOURCES code means that the internal notification buffer in the SoftDevice is full, and you need to wait before you can queue more packets. 

    1) How does your function that calls ble_nus_data_send() looks like? how do you handle the NRF_ERROR_RESOURCES code?

    2) What is NRF_SDH_BLE_GAP_EVENT_LENGTH and NRF_SDH_BLE_GAP_DATA_LENGTH set to in sdk_config.h ?

    Try setting NRF_SDH_BLE_GAP_EVENT_LENGTH to 300 and NRF_SDH_BLE_GAP_DATA_LENGTH to 251

  • 1) my code almost be like example code. 

    void sapp_nus_send(void) // BLE <-> Phone
    {
    	uint32_t err_code = NRF_SUCCESS;
    //	NRF_LOG_INFO(" sapp_nus_send");
    	uint16_t len = 0;
    	uint8_t	send_msg_ready[BLE_NUS_MAX_DATA_LEN] = {0,};
    	uint8_t i;
    	nus_send_cnt = 0;
    	len = queue_get_count(&queue_ble_to_phone);
    	if(len) //
    	{
    		if(!Aging_para)
    		{
    			if(len > sizeof(send_msg_ready)) len = sizeof(send_msg_ready);
    //			NRF_LOG_INFO("Nus_len : %d",len);
    			for(i = 0; i < len; i++)
    			{
    					queue_pull(&queue_ble_to_phone, &send_msg_ready[i]);
    			}
    			do
    					{
    							uint16_t length = (uint16_t)len;
    							err_code = ble_nus_data_send(p_nus, send_msg_ready, &length, m_conn_handle);
    							nus_send_cnt++;
    							if(nus_send_cnt > 0xFFF0)
    								NVIC_SystemReset();
    							if ((err_code != NRF_ERROR_INVALID_STATE) && (err_code != NRF_ERROR_RESOURCES) && (err_code != NRF_ERROR_NOT_FOUND))
    							{
    									APP_ERROR_CHECK(err_code);
    							} 
    					} 
    					while (err_code == NRF_ERROR_RESOURCES);
    			}
    			else if(Aging_para)
    			{
    					play_read();
    					sapp_ble_flush();
    					sapp_phone_flush();
    					sapp_uart_flush();
    			}
    	}
    	APP_ERROR_CHECK(err_code);
    }

    2) my settings are NRF_SDH_BLE_GAP_EVENT_LENGTH = 6 and NRF_SDH_BLE_GAP_DATA_LENGTH  = 251.

    i try to change NRF_SDH_BLE_GAP_EVENT_LENGTH to 300 you mentioned, but the board can't start.

    I added a nus timer. NVIC_SystemReset runs when the nus timer exceeds the limit.

    but after NVIC_SystemReset, the system is off.I don't know why.

    thanks for your help.

    Best Regards,

Related