This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

SPI CPOL CPHA Mode documentation mismatch

Hello, I'm looking into documentation nRF52832_PS_v1.2.pdf and there is written:

Mode Clock polarity Clock phase
CPOL CPHA
SPI_MODE0 0 (Leading) 0 (Active High)
SPI_MODE1 0 (Leading) 1 (Active Low)
SPI_MODE2 1 (Trailing) 0 (Active High)
SPI_MODE3 1 (Trailing) 1 (Active Low)

When I look into SDK (components\drivers_nrf\hal\nrf_spis.h) ther is written:

typedef enum
{
    NRF_SPIS_MODE_0, ///< SCK active high, sample on leading edge of clock.
    NRF_SPIS_MODE_1, ///< SCK active high, sample on trailing edge of clock.
    NRF_SPIS_MODE_2, ///< SCK active low, sample on leading edge of clock.
    NRF_SPIS_MODE_3  ///< SCK active low, sample on trailing edge of clock.
} nrf_spis_mode_t;

So for example Mode 1 sounds contradictory docuamentation says (Leading) and (Active Low) while code comments says "active high", "trailing".

Can you correct the one which is wrong?

Parents
  • Looking at it for some more time it seems the wrong is documentation, and SDK is right. IMO the correct documentation shall say

    Table 69: SPI modes
    Mode Clock polarity Clock phase
    CPOL CPHA
    SPI_MODE0 0 (Active High) 0 (Leading)
    SPI_MODE1 0 (Active High) 1 (Trailing)
    SPI_MODE2 1 (Active Low) 0 (Leading)
    SPI_MODE3 1 (Active Low) 1 (Trailing)
    

    But still can you correct it at source? Unfortunately I do not have access to latex sources of your documentation so I can not correct it myself...

Reply
  • Looking at it for some more time it seems the wrong is documentation, and SDK is right. IMO the correct documentation shall say

    Table 69: SPI modes
    Mode Clock polarity Clock phase
    CPOL CPHA
    SPI_MODE0 0 (Active High) 0 (Leading)
    SPI_MODE1 0 (Active High) 1 (Trailing)
    SPI_MODE2 1 (Active Low) 0 (Leading)
    SPI_MODE3 1 (Active Low) 1 (Trailing)
    

    But still can you correct it at source? Unfortunately I do not have access to latex sources of your documentation so I can not correct it myself...

Children
No Data
Related