2017-01-30 03:53 AM
Hi all,
I'm trying to setting up the SPI interface on my STM32F091, I would use the SPI1 on the PB3&PB5 pin.
This is my simple code:
RCC->APB2ENR |= (1<<12);
GPIOB->MODER |= 0x880;
GPIOB->OSPEEDR |= 0xCC0;
SPI1->CR1 = SPI_CR1_MSTR | SPI_CR1_BR_1 | SPI_CR1_BIDIMODE | SPI_CR1_BIDIOE;
SPI1->CR2 = SPI_CR2_FRXTH | SPI_CR2_DS_2 | SPI_CR2_DS_1 | SPI_CR2_DS_0;
SPI1->CR1 |= SPI_CR1_SPE;
On debug I see that when I set the SPI_CR1_SPE bit, the SPI_CR1_MSTR bit is cleared and also the SPI_CR1_SPE bit not comes on.. Why? Something wrong? I want to send data only not receive.
Thanks.
Lorenzo.
Solved! Go to Solution.
2017-01-30 04:47 AM
NSS (when unconnected to external pin) is at zero which switches SPI to slave.
Use software SS.
JW
2017-01-30 04:47 AM
NSS (when unconnected to external pin) is at zero which switches SPI to slave.
Use software SS.
JW
2017-01-30 07:30 AM
Thanks that was the problem!