-1

I need some help to ensure my understanding of how this is supposed to work.

I want to know given the attached serial timing diagram which spi mode should I use?

Based on my newly found knowledge I believe it should be mode 1 How do you use SPI on an Arduino?

Is this correct?

enter image description here

Ageis
  • 123
  • 6

2 Answers2

1

We can see from your diagrams that the starting state of the clock line after the CS goes active is low indicating a CPOL of zero. Also, we see that data changes after the falling edge of the clock indicating the CPHA is also zero. This infers, according to this reference, that the SPI mode is zero.

st2000
  • 7,513
  • 2
  • 13
  • 19
0

If you look at the diagram you showed, it makes sense to use mode zero.

SPI mode

Clearly you need mode 0 or mode 1 because the clock is normally low.

Now looking at the change of the data vs the clock, it makes sense that you sample on the leading edge (mode 0) - the red lines - because the diagram shows that the data is held steady for a while after the clock changes (from low to high).

It wouldn't make sense to sample on the trailing edge because immediately after that (the blue line) the data changes.

Nick Gammon
  • 38,901
  • 13
  • 69
  • 125