cancel
Showing results for 
Search instead for 
Did you mean: 

Slave select (NSS) pin management of SPI

davidyun9
Associate
Posted on April 26, 2011 at 15:10

Hi all,

Is there anyone who can give me some advice about the STM8S SPI? I tried to setup STM8S105 as the SPI master mode with the hardware slave select management mode which is transmit only mode. Here my source code is below:

 /*High speed internal clock prescaler: 1, Fmaster = 16MHz */

CLK_HSIPrescalerConfig(CLK_PRESCALER_HSIDIV1);

CLK_PeripheralClockConfig(CLK_PERIPHERAL_SPI, ENABLE);

/* Initialize SPI */

SPI_DeInit();

  

/* Initialize SPI in Master mode */

SPI_Init(SPI_FIRSTBIT_MSB, SPI_BAUDRATEPRESCALER_8, SPI_MODE_MASTER,

             SPI_CLOCKPOLARITY_HIGH, SPI_CLOCKPHASE_2EDGE, SPI_DATADIRECTION_1LINE_TX, SPI_NSS_HARD, 0x07);

/*Enable the SPI */

SPI_Cmd(ENABLE);

/*Send data form a master to a slave */

while (SPI_GetFlagStatus(SPI_FLAG_TXE)== RESET);

SPI->DR = Data;

When I send data NSS signal is not going down but staying on high as below a picture. 0690X00000603OUQAY.jpg

Actually I also tested with NSS software management mode, but the result was same unless I controled PE5(SPI_NSS Pin) manually.

Is there something configuration that I missed?

I would be glad if you could give any ideas or advice about this subject.

Thank you,

0 REPLIES 0