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 ? 

Parents
  • Hello,

    Have you tried to connect to several devices at once? It says that it is scanning for more devices after that you connected with the first one. As long as it enables notification on all of the sensors that it connects to, it should get an event whenever the devices pushes some new data to the device.

     

    What happens if you try to connect another peripheral to your central?

     

    Best regards,

    Edvin

  • Hi Sir,

    Thanks for your reply. 

    Right now i tried for 2 sensors only. I tried to read 2 advertisement reports and have put two cscs handlers for collecting 2 sensor's data. Please check the attached RTT logs of my application. I am getting this output only. I tried connecting with different peripheral names. 

    I dont know why the discovery is part is repeating 8 time when i tried connecting with a single sensor. It not giving any outputs too when i tried. 

    Kindly help me sir,

    Thanks and Regards

    Santosh Krishnan R 

  • Hi Edvin,

    Thanks for your reply. Now we are able to connect the devices. But i mainly want to mac the mac IDs to the specific users. I am able to get the connection instances after starting the services. But how to bring the mac ids inside the service event handlers. After getting connected and when the services starts at any instances i want the mac addresses too along with the connection instances. i mean i need the mac address to differentiate between the values of the instances since we may not know which device has been connected. So i want the mac address too with the connection instance. Kindly help. 

    Thanks and Regards,

    Santosh Krishnan R 

  • 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

Reply Children
No Data
Related