Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: SD card problem!

2005-05-09 by Gus

We never tried miniSD but I am assuming it is the same as SD!! and 
for that I gave you the SPI settings that we have been using for 2 
years! By the way, I am not the one who wrote the driver for SD so I 
don't know much about it.
The SD manual is available at http://sandisk.com/oem/manuals.asp

If you need consulting, contact our company dirrectly and we will be 
happy to help.

Gus

--- In lpc2000@yahoogroups.com, "Sunil Jha" <jha0574@y...> wrote:
> Hi Gus,
>    Actually setting S0SPCCR = 8 makes SPI clock rate = 1.875 MHz 
> (Xtal=12 MHz, PLL MSEL=5 PSEL=2, VPBDIV=2). Can you let me know 
> which speed will be fine with mini SD memory card? At present I am 
> working with 0.5 MHz.
> 
> S0SPCR=0x30 makes CPOL=1 which is not working in my case. With 
this 
> I am getting Response of CMD0 as 0x00. With CPOL=0, setting 
> S0SPCR=0x20, the response byte of CMD0=0x01. Which indicates card 
in 
> Idle State and is expected.
> 
> One more help.. After Initializing in SPI Mode through CMD0 what 
> would be the command sequence for reading CID register or 
performing 
> any Read/Write operation? Also is it required to pull-up MOSI and 
> MISO lines?
> 
> In one Forum at Microchip, I saw it is recommended to pad oxFF 
> before and after CMD0 command. Now CMDO is 0xFF 0x40 0x00 0x00 
0x00 
> 0x00 0x95 0xFF. I tried it and it is giving response 0x01.
> 
> Please help me in understanding these problems and rectifying them.
> 
> regards,
> Sunil
> 
> 
> --- In lpc2000@yahoogroups.com, "Gus" <gus_is_working@y...> wrote:
> > change these in your code
> > 
> > S0SPCCR=8;
> > S0SPCR=0x30;
> > 
> > Make sure the hardware CS pin of SPI is connected to VCC
> > 
> > look at the schematics on our website
> > 
> > www.ghielectronics.com
> > 
> > Gus
> >   
> > --- In lpc2000@yahoogroups.com, "Sunil Jha" <jha0574@y...> wrote:
> > > Hi Atanas,
> > >    I am trying to initialize my Mini SD memory card in SPI 
mode 
> > > using LPC2129, but after lots of effort not able to do so. The 
> SPI 
> > > bus is working with another SPI IC, i have tested it before 
> > > connecting to memory. I have incorporated corrections - Pull 
> SSEL 
> > to 
> > > high and use another GPIO as SSEL.Every time i am getting 
> response 
> > > 0xFF from memory. Below is my code:
> > > ---------------------------------------------------------------
--
> --
> > --
> > > void init_SPI0 (void)
> > > {
> > > 	PINSEL0 		|= 	0x00005500;		
> > > 	//Enable SPI0 pins
> > > 	IODIR0 			|= 	0x00000001;		
> > > 	//Enable Chipselect pin as output
> > > 	
> > > 	S0SPCCR			=	0x0000001E;		
> > > 	//Set bit timing  PCLK/30
> > > 	S0SPCR   		=	0x000000A0;		
> > > 	//Configure as SPI Master interrupts enabled
> > > 
> > > 	IOSET0 	|= 	CS;		//Pull Chipselect high
> > > 	
> > > }
> > > 
> > > void init_memory(void)
> > > {
> > > 	unsigned char txstatus, byteread;
> > > 
> > >         IOCLR0 	|= 	CS;		//Pull Chipselect low
> > > 	
> > > 	S0SPDR = 0x40;
> > > 	while (!(S0SPSR & 0x80)) 
> > > 		putchar('+');
> > > 	txstatus = S0SPSR;
> > > 	S0SPDR;
> > > 	sprintf(str,"Transmit Status 0x40 %x\n",txstatus);
> > > 	putstr(str);
> > > 
> > > 	S0SPDR = 0x00;
> > > 	while (!(S0SPSR & 0x80)) 
> > > 		putchar('+');
> > > 	txstatus = S0SPSR;
> > > 	S0SPDR;
> > > 	sprintf(str,"Transmit Status 0x00 %x\n",txstatus);
> > > 	putstr(str);
> > > 
> > > 	S0SPDR = 0x00;
> > > 	while (!(S0SPSR & 0x80)) 
> > > 		putchar('+');
> > > 	txstatus = S0SPSR;
> > > 	S0SPDR;
> > > 	sprintf(str,"Transmit Status 0x00 %x\n",txstatus);
> > > 	putstr(str);
> > > 
> > > 	S0SPDR = 0x00;
> > > 	while (!(S0SPSR & 0x80)) 
> > > 		putchar('+');
> > > 	txstatus = S0SPSR;
> > > 	S0SPDR;
> > > 	sprintf(str,"Transmit Status 0x00 %x\n",txstatus);
> > > 	putstr(str);
> > > 
> > > 	S0SPDR = 0x00;
> > > 	while (!(S0SPSR & 0x80)) 
> > > 		putchar('+');
> > > 	txstatus = S0SPSR;
> > > 	S0SPDR;
> > > 	sprintf(str,"Transmit Status 0x00 %x\n",txstatus);
> > > 	putstr(str);
> > > 
> > > 	S0SPDR = 0x95;
> > > 	while (!(S0SPSR & 0x80)) 
> > > 		putchar('+');
> > > 	txstatus = S0SPSR;
> > > 	S0SPDR;
> > > 	sprintf(str,"Transmit Status 0x95 %x\n",txstatus);
> > > 	putstr(str);
> > > 	
> > > 	S0SPDR = 0xFF;
> > > 	while (!(S0SPSR & 0x80)) 
> > > 		putchar('.');;
> > > 	txstatus = S0SPSR;
> > > 	byteread = S0SPDR;
> > > 	sprintf(str,"Byte Read %x\n",byteread);
> > > 	putstr(str);
> > > }
> > > ---------------------------------------------------------------
--
> > > 
> > > If you have acheived this can you please help me in getting my 
> > card 
> > > initialized for SPI mode?
> > > 
> > > regards,
> > > Sunil
> > > 
> > > --- In lpc2000@yahoogroups.com, "Atanas Tulbenski" 
<top4e@y...> 
> > > wrote:
> > > > 
> > > >  I'm using SD card with LPC2124. At first I used software 
SPI 
> > and 
> > > > everything was fine. When I start using hardware SPI got 
> > problem. 
> > > The 
> > > > SD card initializes, I can read serial numbers, but I cant 
> read 
> > > data 
> > > > using CMD17. The card returns error code 0x04 "ilegal 
> command". 
> > > Any 
> > > > sugestions?

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.