E5 SPI buffer modes

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

I'm trying to understand the XMEGA E5 SPI peripheral's buffer modes. The manual states:

 

 Buffered mode 2:

The SPI module is single buffered in the transmit direction and double buffered in the receive direction. A byte writ-
ten to the transmit register will be copied to the shift register when the SPI is enabled. Then, one SPI transfer must
be completed before the data is copied to the shift register.

 

That's not very clear to me. In mode 1 there is a dummy byte shifted out, and in mode 2 there isn't. But what does the third sentence mean, about one transfer being completed before data is copied to the shift register?

 

My guess is that it refers to reading bytes, as in you must wait for the first byte written to clear the FIFO before a byte is available to read.

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

Mega bump but I think I get it now.

 

 Buffered mode 1:
The SPI module is single buffered in the transmit direction and double buffered in the receive direction. A byte writ-
ten to the transmit register will be copied to the shift register when a full character has been received. When
receiving data, a received character must be read from the DATA register before the third character has been
completely shifted in to avoid loosing data.
 Buffered mode 2:
The SPI module is single buffered in the transmit direction and double buffered in the receive direction. A byte writ-
ten to the transmit register will be copied to the shift register when the SPI is enabled. Then, one SPI transfer must
be completed before the data is copied to the shift register.

Buffer mode 1 waits for one byte to be received before loading the transmit shift register. Buffer mode 2 loads the shift register immediately.

 

Mode 1 seems good for slave operation, when you want to be synchronized with the master. Mode 2 seems to be aimed at master mode or non-standard SPI modes.