Tomas,
This problem is now resolved
When I read data from the Gyro, I save the bytes to an array called Gyro_Receive[]. I use FreeMaster to debug my hardware and software. I implemented a recorder in the tool and in the I2C read function to capture a sequence of data in real time. That is a wonderful tool!
Gyro_Rate_X is Gyro_Receive[1] << 8 | Gyro_Receive[2]. I first plotted Gyro_Rate_X and found the data dropouts reported originally. I then plotted the status byte with Gyro_Rate_X to see if there was a problem with data in the gyro. The status byte was always 0x0f. I then plotted Gyro_Receive[1] with Gyro_Rate_X and that byte was always zero. That was as expected because I have the recorder set to trigger on a positive angle rate. I then plotted Gyro_Receive[2] with Gyro_Rate_X and found that the signal was smooth, but when there was a dropout, the two variables were overlaid and negative. I then realized that the problem was with the declaration of Gyro_Receive[].
I had declared that array as char. When I changed it to unsigned char, then the data was properly assembled into Gyro_Rate_X and the problem was resolved.
Kind of dumb, I know. Especially because it took me so long to discover the cause. I can now explore some of the filtering features of the gyro, to see what will work best in my system.
I am using an ODR of 400 Hz and full scale of 500 deg/sec. I had tested two parts which told me that my problem was either software or setup. The layout is as described in the data sheet for I2C operation.
Hi Andy,
OK, glad to hear you resolved the issue by proper declaration of an array.
Yes, FreeMASTER is a very useful and valuable tool, but perhaps not very well known among developers.
Best regards,
Tomas
Hi Andy,
Could you please elaborate a bit more on this issue? It might also be useful to see your schematic, source code and output data illustrating this behavior. How many parts have you tested so far?
Best regards,
Tomas