AnsweredAssumed Answered

STM32L151 problem with SPI SCK signal

Question asked by catala.estanislao on Jul 15, 2014

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,

Outcomes