Developer Portal Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    How to get highest sampling rate (500HZ) in BMA280 (or any sensor) in XDK

    LlobetAtWork
    Long-established Member

    Re: How to get highest sampling rate (500HZ) in BMA280 (or any sensor) in XDK

    Hi mainul,

    the code in this example will wait for new data to be available from the sensors before publishing. 
    In my configuration, the noise sensor is set to 20kHz ADC sampling with 30samples per RMS output -> 20kHz/30 = 667Hz (RMS) and T_Sampling(RMS) = 1/667Hz = 1.5ms

    The BMA280 is set to 500Hz sampling frequency -> 2ms Sampling Time.

    I don't see all your configuration, but along with the sensors, this sampling times will add up an influence the MQTT output data rate,

    Basically this example was meant to be simple to understand but this simplicity restricts it to be for low  data rates (1s). Other programs that need higher performance are more complex (like the datalogger) and require better understanding of the MEMS interrupt engines and the RTOS inter-task communication system to work out. 

      Best regards,

    Francisco Llobet

    mainul
    Member

    Re: How to get highest sampling rate (500HZ) in BMA280 (or any sensor) in XDK

    I  have tried to find the variables which ontrols those parameters you mentioned, but no luck, got very confused.

    In the AppCoontroller.c, I  have the following sensor setup. could you please tell me what to add/change to get high frequency like your configuration. If this is not the target variable, could you please tell on which file  and what to change.    

     

     

    static Sensor_Setup_T SensorSetup =
            {
                    .CmdProcessorHandle = NULL,
                    .Enable =
                            {
                                    .Accel = true,
                                    .Mag = false,
                                    .Gyro = true,
                                    .Humidity = false,
                                    .Temp = false,
                                    .Pressure = false,
                                    .Light = false,
                                    .Noise = true,
                            },
                    .Config =
                            {
                                    .Accel =
                                            {
                                                    .Type = SENSOR_ACCEL_BMA280,
                                                    .IsRawData = false,
                                                    .IsInteruptEnabled = false,
                                                    .Callback = NULL,
                                            },
                                    .Gyro =
                                            {
                                                    .Type = SENSOR_GYRO_BMG160,
                                                    .IsRawData = false,
                                            },
                                    .Mag =
                                            {
                                                    .IsRawData = false
                                            },
                                    .Light =
                                            {
                                                    .IsInteruptEnabled = false,
                                                    .Callback = NULL,
                                            },
                                    .Temp =
                                            {
                                                    .OffsetCorrection = APP_TEMPERATURE_OFFSET_CORRECTION,
                                            },
                            },
            };/**< Sensor setup parameters */

     

     

     

    Also, in the  appControllerSetup:

     

     

    static void AppControllerSetup(void * param1, uint32_t param2)
    {
    ........
        NoiseSensor_Setup(22050U);
        uint32_t samplingFreqency=500;
    .........
    }

     

     

    This samplingFrequency does not seems to have any effect. another related question: why only setup function for noise, where is other sensor setup function?

     

     

    Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist