SPI mode difference between UC3B and ATmega128

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

Hi,

just noticed that the SPI mode on UC3B is not the same as on ATmega128.

UC3B is:

Quote:

Table 21-2. SPI Bus Protocol Mode0
SPI Mode CPOL NCPHA
0 0 1
1 0 0
2 1 1
3 1 0

ATmega128:

Quote:

Table 21-2. CPOL Functionality
Leading Edge Trailing eDge SPI Mode
CPOL=0, CPHA=0 Sample (Rising) Setup (Falling) 0
CPOL=0, CPHA=1 Setup (Rising) Sample (Falling) 1
CPOL=1, CPHA=0 Sample (Falling) Setup (Rising) 2
CPOL=1, CPHA=1 Setup (Falling) Sample (Rising) 3

so mode 0 on UC3B is mode 1 on ATmega128,
mode 1 on UC3B is mode 0 on ATmega128,
mode 2 on UC3B is mode 3 on ATmega128,
mode 3 on UC3B is mode 2 on ATmega128,
right?

Cheng

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

Hmm, I hope not. The SPI modes are specified by, well, the SPI specification. They should be consistent across all devices.

I don't have access to the m128 datasheet at the moment (stupid dialup) but I'd have a look over the actual bit definitions and, if possible, the waveforms.

-S.

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

You notice the difference between NCPHA and CPHA, i.e. NCPHA is inverted CPHA. AFAIK the modes should be the same.

Hans-Christian

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

but the waveform doesn't look the same...

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

ok, yes, it is the same