cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with SSP0 reception

arnaud
Associate II
Posted on December 26, 2007 at 10:14

Problem with SSP0 reception

6 REPLIES 6
arnaud
Associate II
Posted on May 17, 2011 at 09:45

Hello,

I have to drive a AT45D161 flash with the SSP0. The command sent by the SSP0 is correct and the AT45D161 responses datas to the SSP0 receiver. But the datas read in the STR9, stay at 0. Anyone has an idea ?

N.B: In loopback mode the datas read are correct (datas sent).

Here is my code.

SSP0 Initialization :

// P2.4 = CLK bus SPI

GPIO_StructInit (&GPIO_InitStructure);

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4;

GPIO_InitStructure.GPIO_Direction = GPIO_PinOutput;

GPIO_InitStructure.GPIO_Type = GPIO_Type_PushPull;

GPIO_InitStructure.GPIO_IPConnected = GPIO_IPConnected_Enable;

GPIO_InitStructure.GPIO_Alternate = GPIO_OutputAlt2;

GPIO_Init (GPIO2,&GPIO_InitStructure);

// P2.5 = MOSI bus SPI

GPIO_StructInit (&GPIO_InitStructure);

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5;

GPIO_InitStructure.GPIO_Direction = GPIO_PinOutput;

GPIO_InitStructure.GPIO_Type = GPIO_Type_PushPull;

GPIO_InitStructure.GPIO_IPConnected = GPIO_IPConnected_Enable;

GPIO_InitStructure.GPIO_Alternate = GPIO_OutputAlt2;

GPIO_Init (GPIO2,&GPIO_InitStructure);

// P2.6 : MISO bus SPI

GPIO_StructInit (&GPIO_InitStructure);

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6;

GPIO_InitStructure.GPIO_Direction = GPIO_PinInput;

GPIO_InitStructure.GPIO_Type = GPIO_Type_PushPull;

GPIO_InitStructure.GPIO_IPConnected = GPIO_IPConnected_Enable;

GPIO_InitStructure.GPIO_Alternate = GPIO_InputAlt1;

GPIO_Init (GPIO2,&GPIO_InitStructure);

// SSP0 Init

SSP_StructInit(&SSP_InitStructure);

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;

SSP_InitStructure.SSP_SlaveOutput = SSP_SlaveOutput_Disable;

SSP_InitStructure.SSP_ClockRate = 0;

SSP_InitStructure.SSP_ClockPrescaler = 2;

SSP_Init(SSP0, &SSP_InitStructure);

SSP_LoopBackConfig (SSP0,DISABLE);

SSP_Cmd(SSP0,ENABLE);

Datas Read :

// send dummy byte

SSP_SendData(SSP0,0);

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

// read byte

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

data = SSP_ReceiveData(SSP0);

amira1
Associate II
Posted on May 17, 2011 at 09:45

Hello arno,

You should replace GPIO_IPConnected_Enable by GPIO_IPConnected_Disable,in P2.4 and P2.5 configuration.

Please let me know if the problem persists.

Best regards,

mirou

roger_lynx
Associate II
Posted on May 17, 2011 at 09:45

You should replace GPIO_IPConnected_Enable by GPIO_IPConnected_Disable

What does the IP stands for? I found no explanation of it in the documentation.

Would you please explain it?

Thank you.

mark9
Associate II
Posted on May 17, 2011 at 09:45

It probably means ''Internal Peripheral'' (as input). Each pin can have 2 input functions. If the IP is disabled, then the input is just a GPIO. If the IP is enabled, then the internal peripheral (see the data sheet, not the reference manual) is connected.

It might also mean Intellectual Property, since many chip manufacturers license designs from other companies for peripherals, and they tend to call this peripheral a block of ''IP''. But that is probably a bit obscure. For instance, Bosch licenses their CAN hardware as ''IP'' to chip manufacturers such as Silicon Labs.

To add confusion, the data sheet calls this Alternate Input.

rajendrask
Associate II
Posted on May 17, 2011 at 09:45

Hi,

I am not able to write and read from flash. I am suing M25P64 flash connected on SSP0.

This sample code shows everything.

I am using STR910 evalutation board. M25P64 is flash on board.

I am able to read only Flash ID.

Please find my code below. Suggest me if any mistake..

Thanks

arnaud
Associate II
Posted on May 17, 2011 at 09:45

Hello,

Actually, if i replace GPIO_IPConnected_Enable by GPIO_IPConnected_Disable,in P2.4 and P2.5 configuration, the SSP0 can receive datas.

I had the same problem with the CAN and the UART reception and the problems are solved with the same way.

Best regards,

Arno