cancel
Showing results for 
Search instead for 
Did you mean: 

SPI disabled?

design
Associate
Posted on December 11, 2013 at 12:16

Hi,

I am using STM8L152C6. It is required to configure the SPI in the Master mode bi-direction communication.

I used the following library functions to perform that:

CLK_PeripheralClockConfig(CLK_Peripheral_SPI1, ENABLE);

SPI_Init(SPI1,SPI_FirstBit_MSB, SPI_BaudRatePrescaler_256, SPI_Mode_Master, SPI_CPOL_High, SPI_CPHA_2Edge, SPI_Direction_1Line_Tx, SPI_NSS_Hard,0);

GPIO_Init(SPI_SCS_PORT, SPI_SCS_PIN, GPIO_Mode_Out_PP_High_Fast);//SCS pin of the meter IC

SPI_Cmd(SPI1, ENABLE);

The problem is that, although the SPI enabled by calling the SPI_Cmd library function, I read SPI_CR1 control register and found the SPE bit is reset to '0'!! and hence the SPI is not working?

Any help :(

Thanks

0 REPLIES 0