Take the 2-minute tour ×
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It's 100% free, no registration required.

I'm trying to generate a clean 11.289MHz clock signal from the General Purpose clock, GPCLK0 on GPIO4. The suggested route is to use the 19.2MHz crystal as the source, which seems to work for lower frequencies but no matter what I try it default to 2.5KHz. Reading the docs it seems to imply the that PPL sources should be used.

Does anyone have any further information on what the mentioned sources are particularly:

  • 4 = PLLA per
  • 5 = PLLC per
  • 6 = PLLD per

See page 107 - Clock Control Register of the BCM2835 Peripheral Documentation.

share|improve this question
    
Did you solve the problem? I would like to generate too a clock signal (between 2-10 MHz), because i would like to read data from shift registers. But i can't make it work. How can i set up the GPCLK0 on GPIO4 pin for a clock signal output? Thanks! –  user3171 Nov 5 '12 at 12:02

2 Answers 2

up vote 2 down vote accepted

Although it is not specified explicitly, I assumed from the spec that:

  • PLLA = 650 MHz
  • PLLB = 400 MHz
  • PLLC = 200 MHz

From this, I would suggest the following:

SRC = 4 (PLLA), MASH = 1, DIVI = 57, DIVF = 592

If I am reading the specs right, this will produce:

min freq = 11.207 MHz, max freq = 11.404 MHz, avg freq = 11.289 MHz

You can try MASH as 2 and 3 experimentally if those work better. You can also try the slower PLL clocks, although accuracy will probably slightly suffer. This is also mentioned in the documentation:

In applications where jitter is a concern, the fastest available clock source should be used.

share|improve this answer

I have done a bit of experimenting with the general purpose clocks.

This information appears to be correct (on the post date).

Refer to http://www.raspberrypi.org/wp-content/uploads/2012/02/BCM2835-ARM-Peripherals.pdf pages 102-108. The clock frequencies were determined by experiment. The oscillator (19.2 MHz) and PLLD (500 MHz) are unlikely to change.

Clock sources

0     0 Hz     Ground
1     19.2 MHz oscillator
2     0 Hz     testdebug0
3     0 Hz     testdebug1
4     0 Hz     PLLA
5     1000 MHz PLLC (changes with overclock settings)
6     500 MHz  PLLD
7     216 MHz  HDMI auxiliary
8-15  0 Hz     Ground

The integer divider may be 2-4095. The fractional divider may be 0-4095.

There is (probably) no 25MHz cap for using non-zero mash values.

There are three general purpose clocks.

The clocks are named GPCLK0, GPCLK1, and GPCLK2.

The clocks are accessible from the following gpios.

Don't use GPCLK1 (it's probably used for the Ethernet clock).

gpio4  GPCLK0 ALT0
gpio5  GPCLK1 ALT0 B+ and compute module only (reserved for system use)
gpio6  GPCLK2 ALT0 B+ and compute module only
gpio20 GPCLK0 ALT5 B+ and compute module only
gpio21 GPCLK1 ALT5 Not available on Rev.2 B (reserved for system use)

gpio32 GPCLK0 ALT0 Compute module only
gpio34 GPCLK0 ALT0 Compute module only
gpio42 GPCLK1 ALT0 Compute module only (reserved for system use)
gpio43 GPCLK2 ALT0 Compute module only
gpio44 GPCLK1 ALT0 Compute module only (reserved for system use)
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.