AnsweredAssumed Answered

STM32L496 SPI don't work 8bit

Question asked by Davide Maiocchi on Nov 9, 2017
Latest reply on Nov 10, 2017 by Clive One

Hi,

i use a STM32L496.

I configured the SPI to communicate 8bit but it always generates 16clk e 16bit data.

SPI : MASTER- halfduplex 2wire(1clk , 1Mosi/Miso)

 

 /* Enable clock for SPI2 */
 RCC->APB1ENR1 |= RCC_APB1ENR1_SPI2EN;
 // BIDIMODE=1 - BIDIOE=1 - RXONLY=0 - SSM=1 - SSI=1 - LSBFIRST=0 - BRR=111 - MSTR=1 - CPOL=0 - CPHA=0
 SPI2->CR1 = SPI_CR1_BIDIMODE | SPI_CR1_BIDIOE | SPI_CR1_SSM | SPI_CR1_SSI | SPI_CR1_BR | SPI_CR1_MSTR;
 //FRXTH=1 - DS=0111 8bit - RXNEIE=1
 SPI2->CR2 = SPI_CR2_FRXTH | SPI_CR2_DS_2 | SPI_CR2_DS_1 | SPI_CR2_DS_0 | SPI_CR2_RXNEIE;

 

"CR2 DS" it does not work

Outcomes