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

Reply
  • 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

Children
Related