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

connect with central to peripheral with MAC ID at run time connection

hai ,

 In my application , my nrf52840 device in peripheral mode  to connect with central (ESP32).

 then if i get a mac id  from central  ,i need to connect over with central role with MAC ID  to another peripheral(NRF DEVICE).

here,

in my scenario at first scan_init() is called in main function when peripheral role connected with esp32 scan_start() function will start to scan the beacons then will get a mac id from esp32 (central) then switch over to central to connect with peripheral (NRF DEVICE) based on the mac id.

how to connect with mac id at runtime???

Thanks,

  • Hi.

    From what I understand, you want to connect your nRF52840 device to the ESP32 where the nRF52840 acts as the peripheral. Then after connected to the ESP32, you want the nRF52840 to start scanning again and connect to another nRF Device but then the nRF52840 should act as the central?

    If my statement above is correct, I suggest that you take a look at our relay example. The relay example should provide pretty much the exact behaviour that you want to acheive.
    Relay example:
    The application combines a collector part on one end and a sensor part on the other to show how the SoftDevice can be used to make a device simultaneously function as central and peripheral device. The application uses the Peer Manager module, which allows for encryption of both central and peripheral connections simultaneously.

    You can just add the scan filter for the mac address for the device you want to connect to.

    Br,
    Joakim

  • hai ,

     in relay example ,

    i added ble_lbs and ble_lbs_c service file 

    i am able to connect both peripheral and central connection simultaneously.

    i need to send a notification data  from  relay (peripheral) to esp32 (central).

    i got success return from nrf side (peripheral) but in esp32 i am not getting any data from notification.

    added lbs init function in services init .

    static void services_init(void)
    {
    ret_code_t err_code;
    ble_hrs_init_t hrs_init;
    ble_rscs_init_t rscs_init;
    nrf_ble_qwr_init_t qwr_init = {0};
    ble_lbs_init_t init = {0};
    uint8_t body_sensor_location;
    
    // Initialize Queued Write module instances.
    qwr_init.error_handler = nrf_qwr_error_handler;
    
    for (uint32_t i = 0; i < NRF_SDH_BLE_TOTAL_LINK_COUNT; i++)
    {
    err_code = nrf_ble_qwr_init(&m_qwr[i], &qwr_init);
    APP_ERROR_CHECK(err_code);
    }
    
    
    // Initialize LBS.
    init.led_write_handler = led_write_handler;
    
    err_code = ble_lbs_init(&m_lbs, &init);
    APP_ERROR_CHECK(err_code);

    i have worked this notification part in ble_app-blinky example for me its working fine .

    but when i added same ble_lbs service in relay example its getting no response..

    whats the issue here ?? is there need to change anything for the notification.

  • hai ,

    missed conn_handle name in event handler ,

    now i am  getting notification from periperal (in relay ) to esp32 .

    i need to send data of more then 60 

    but sdk config gatt max size is 23 if i changed to 247 or 100 

    when i am running the program after changing this gets resetting due to ram size 

    but its not showing to increase the ram size from old size to new ram size

    directly its getting reset .

    how to get this ??could you explain??

Related