In the XDK datasheet I can see that the bma280 accelerometer has the highest sampling speed of 2000 Hz. I would like to know how can I set the 2000 Hz speed because I can see that the highest bandwidth I can set for the accelerometer is 500Hz. Also, as I want to store the data from the accelerometer using the XDK, how can I store 2000 samples per second? Right now, with 500 Hz Bandwidth, I am using a timer which calls a function every one millisecond. The function then reads the sensor data and writes it to the sd card. But for 2000 sampling speed, I need to call the timer every 0.5 milli second and the timer function does not support a half millisecond repetition rate. So, briefly, I would like to know two things?
How can I set the sampling speed of the BMA 280 to 2000 Hz?
If I am able to get 2000 samples per second, how can I store the data that fast in the SD card?
There is a mistake in the data sheet. The XDK has a BMA150 and not the other part number you mentioned.
Software Timers will only allow you a resolution of 1ms (the OS tick), so in order to read with 2000Hz, you have to use the support from the BMI150:
Please configure the BMI150 to use the desired ODR and signal path filtering settings. Also enable the Data Ready interrupt: The BMI150 has a data-ready interrupt pin which is connected to the XDK micro-controller so on every acquired sample, the sensor notifies this to the XDK. On the XDK side you have an interrupt handler which signals a OS task to read data from the BMI150 as the SPI/I2C read functions will not work in interrupt context.
As far as I have understood from your solution, I have configured the BMI160 accelerometer of the XDK for my purpose which has a bandwidth of 1600Hz. Now, to read the data, I am creating a task; the task calls a function which goes trough an infinite while loop and and keeps storing the accelerometer data. I keeps this task alive for 1 minute using vTaskDelay(60000) and then I suspend this task. With this, I achieve, quite a high speed for sure. But now, after one minute, its storing different number of datas. For example, Once I got 146701 samples after one minute, i.e around 2445 samples/second the other time I got 150940 samples, i.e. 2515 samples/second. I have to stabilize it to a fixed rate. Can you give a solution to that? I am attaching the code I am using for this to read the accelerometer data. Also I am attaching screenshot of the data that I stored in the csv files for 2 different times. Thank you.
Can you describe more about sensor configuration and number of task running in the application ?
From your queries, i understood that you are suspending the task after 60seconds but without any conditon check, how could task suspended from the while loop?