I refer to the first table (SPI Modes) on this page: https://www.arduino.cc/en/Reference/SPI
Problem: In the last column (output edge) the lower two entries have to be swapped.
The correct table should be: SPI_MODE0: CPOL=0, CPHA=0, data out on falling clock, data sample on rising clock SPI_MODE1: CPOL=0, CPHA=1, data out on rising clock, data sample on falling clock SPI_MODE2: CPOL=1, CPHA=0, data out on rising clock, data sample on falling clock SPI_MODE3: CPOL=1, CPHA=1, data out on falling clock, data sample on rising clock
Somre more notes from my side: - The internet is full of descriptions for these modes and many of them are different. Especially the last two modes are often exchanged (as also happend on the Arduino Reference) - We should document the behavior of the Arduino Boards (Which currently differs from the table on the SPI reference page) - The table on the reference page includes the column for the data output. However this is misleading, because the first data output has to happen without clock edge in modes 0 and 2. - I think it is more important to mention the time when the data is sampled from the client. - A picture would be helpful here too... - Finally: I think this topic is very important. I spent days on this topic and had to apply all the modern measure equipment to figure out the problem in my hardware setup.