cancel
Showing results for 
Search instead for 
Did you mean: 

SPI Problem

sr_shinde
Associate II
Posted on August 22, 2008 at 11:53

SPI Problem

3 REPLIES 3
sr_shinde
Associate II
Posted on May 17, 2011 at 09:55

Hi All

I have configured SSP0 of STR912.

configuration is as follows:

/* SSP0 configuration */

SSP_InitStructure.SSP_FrameFormat = SSP_FrameFormat_Motorola;

SSP_InitStructure.SSP_Mode = SSP_Mode_Master;

SSP_InitStructure.SSP_CPOL = SSP_CPOL_Low;

SSP_InitStructure.SSP_CPHA = SSP_CPHA_1Edge;

SSP_InitStructure.SSP_DataSize = SSP_DataSize_8b;

//for 1.4 kbps

SSP_InitStructure.SSP_ClockRate = 150;

SSP_InitStructure.SSP_ClockPrescaler = 228;

SSP_Init(SSP0, &SSP_InitStructure);

SSP_LoopBackConfig(SSP0, DISABLE);

SSP_Cmd(SSP0,ENABLE);

Then I am checking

while(SSP_GetFlagStatus(SSP0, SSP_FLAG_TxFifoEmpty) == RESET);

and then transmitting some data

After that waiting for response

/* Loop while Transmit FIFO is full */

while(SSP_GetFlagStatus(SSP0, SSP_FLAG_TxFifoEmpty) == RESET);

and reading value

data = SSP_ReceiveData(SSP0);

I am getting same data that I have transmited

I am getting same result whether slave is connected or not.

I have disabled LoopBack mode.

Please help me solve the problem.

Regards

Sai

sr_shinde
Associate II
Posted on May 17, 2011 at 09:55

Hi all,

I got solution. I had connected NSS of my master to Nss of slave.But If uc is in master mode NSS has to be connected to VDD(high).Otherwise u will get loopback effect .U will receive whatever u have transmitted.

Regards

Sai

sripad
Associate
Posted on May 17, 2011 at 09:55

Thank you for your valuable input dear friend!