PSoC4 BLE MPU6050 Timing/Speed Issue

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hi -

   

I am seriously stuck on an issue and would be extremely appreciative of assistance. I realize this is more of an MPU question but this forum seems to be more active than the device specific ones:).

   

The project (attached) takes raw values from the gyro/accel puts them through a Madgwick filter and then through a circular buffer. All works well except for one issue - the values in the buffer are accurate only if I have a delay in the project (see lines 258-264). Without the delay, the values in the buffer are obviously bad and I'm not sure what is going on. I have tried speeding up the MPU6050 - has a setting for 8kHz output (vs the default of 1 kHz) by disabling the digital low pass filter (DLPF); however, the changes don't seem to be recognized. 

   

Thanks in advance!

   

D.K.

   

PS - The project also transfers the buffer/arrays of data via BLE to an iPhone (need to take out the printing of the circular buffer though for this to work) - this is working reasonably well and I'm attaching the related Xcode project in the event it might help someone else who may come along.  

0 Likes
2 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Only idea I have: Getting data too fast or not waiting until ready will get bad data. Check at that place. printf() will make a reasonable delay. Did you set the filter time accordingly to the cycle time of retrieving data?

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Bob -

   

Thanks for the suggestion. I went over the data sheet for the MPU and there is a data ready function so I will look into that tomorrow. I did confirm that the DLPF setting is changing - it is just not having an impact on the data rate for some reason. Also, thanks for the reminder on the filter setting as I did need to update it. Hopefully, the data ready issue will fix without slowing everything down too much.

0 Likes