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

Cycling Speed and Cadence sensor central configuration using nRF52832

i am working on the Cycling Speed and Cadence sensor central configuration using nRF52832 DK in Segger Embedded Studio. I used the RSCS central example of nrf_sdk_v15.0 and have made changes according to my requirement for single sensor and it is working fine i.e i am able to get the correct data. Then i wanted to connect nearly 8 such CSCS beacons so i made small changes in my code accordingly using Multilink central example as reference. I have adjusted the RAM and memory allocation also.  My main doubt is once i run the program it gets connected to a single device and it starts reading the data. How am supposed to make it connect and read the next sensors simultaneously ? I need to store the 8 data in an array after connecting all the beacons. I have attached the RTT log for your reference. What am i supposed to do now ? How can i read all the data parallely ? 

  • Hello,

    If I understand you correctly, you want to know what device that sent a notification in the service events, right?

    The only event that gives you the peer address, besides the advertising reports, is the connection event, BLE_GAP_EVT_CONNECTED.

    You can test this by logging in the BLE_GAPEVT_CONNECTED event:

    NRF_LOG_INFO("connected to device with address 0x%02x:%02x:%02x:%02x:%02x:%02x",    p_ble_evt->evt.gap_evt.params.connected.peer_addr.addr[0],
                                                                                        p_ble_evt->evt.gap_evt.params.connected.peer_addr.addr[1],
                                                                                        p_ble_evt->evt.gap_evt.params.connected.peer_addr.addr[2],
                                                                                        p_ble_evt->evt.gap_evt.params.connected.peer_addr.addr[3],
                                                                                        p_ble_evt->evt.gap_evt.params.connected.peer_addr.addr[4],
                                                                                        p_ble_evt->evt.gap_evt.params.connected.peer_addr.addr[5]);
    NRF_LOG_INFO("Connection is on conn_handle 0x%02x", p_ble_evt->evt.gap_evt.conn_handle);

     

    Here you will see what device that belongs to which conn_handle.

    You have to store this if you want to keep track of which device that is sending notifications. The rest of the events will only use the conn_handle for identification.

     

    Note that when you disconnect and reconnect, one device may get a different conn_handle.

     

    Best regards,

    Edvin

     

  • Hi Sir,

    I have completed the steps which you have showed now. You are finding the mac address in the ble_evt_handler right. What i want is to display the mac address along with the conn_handle in the service_evt_handler eg: Heart Rate 0 (mac address), Heart Rate 1 (mac address) etc. So that it will be useful for mapping to the specific user. Kindly clarify. 

    Thanks and Regards,

    Santosh Krishnan R 

  • Hello. You can read about mac address vs BLE address here.

    In BLE we don't really use the "MAC address" term, which is why I said used BLE address. MAC addresses are referring to the IEEE protocol.

     

    The BLE address is randomly generated, but unique for all devices, and is stored in the FICR registers.

     

    Best regards,

    Edvin

  • Hi Edvin,

    Thank you so much for the information. I will go through the reference and will let you know if i face any issues. 

    With Regards,

    Santosh Krishnan R

Related