cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L151 problem with SPI SCK signal

ecatala
Associate II
Posted on July 15, 2014 at 10:33

Hi

I am using thew micro STM32L151x8  and I am implementing the SPI driver.

I want to use the SPI in master mode and only in transmiting mode. I am using for this purpose only 3 lines: NSS, MOSI and SCK.

My first problem is that the SCK signal is not working well and when I send a byte it does make 8 pulses. It makes only a pulse.

I have configures the pins in the following way:

PA15: SPI_NSS (alternate, output open drain, pull-up) AF 5

PA12

: SPI_MOSI (alternate, output push pull, pull-down) AF 5

PB3

: SPI_SCK (alternate, output push pull, pull-down) AF 5

The driver has been configured  as it follows:

SPI_InitStructure.SPI_Direction = SPI_Direction_1Line_Tx;

 

SPI_InitStructure.SPI_Mode = SPI_Mode_Master;

 

SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b;

 

SPI_InitStructure.SPI_CPOL = SPI_CPOL_Low;

 

SPI_InitStructure.SPI_CPHA = SPI_CPHA_1Edge;

 

SPI_InitStructure.SPI_NSS = SPI_NSS_Hard;

 

SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_2;

 

SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB;

 

SPI_InitStructure.SPI_CRCPolynomial = 7;

 

 

Best regards,

#stm32 #spi #stm32l1xx
0 REPLIES 0