Skip to contentSkip to conversation

PXA270 SPI + SD card

DISCUSSION Cliff Brake 3 participants 4 messages Nov 4, 2009 – Nov 5, 2009 2 messages not in the archive SPI

lore
Share & tools
lore
#0 lore raw

Hello,

I'm trying to get a PXA270 to talk to a SD card via SPI. Has anyone else done this?

One of the requirements is the CS stay low for the entire transaction.
Can this be done with the PXA270 controlling the frame (CS) signal,
or is GPIO control typically required?

Any pointers welcome.

Thanks,
Cliff

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july

A message that is not in the archive (sent off-list or not yet received): f96d234e0911041353o25aeee4aqbb482f162aaeac5f-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#2 lore raw
Quoted 8 lines · Cliff Brake

Hello,

I'm trying to get a PXA270 to talk to a SD card via SPI.  Has anyone else done this?

One of the requirements is the CS stay low for the entire transaction. Can this be done with the PXA270 controlling the frame (CS) signal, or is GPIO control typically required?

Also, what SPI mode is typically used for SD? Looks like 0 and 3 are the closest (http://elm-chan.org/docs/spi_e.html).

Thanks,
Cliff

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july

A message that is not in the archive (sent off-list or not yet received): f96d234e0911041354p1f11e415g427ec9b74ff4d25b-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#4 lore raw
Quoted 5 lines · Cliff Brake
Quoted 4 lines · Cliff Brake

Hello,

I'm trying to get a PXA270 to talk to a SD card via SPI. Has anyone else done this?

I haven't used an SD card, but...

Quoted 3 lines
Quoted 3 lines

One of the requirements is the CS stay low for the entire transaction.
Can this be done with the PXA270 controlling the frame (CS) signal,
or is GPIO control typically required?

A GPIO is typically used. The PXA2xx processors lack a multi-chip-select function for SPI devices, so one has to use a GPIO if more than one device is on the bus. Back in 2.6.20, there was a cs_control() call back to allow the pxa2xx_spi.c driver to control a separately allocated GPIO line. I think there is now a more generalized procedure in the kernel to specify the GPIO that is to be used for each device on the bus.

Quoted 2 lines

Also, what SPI mode is typically used for SD? Looks like 0 and 3 are the closest (http://elm-chan.org/docs/spi_e.html).

Not sure on that one. I think there was a lot of discussion about that a couple of years ago when someone was getting SD cards to work. You might want to search the archives if no one answers you directly.

Signature · 15 lines
Ned Forrester                                       nforrester-/[email protected]
Oceanographic Systems Lab                                  508-289-2226
Applied Ocean Physics and Engineering Dept.
Woods Hole Oceanographic Institution          Woods Hole, MA 02543, USA
http://www.whoi.edu/
http://www.whoi.edu/sbl/liteSite.do?litesiteid=7212
http://www.whoi.edu/hpb/Site.do?id=1532
http://www.whoi.edu/page.do?pid=10079


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
#5 lore raw
In reply to a message not in the archive

Hi Cliff,

Quoted 2 lines · Cliff Brake

Also, what SPI mode is typically used for SD? Looks like 0 and 3 are the closest (http://elm-chan.org/docs/spi_e.html).

I've found this in drivers/mmc/host/mmc_spi.c:mmc_spi_probe():

/* MMC and SD specs only seem to care that sampling is on the
* rising edge ... meaning SPI modes 0 or 3. So either SPI mode
* should be legit. We'll use mode 0 since the steady state is 0,
* which is appropriate for hotplugging, unless the platform data
* specify mode 3 (if hardware is not compatible to mode 0). */
if (spi->mode != SPI_MODE_3)
spi->mode = SPI_MODE_0;

baruch

Signature · 9 lines
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - [email protected] - tel: +972.2.679.5364, http://www.tkos.co.il -

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july