CMPS14 Compass latency issue

I’m using the CMPS14 in serial mode to get compass readings at a fast interval. I need response in at most 100 mS. I’ve written test software that polls the unit every 50 mS, and plots the angle. The response of the unit to angle change has a LATENCY of about 300 ms. The instantaneous response is much shorter. If I turn the unit very quickly, I observe a large angle change in one 50 mS sample period. The issue is there is a delay in the data stream of about 300 mS. In other words, it’s like the data stream is pipelined for about 300 mS. I’ve been pulling my hair out trying to figure this out, and I believe I’ve eliminated all possibilities of error on my end.

I’m using C++ on a Windows box with an FTDI USB to serial converter. Yes, Windows is not an RTOS, but it’s capable of 10’s of milliseconds response, not 300 mS! And I don’t understand how my ::Readfile ::Writefile calls to the serial port can be queing up 6-50ms transmissions!

1 Like

Hi @Randy7 and welcome to the forum.

Yes, Windows is not an RTOS and it is capable of couple of miliseconds response, but will it do it even if it is capable?

Maybe, if you could get some PLCs or similar where you can strictly define task cycle time, it would be easier for you to eliminate this error.

UPDATE: I’m turning the CMPS14 with a boat trolling motor. I believe the delay is debounce or motor windup. At this point, I don’t think the delay is the CMPS14, it’s the motor’s input drive having delay or debounce circuitry (the motor is normally turned on/off with a foot pedal, and I turn it on/off with a bluetooth->GPIO module) What I really need to do is get a dual channel oscilloscope hooked up and nail this down.

1 Like

Thank you for this update :slight_smile:

Still looking into this a bit. I now have a GUI that shows waveforms of all the devices (mag,acc,gyro) If I hold the CMPS14 still and then do a sudden turn, the gyro responds at least 100 mS before the heading moves at all. Not sure why this occurs. I’m thinking now there is some delay in the heading pipeline. What I really need is to hook up a microswitch and read concurrently with a sharp turn.

Here is a plot of gyro and heading following a sharp twist of the compass. Gyro responds over 100 ms before heading. Each sample point is 50 mS on this plot. Green trace is heading, purple is gyro. This would be a better experiment if I had a rock solid position sensor, like a microswitch or shaft encoder.

image

I used a microswitch to log the compass rotation directly. The purple trace is the microswitch, and the green trace is the CMPS14 heading. Again, the datapoints are 50 mS apart. The heading is lagging behind by >100mS. This delay is about the same as the gyro->mag delay. I would conclude the gyro response to rotation is very close to the microswitch, and the heading has a delay of about 100 mS.

image