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

Please tell me how to connect one nRF51822 and another as Central and Peripheral. In the future, I would like to connect one Central and multiple Peripheral.

I am new to BLE.

My question is similar to the one below.

https://devzone.nordicsemi.com/f/nordic-q-a/22596/nrf51822-central-connect-and-communicate-with-2-peripherals

But the link to the answer was broken and I couldn't find it, so I'll ask.

I am using two nRF51822 and SDK12.3.0. I want to run them as Central on one side and Peripheral on the other. 

Probably by a method called GATT communication.(It means communication in a connected state.)

My goal is to record  RSSI and receiving time in Central when it receives an empty packet from Peripheral.

I would like to receive packets at intervals of 1msec to 10msec,

so advertising with long transmission intervals and randomly staggered transmission times would not achieve my goal.

In the future, I would like to receive packets from about 6 peripherals and record the RSSI of the packets.

Please let me know if there is a sample program or code that fits my purpose.

I'm not very good at English, so I use translation software to create my texts. I'm sorry if I don't make sense in some parts.

Parents Reply
  • I reconfigured the settings, but nothing showed up.

    Do I need to change any settings for NRF_LOG to observe it in TeraTerm?

    I also changed the code a bit by referring to the following link, but the result was the same.

    https://devzone.nordicsemi.com/f/nordic-q-a/10531/read-rssi-on-data-received-after-connection-in-s120

    switch (p_ble_evt->header.evt_id)
        {
            // Upon connection, check which peripheral has connected, initiate DB
            // discovery, update LEDs status and resume scanning if necessary.
            case BLE_GAP_EVT_CONNECTED:
            {
    int8_t p_rssi;
    int8_t rssi = p_ble_evt->evt.gap_evt.params.adv_report.rssi;
    
    // On the connection event
    
    uint32_t m_conn_handle  = p_ble_evt->evt.gap_evt.conn_handle;  
    err_code = sd_ble_gap_rssi_start(m_conn_handle, 10, 0);   
    APP_ERROR_CHECK(err_code);
    
    //On the RSSI_CHANGED event 
    err_code = sd_ble_gap_rssi_get(m_conn_handle, &rssi);  
    APP_ERROR_CHECK(err_code);
    
    //printf("%d,", rssi);//RSSi
    NRF_LOG_INFO("RSSI: %d",rssi);
    double timenow = app_timer_cnt_get();
    printf("%f,\r\n", (double) timenow); //nowtime
    
    	
    
    
                err_code = ble_lbs_c_handles_assign(&m_ble_lbs_c[p_gap_evt->conn_handle],
                                                    p_gap_evt->conn_handle,
                                                    NULL);
                APP_ERROR_CHECK(err_code);

Children
Related