XMEGA maximum SPI clock in slave mode (Atmel answered)

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi all,

According to XMEGA A manual,maximum clock for SPI module is clkper/2. But the following was also written in SPI section:

Quote:
doc8077-Rev H- page 230:

In SPI Slave mode, the control logic will sample the incoming signal of the SCK pin. To ensure correct sampling of this clock signal, the minimum low and high periods must be:
Low period: longer than 2 CPU clock cycles.
High period: longer than 2 CPU clock cycles.

This means a maximum clock of clkper/4 in slave mode. I asked this issue from atmel support and the answer indicates clkper/2 is only valid for master SPI and not for slave mode:

Quote:
Regarding your question about the SPI speed: You are correct that the clkper/2 rate is only applicable when running the XMEGA as a SPI master. When the XMEGA acts as the master, it is in control of the clock; if it is in slave mode another device is generating the clock, and a lower rate is required for the XMEGA to sample it.

Ozhan KD
Knowledge is POWER

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi electronic.designer,

what does this really mean ?

Max. CPU or PER Clock Rate at min. 2.7 Volt is 32MHz.

So the regular SPI clock rate is 32MHz/4 = 8MHz

With CLK2X enabled it is then 16MHz.
SPI Master can run @ 16MHz Clock (Maximum)
SPI Slave can run @ 8MHz clock (Maximum)

So the factor 2 is between 8MHz and 16MHz, right ?

Mac

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

Quote:
SPI Master can run @ 16MHz Clock (Maximum)
SPI Slave can run @ 8MHz clock (Maximum)

Yes, this is the case."Longer than 2 CPU clock cycles" in XMEGA A manual, may have the meaning of Less than 8 MHz clock for SPI slave.

Ozhan KD
Knowledge is POWER

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi electronic.designer,

the diff between MASTER and SLAVE is the CLK2X Bit (SPI Clock Double).
Manual say: "When this bit is set the SPI speed (SCK Frequency) will be doubled in Master mode"
So only in MASTER mode the Clock Double works.

So the default SPI Clock is CLKper/4 which is at 32MHz CLKper = 8MHz

In Master Mode with CLK2X set it is 16MHz and in Slave Mode it is 8MHz.

Mac

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

buffalo399 wrote:
So only in MASTER mode the Clock Double works.

SPI clock settings have no effect in Slave mode,including CLK2X and PRESCALER[1:0].

Ozhan KD
Knowledge is POWER