5

The current config.txt allows one to change arm_freq, gpu_freq, core_freq, h264_freq, isp_freq, and v3d_freq. In addition, there is support for the kernel to change clocks on demand and based on thermal limits.

On the other hand, the hardware peripheral clock is described as:

The Raspberry Pi runs the BCM2835 with a core clock of 250MHz. This is relevant for the peripheral modules like I2C, SPI and Timer ( ARM side ) for calculating the desired clock rate.

Elsewhere, this is described as the Advanced Peripheral Bus (APB) clock, and references are made to APB clock domain.

Now, my questions are:

  • Do any of the config.txt settings affect the APB clock used for SPI?
  • Does on demand cpufreq changing affect the APB clock used for SPI?
  • Is there a way to determine this clock from Linux userland, or should it be hardcoded to 250 MHz for all current and future Raspberry Pi's?
2

I believe core_freq is a setting responsible for that clock as I saw some foundation members mentioning APB is a internal clock driven by GPU (but I haven't found a definitive proof for that). You should not threat it like a static value but I don't know how it can be determined from userspace.

Also by default, if turbo_mode=0, cpufreq will be changed according to system load. It should be between core_freq_min and core_freq which both, defaults to 250.

On the other hand, kernel SPI driver seems to be using sdhost_clk (according to arch/arm/mach-bcm2708/bcm2708.c file) clock which seems to be set as static 250Mhz. cpufreq driver does not change this value (as far as I can see, it only sets ARM clock but it is doing this through GPU which may adjust other frequencies by itself automatically).

  • Thank you. Even though not certain, that's probably the best answer I can get, short of actually proving that by experimentation, which I might do. – Nakedible Oct 30 '12 at 19:36
  • I have verified this experimentally - changing core_clock changes the SPI clock. I don't know if there is some other setting that also affects SPI clock, but atleast core_clock does. As for the kernel, many things are hardcoded and not really quite how they should be. I guess this is one of those things. – Nakedible Nov 2 '12 at 21:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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