Reading the frequency
2005-06-08 by soren_t_hansen
Yahoo Groups archive
Index last updated: 2026-04-28 23:31 UTC
Thread
2005-06-08 by soren_t_hansen
Hi Group Is it possible to read a register or read a pin to see what frequency the processor is running at? I would like to make sure, that my LPC2132 is running at the maximum 60 Mhz. I have a Xtal of 12 Mhz and have set the PPL to 5, thus giving 60 Mhz, but how can I make sure ....? Best Regards Søren
2005-06-08 by Robert Adsett
At 08:23 AM 6/8/05 +0000, soren_t_hansen wrote: >Is it possible to read a register or read a pin to see what frequency >the processor is running at? I would like to make sure, that my >LPC2132 is running at the maximum 60 Mhz. Without an independent clock source it would be impossible to tell how fast the processor is running. >I have a Xtal of 12 Mhz and have set the PPL to 5, thus giving 60 Mhz, >but how can I make sure ....? Check your baud rate if using a UART. Program a timer or PWM to produce a specific pulse width. Robert " 'Freedom' has no meaning of itself. There are always restrictions, be they legal, genetic, or physical. If you don't believe me, try to chew a radio signal. " -- Kelvin Throop, III http://www.aeolusdevelopment.com/
2005-06-08 by dukearmlover
--- In lpc2000@yahoogroups.com, "soren_t_hansen" < soren_t_hansen@y...> wrote: > Hi Group > > Is it possible to read a register or read a pin to see what frequency > the processor is running at? I would like to make sure, that my > LPC2132 is running at the maximum 60 Mhz. > > I have a Xtal of 12 Mhz and have set the PPL to 5, thus giving 60 Mhz, > but how can I make sure ....? > > Best Regards > Søren Hello, I had exactly the same problem. Running my very first program on a LPC2129 - Olimex LPC-P2129 (using GCC4.0.0) gave me exactly the same impression. I was not sure the PLL settings were correct because the 'blinking led' was blinking slower than expected. On some LPC2000 derivatives (e.g. the LPC2214 in 144-pin package), you have the possibiliy to configure one special XCLK pin to generate an image of the internal clock. On the LPC2132, and also on my LPC2129, this pin is not implemented. But there is a workaround (what I did). You can e.g. configure the PWM unit to generate a square wave that is proportional to the clock. If you set the VPBDIV factor to 1, the PWM prescaler to 0, and use a PWM cycle (register PWMMR0) of 1000, with channel 1 at 50% duty cycle (PWMMR1 = 500), you will get a square wave at exactly 60 kHz for 60MHz clock frequency. This is a way to implement a frequency division by a factor 1000. When I checked the waveform on the pin with an oscilloscope, I noticed the frequency was 14.7 kHz instead, denoting a wrong PLL factor in my case. After code inspection, I found a mistake in the macros I used to program the PLL (missing left shift by 5 bits to align correctly a bitfield). Correcting the macro gave the correct result. So the method works ! Regards. "Duke"