STM spi master sending extra clock signals.
I am trying to communicate with an adc chip acting as a spi slave to my stm32f3 spi master. So far I am unable to make it work.
After attaching an oscillscope I found out that if i send only 8 bits of data to the slave , I get exactly 16 clock pulses on the SCLK of my master even though I have set the data size as 8.
My master config is
SPIx->CR1 |= SPI_CR1_SSI;
SPIx->CR1 |= SPI_CR1_SSM;
SPIx->CR1 |= SPI_CR1_BR_0 | SPI_CR1_BR_2;
SPIx->CR1 |= SPI_CR1_MSTR;
SPIx->CR1 |= SPI_CR1_CPOL;
SPIx->CR1 |= SPI_CR1_CPHA;
SPIx->CR1 |= SPI_CR2_DS_0 | SPI_CR2_DS_1 | SPI_CR2_DS_2;
SPIx->CR1 &= ~SPI_CR1_RXONLY;
SPIx->CR1 |= SPI_CR1_SPE;
SPIx->CR2 |= SPI_CR2_FRXTH;I write 8 bits simply as
while (!(SPIx->SR & SPI_SR_TXE));
SPIx->DR = 0x54;
while (!(SPIx->SR & SPI_SR_RXNE));
while (SPIx->SR & SPI_SR_BSY);I am NOT sending any dummy bytes from the master to read back from slave. Right now I just want to send 8 bits to slave and see 8 clock pulses.
Can someone tell me what might be going on here?