This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LP5899: SPI mode

Part Number: LP5899
Other Parts Discussed in Thread: LP5890

Tool/software:

Hi,

I have a question regarding which SPI mode to use with LP5899 that I hope you could help with.
I am using the LP5899 to control two LP5890’s, but am unsure if SPI mode 0 or 1 should be used for the microcontroller SPI peripheral connected to the LP5899. I’m using another controller than in the example code, so can not use and test the code directly as it is provided.

The LP5899 datasheet section “7.5.1 SPI Data Validity” (page 23) says:
”The data on SDI wire must be stable at the rising edge of the SCLK wire. The data on SDO shifts out at the falling edge of the SCLK wire. When no data is shifted into the device, the SCLK wire is expected to be logic low.”
To me this seems to indicate SPI mode 0  (CPOL=0: SCLK low when device is inactive (CS high), and CPHA=0: Data changed/shifted out on SCLK falling-edge, and sampled om rising-edge).

However, the below line in the example code file “led_hal_spi_board.c” uses “SPI_PROT_POL0PHA1”, which is SPI mode 1  (CPOL=0, CPHA=1).
SPI_setConfig(mySPI0_BASE, DEVICE_LSPCLK_FREQ, SPI_PROT_POL0PHA1, SPI_MODE_CONTROLLER, SPI_FREQ_IN_HZ, 16);

Do you know which mode is the correct one?

Best regards,
Peter