What SPI frequencies does Raspberry Pi support?
Additionally:
- Are they all supported by the bootc.net SPI driver?
- Are there any additinal things I should be cautious about when trying to communicate with some other chip via SPI?
|
What SPI frequencies does Raspberry Pi support? Additionally:
|
||||
|
|
|
The SPI can be run at the core clock speed or divided down for slower peripherals. The core clock is 250 MHz. The divider can be set to any power of two - from 2^0 all the way up to 2^16. This means that SPI frequencies from 3.8 kHz to 250 MHz are supported. Sources:
|
|||||||||||||||
|
|
The datasheet of BCM2835 says the following on page 120: The value of the clock register of the SPI block contains.
I can't find any reference to what is the maximum frequency of the APB bus, I think that is part of the ARM11 documentation and not this SoC. |
|||||||||
|
|
The Raspberry Pi SPI runs at APB clock speed, which is equivalent to core clock speed, 250 MHz. This can be divided by any even number from 2 to 65536 for the desired speed. The datasheet specifies that the divisor must be a power of two, but this is incorrect. Odd numbers are rounded down, and 0 (or 1) is equivalent to 65536. A divisor smaller than 2 is therefore impossible. This makes the frequency range be from 3.814 kHz to 125 MHz, with 32768 steps in between. (There has been a lot of misinformation on this matter, but these results have been verified by experimentation. Please spread the word.) |
|||||||
|
|
I have tested with the as seen on http://www.brianhensley.net/2012/07/getting-spi-working-on-raspberry-pi.html and changed the speed. The maximum speed when the test passed is 15MHz = 15000KHz: See result:
The test at 16MHz failed. André |
||||
|
|