why prefer SSP instead of SPI everywhere??? confused :-s

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

why prefer SSP instead of SPI everywhere??? confused :-s

3,322 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by khmtambi on Mon Jul 22 12:10:53 MST 2013
hi all,

i am new to this forum and to the ARM programming also. I have had experience with some simple peripherals but i am stuck with SPI interfacing with serial flash memory. the problem is that whereever i look i find the examples for SPI written with SSP0. the whole code is written in SSP0. no register of SPI has been initialized or used. i recently found out that SSP0 when used as SPI has a FIFO which allows communications to greater extent and also provides a data bufer while SPI doesnt provide buffer when transmitting.

I tried to develop a code but i cant verify it and its not working  ;) . firstly because nobody writes code for legacy SPI and secondly when running the simulator, the SPI->SPDR doesnt show any data(although it indicates SPI flag when completed and SPI write collission when overwritten).

can anyone eliminate my confusion as to why we dont prefer legacy SPI over SSP0. i mean why provide with SPI function when that same function can be implemented on SSP.

thanks :)
Labels (1)
0 Kudos
14 Replies

2,406 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Rob65 on Fri Sep 27 08:49:40 MST 2013

Quote: lkoziarz
Our findings with the LPC1788's SSP engine is that you can't transfer more than 16 bits at a time with chip select held down.  The SSP engine will raise CS and your slave device will latch prematurely.



Unfortunately this is the correct behaviour.
The SPI specification states that the CS (SSEL) line should be active during a frame and become inactive in between. NXP interpreted this as a word being one frame. This means that the CS as generated by the SSP block (the same goes for the legacy SPI) is only active during one transaction of up to 16 bits.

Note also that there is always a gap in between the words/frames being sent. So even when you fill the FIFO or use DMA you will see 16 clock pulses, a short delay and then 16 more pulses.

When using a GPIO pin as SSEL, please note you have to wait for SSEL assertion or de-assertion until the peripheral is idle (I don't have the user manual at hand but there is a bit in the status register for this).

Rob
0 Kudos

2,406 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by wmues on Tue Sep 24 12:54:43 MST 2013

Quote: Pacman
I don't know if this will work or help, it's just a thought that came my way...

Have you tried changing the pin configuration for the SS pin, to - say - a GPIO pin and keep it low all the time ?



This is how I have done it in the past. It works.

In theory, you could also use DMA, but what if the DMA is not supplying the next data in time?
0 Kudos

2,406 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Pacman on Mon Sep 23 14:31:27 MST 2013
I don't know if this will work or help, it's just a thought that came my way...

Have you tried changing the pin configuration for the SS pin, to - say - a GPIO pin and keep it low all the time ?
0 Kudos

2,406 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lkoziarz on Mon Sep 23 13:59:27 MST 2013
Our findings with the LPC1788's SSP engine is that you can't transfer more than 16 bits at a time with chip select held down.  The SSP engine will raise CS and your slave device will latch prematurely.

We've been trying to interface to a device that needs 24 bits of data moved in a chunk and have had to resort to bit-banging it over GPIO to make it work.  Unless someone can interpret the datasheet better, you might be out of luck.
0 Kudos

2,406 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Pacman on Wed Sep 18 06:54:35 MST 2013
I agree completely with Rob45. :)

-Sometimes, though, if SPI and SSP are available on two different pinouts, you might want to choose to use SPI, so you can have the SSP free for more advanced functionality.

>> I see the clock signal and it looks good, even MOSI and MISO signals are good. But I always read a 0 on DR register.

It sounds like you may need to set up alternate pin functions.
(See UM10441 Chapter 7).
0 Kudos

2,406 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by haricharan on Wed Sep 18 01:46:21 MST 2013
@Martin84
Hi,
I'm trying to use a spi flash memory (Atmel SST25VF064C), i can't get it working with LPC1227.
I see the clock signal and it looks good, even MOSI and MISO signals are good. But I always read a 0 on DR register.
I've tried several pieces of code, but I always read a 0 on DR.
Does anyone have a similar problem or a working piece of code that could help me?
0 Kudos

2,406 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by haricharan on Wed Sep 18 01:45:24 MST 2013
I'm trying to use a spi flash memory chip (SST25VF064C), i can't get it working with LPC1227.
I see the clock signal and it looks good, even MOSI and MISO signals are good. But I always read a 0 on DR register.
I've tried several pieces of code, but I always read a 0 on DR.
Does anyone have a similar problem or a working piece of code that could help me?
0 Kudos

2,406 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Rob65 on Mon Aug 05 10:26:19 MST 2013
SSP is not the same as SPI.
The SSP peripheral  is a mulri protocol peripheral which is also able to function as an SPI interface.
The SPI  interface is the legacy peripheral as it was available in the lpc2xxx series, the whole reason for having this peripheral in the lpc17xx is to make it easier to port software to the new lpc17xx.

Since the SSP interface is newer and more versatile, the examples use the new SSP interface. For new designs, the SPI interface is not recommended.

Rob
0 Kudos

2,406 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by khmtambi on Tue Jul 23 09:47:05 MST 2013
thats the main confusion. why SPI has a seperate chapter in which the SPI registers are described if SPI can also be operated in SSP? the power and clocking block is perfect because i checked in simulator. but the SPI data register is not indicacting any data transfer.
can you tell me when you simulate it in MDK compiler the data shows up in respective register?

if it does then i will probably start programming ssp0 as SPI
0 Kudos

2,406 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Martin84 on Tue Jul 23 03:40:01 MST 2013
Hi I havn't realized yet that there is a real SPI Interface on some 17xx. I had just programmed the 18xx and the 1788 and there are only the two SSP Interfaces with SPI-Mode. SPI should work with all three Interfaces, SPI0 and SSP0/1. Look at the basic configuration. Did you enabled the power for SPI. Did you set the correct function for the pins?
0 Kudos

2,406 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by khmtambi on Mon Jul 22 23:13:15 MST 2013

Quote: Martin84
Hi,

SPI = SSP. For example, you have two "SPI"-Interfaces: SSP0 and SSP1 on LPC17xx and LPC18xx. Have you enabled the SSPx Peripheral Clock?

Regards,

Martin



thanks martin. i know spi = ssp but the user manual describes chapter 17 for legacy SPI and all the registers are related to SPI while chapter 18 of the user manual deals with SSP and registers are different there.

i implemented the code according to chapter 17. should i discard this code and go with the SSP?
0 Kudos

2,406 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by khmtambi on Mon Jul 22 23:07:43 MST 2013

Quote: wmues
I do not understand your Problems.

I use SPI for interfacing to serial flash, and it is running fine.

regards
Wolfgang


i meant to say since SPI function has been given why do majority of people are implementing SPI on SSP0/1? everywhere the sample code initializes the SSP0 port for SPI communication but not the SPI port described in chapter 17 of the user manual. and can you share with me the code i just want to look just where i am making mistakes.

thanks :)
0 Kudos

2,406 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Martin84 on Mon Jul 22 22:45:15 MST 2013
Hi,

SPI = SSP. For example, you have two "SPI"-Interfaces: SSP0 and SSP1 on LPC17xx and LPC18xx. Have you enabled the SSPx Peripheral Clock?

Regards,

Martin
0 Kudos

2,406 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by wmues on Mon Jul 22 14:20:14 MST 2013
I do not understand your Problems.

I use SPI for interfacing to serial flash, and it is running fine.

regards
Wolfgang
0 Kudos