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

BLE advertising not working

Hello Everyone,

When i use malloc function in on_ble_event function ble advertising get stuck and not working

below is my implement code:

static void on_ble_evt(ble_evt_t * p_ble_evt) { uint32_t err_code; struct Addnode *rssi_node; int8_t strengthnew_signal = 0; bool new_addr = 0; bool f_match = 0; rssi_node = head;

switch (p_ble_evt->header.evt_id)
{
    case BLE_GAP_EVT_CONNECTED:
        err_code = bsp_indication_set(BSP_INDICATE_CONNECTED);
        APP_ERROR_CHECK(err_code);

        m_conn_handle = p_ble_evt->evt.gap_evt.conn_handle;
        
        break;

    case BLE_GAP_EVT_DISCONNECTED:
        err_code = bsp_indication_set(BSP_INDICATE_IDLE);
        APP_ERROR_CHECK(err_code);

        err_code = bsp_indication_set(BSP_INDICATE_ALERT_OFF);
        APP_ERROR_CHECK(err_code);
        break;
			case BLE_GAP_EVT_ADV_REPORT: 
			{
											// Advertising data received
					const ble_gap_evt_adv_report_t *p_adv = &p_ble_evt->evt.gap_evt.params.adv_report;
			
					
						
						
	// create node for every new ble address

	  new_node=(struct node *)malloc(sizeof(struct node));   ---> this will stop the bluetooth (I think its get stuck to initialize heap memory)

       }
      break;

Any help will be appreciate.

Parents
  • Hi

    Simply ignore every things just i call malloc to create dynamic memory in main() loop. The BLE advertising get stop.

    Its very difficult to me find out proper solution what's actually problem?

    I think when malloc goes to create dynamic memory its get stuck and BLE adv. get stop. After Implementing malloc I can't debug my program.

    See bellow code this will give more idea,

    image description

    Please help any one whats wrong?

    Regards, Rajneesh

  • Since your app is working on 32 RAM device (nrf51 AC), but not on 16k (nrf51 AA) it could be a problem with your RAM configuraion. Since you are using makefile, check your linker script under MEMORY section -> RAM: The sum of ORIGIN and LENGTH should equal 0x20004000.

    EDIT: For Keil: Go to target options, Read/Write Memory Areas: Start and Size of IRAM1 fields should equal 0x20004000

Reply Children
No Data
Related