External clock on a pin

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
User avatar
Mantas
Posts: 221
Joined: Tue May 15, 2012 10:32 pm
Location: Klaipeda, Lithuania - North sea, UK
Has thanked: 57 times
Been thanked: 27 times

External clock on a pin

Post by Mantas »

Hello everybody,

I have a ITG-3200 3-axis gyro from Invensense. This chip is equipped with an input of external clock, which can be either 32.768kHz reference, or 19.2MHz reference, to get more stable readings. What is the best way to generate a clock pulse at the mentioned frequencies on ARM SAM7 chip?

Best regards,
Mantas
Science is my true religion.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: External clock on a pin

Post by Benj »

Hello Mantas,

I would use an external component such as a crystal or digital oscillator to drive the gyro. Driving the clock output yourself from the ARM is probably do-able but would likely eat up a lot of the process time especially at 19.6608MHz. Also generating the clock yourself will not be as accurate as it could be using a crystal or other accurate clock source.

If you must generate via the ARM then the lower frequency can probably be generated by using a timer interrupt running at twice the frequency. Inside the timer routine you check to see if the output is already on, if it is then switch it off and visa versa.

User avatar
Mantas
Posts: 221
Joined: Tue May 15, 2012 10:32 pm
Location: Klaipeda, Lithuania - North sea, UK
Has thanked: 57 times
Been thanked: 27 times

Re: External clock on a pin

Post by Mantas »

Thanks Ben,

I will consider a 32.768kHz crystal as it is much cheaper than 19.2Mhz.

There is a line in a datasheet: Optional external clock inputs of 32.768kHz or 19.2MHz to synchronize with system clock

what does it mean to sync with system clock? ARM is running at much higher frequency, so how it will sync?? a little confused.. :?


Best regards,
Mantas
Science is my true religion.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: External clock on a pin

Post by Benj »

Hello Mantas,

In some systems it is better to run all processors off the same clock as it means that their program cycles are synchronized. For most cases this synchronization is overkill and is not really necessary.

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times

Re: External clock on a pin

Post by Enamul »

There is a line in a datasheet: Optional external clock inputs of 32.768kHz or 19.2MHz to synchronize with system clock

what does it mean to sync with system clock? ARM is running at much higher frequency, so how it will sync?? a little confused..
In my sense, I can feel from most of the microcontroller there is an option to have 1/4 of clock frequency in which the processor is running. If you use that clock/4 frequency to drive your IC in that case your system will be synchronised. We did that for MRI (Magnetic Resonance Imaging)scanner to synchronize with EEG (Electroencephalography)machine.
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
Mantas
Posts: 221
Joined: Tue May 15, 2012 10:32 pm
Location: Klaipeda, Lithuania - North sea, UK
Has thanked: 57 times
Been thanked: 27 times

Re: External clock on a pin

Post by Mantas »

As I am working on a real time system, I wouldn't want to scale down the system clock, because the chip is doing a lot of floating point operations in real time, so this would degrade the performance of the implemented algorithm. I think I will stick to one of the gyros as a reference clock.

Best regards,
Mantas
Science is my true religion.

Post Reply