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

Notification frequency

Hi

I'm using nrf51 to notify some data to an andriod device. I set the connection interval of my nrf51 program to 7.5ms. And I need to send 100 packets per second (20 bytes per packet). However, sometimes there are packets loss and I cannot receive 100 packets per second. So what could I do wrong to cause the packets loss? Thank you!

Parents
  • hi wojtek

    Thank you for your reply.

    This is the part of sending notification. I use a timer to control the time. In one second, the nrf51 reads the sensor 100 times and everytime it finished the reading, ble_mpu_update is used to notify the data. accel_values_t is a 20 bytes struct.

    void ble_mpu_update(ble_mpu_t *p_mpu, accel_values_t * accel_values)
    {
        // Send value if connected and notifying
        if (p_mpu->conn_handle != BLE_CONN_HANDLE_INVALID)
        {
            uint16_t               len = sizeof(accel_values_t);
            ble_gatts_hvx_params_t hvx_params;
            memset(&hvx_params, 0, sizeof(hvx_params));
    
            hvx_params.handle = p_mpu->accel_char_handles.value_handle;
            hvx_params.type   = BLE_GATT_HVX_NOTIFICATION;
            hvx_params.offset = 0;
            hvx_params.p_len  = &len;
            hvx_params.p_data = (uint8_t*)accel_values;  
    
            sd_ble_gatts_hvx(p_mpu->conn_handle, &hvx_params);
        } 
        
    }
    
Reply
  • hi wojtek

    Thank you for your reply.

    This is the part of sending notification. I use a timer to control the time. In one second, the nrf51 reads the sensor 100 times and everytime it finished the reading, ble_mpu_update is used to notify the data. accel_values_t is a 20 bytes struct.

    void ble_mpu_update(ble_mpu_t *p_mpu, accel_values_t * accel_values)
    {
        // Send value if connected and notifying
        if (p_mpu->conn_handle != BLE_CONN_HANDLE_INVALID)
        {
            uint16_t               len = sizeof(accel_values_t);
            ble_gatts_hvx_params_t hvx_params;
            memset(&hvx_params, 0, sizeof(hvx_params));
    
            hvx_params.handle = p_mpu->accel_char_handles.value_handle;
            hvx_params.type   = BLE_GATT_HVX_NOTIFICATION;
            hvx_params.offset = 0;
            hvx_params.p_len  = &len;
            hvx_params.p_data = (uint8_t*)accel_values;  
    
            sd_ble_gatts_hvx(p_mpu->conn_handle, &hvx_params);
        } 
        
    }
    
Children
No Data
Related