SPI Clock Speed

Status
Not open for further replies.

Michael_PDI

New member
Hi Teensy Forum,

A general question about about using the Arduino SPI library with a Teensy 3.6:

* What is the DIV2 clock speed?

I noticed that in SPI.h the DIV2 clock speed is defined as 12 MHz (12000000) - Shouldn't this be 8 MHz?

// --- Copied texted from SPI.h - line 605:
void setClockDivider(uint8_t clockDiv) {
if (clockDiv == SPI_CLOCK_DIV2) {
setClockDivider_noInline(SPISettings(12000000, MSBFIRST, SPI_MODE0).ctar);
} else if (clockDiv == SPI_CLOCK_DIV4) {
setClockDivider_noInline(SPISettings(4000000, MSBFIRST, SPI_MODE0).ctar);
} else if (clockDiv == SPI_CLOCK_DIV8) {
setClockDivider_noInline(SPISettings(2000000, MSBFIRST, SPI_MODE0).ctar);
} else if (clockDiv == SPI_CLOCK_DIV16) {
setClockDivider_noInline(SPISettings(1000000, MSBFIRST, SPI_MODE0).ctar);
} else if (clockDiv == SPI_CLOCK_DIV32) {
setClockDivider_noInline(SPISettings(500000, MSBFIRST, SPI_MODE0).ctar);
} else if (clockDiv == SPI_CLOCK_DIV64) {
setClockDivider_noInline(SPISettings(250000, MSBFIRST, SPI_MODE0).ctar);
} else { /* clockDiv == SPI_CLOCK_DIV128 */
setClockDivider_noInline(SPISettings(125000, MSBFIRST, SPI_MODE0).ctar);
}
}

I understand that is function is depricated, but even using the beginTransaction function I am curious if 12000000 is used for an SPI clock speed of 8 MHz, or if 12000000 is an oversight?

Thank you,

Michael
 
Status
Not open for further replies.
Back
Top