2013-12-11 03:16 AM
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 ICSPI_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