AnsweredAssumed Answered

SPI1 setting up problem on STM32F09x

Question asked by lorenzo meneghello on Jan 30, 2017
Latest reply on Jan 30, 2017 by lorenzo meneghello

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.

Outcomes