Lpc1769 SD card interface

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Lpc1769 SD card interface

2,603件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ranaya on Mon Jun 11 08:38:07 MST 2012
Hello Every1....

  I was looking for a schematic to interface an SD card with lpcxpresso lpc 1769 board. I dont have a baseboard. I found this schematic from one of the baseboard datasheet,

[IMG]https://dl.dropbox.com/u/16049803/nxp.JPG[/IMG]

I use P0.7 for SCK, P0.6 for SSEL instead of PIO2_11 and PIO2_10. And rest as the same.

Above schematic shows a set of 10k and 270ohm resistor pullups. Do I need all of them to integrate with SD card socket ?

Thanx :)
0 件の賞賛
返信
11 返答(返信)

2,110件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ranaya on Sat Jun 16 00:48:24 MST 2012
hi TheFallGuy....

Thanx alot it solved my problem. :)
0 件の賞賛
返信

2,110件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Fri Jun 15 04:20:02 MST 2012
Your code. Your haven't shown the definition of Float_STR, but assuming it is longer than the length of the string you are sprintf'ing into it, then you will be writing the null terminator, plus whatever random characters exist in the string after the null terminator... Suggest you use strlen() instead of sizeof().
0 件の賞賛
返信

2,110件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ranaya on Fri Jun 15 04:14:08 MST 2012
Hello Every1....

I could successfully communicated with an SD card using the example posted here by Mr.modestt :

http://knowledgebase.nxp.com/showthread.php?t=2574&page=2

and he mentioned,

Quote:
I have tested it with a standard FAT32 SD card and able to read and write/append files. pin connections are simple
CS -> P2.2 with pullup
MOSI -> P0.9
MISO-> P0.8
SCK-> P0.7



I just changed the CS line to original SSEL pin but have not used any pull up resistors. I just tied all 4 SSP pins to SD card without using additional circuitry. When I read the log file inside the SD, it shows sum NULL characters like this: (prints 0 to 49)
[IMG]https://dl.dropbox.com/u/16049803/code.JPG[/IMG]

Is this a problem of circuit ? or may be the code ?
0 件の賞賛
返信

2,110件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ranaya on Mon Jun 11 21:03:29 MST 2012
@Rob65 : Thanx alot for ur great explanation :) This is what newbies really expect  and they are lack of.

@Zero & Kayoda: Thank You too ;)
0 件の賞賛
返信

2,110件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Rob65 on Mon Jun 11 11:53:01 MST 2012

Quote: ranaya

@Rob65: Ur webpost is very helpful.. btw why the original baseboard won't run with 25MHz SPI ? Because of additional circuitry used in SD card interface ???

"I use P0.7 for SCK, P0.6 for SSEL instead of PIO2_11 and PIO2_10. And rest as the same." Connections ok ?



I have to guess regarding the 25 MHz but I'm guessing that long PCB traces (and their capacitance) are part of this.

Your connections seem OK to me. As long as you have the MISO/MOSI and SCK pins on one and the same SPI interface you're OK. Never mind about card-detect and CS lines; those can be any of the standard GPIO lines. You'll see that the P0.6 is used (with the SSEL1 special function) but the software uses it as a standard GPIO (output) line.

One other thing: if you have not yet settled for an SD card library then also have a look at FatFS too. That library is better maintained and has more features. The NXP application note (AN10916) shows how to use both efsl and fatfs on the LPC17xx.

Rob
0 件の賞賛
返信

2,110件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Mon Jun 11 11:44:30 MST 2012

Quote: ranaya
"I use P0.7 for SCK, P0.6 for SSEL instead of PIO2_11 and PIO2_10.



Yes, it's a valid SPI /SSP connection :)
0 件の賞賛
返信

2,110件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Rob65 on Mon Jun 11 11:37:50 MST 2012
Thanks to kayoda for providing that application note.
Too bad that most devices don't include any ESD/EMI on SD card interfaces. Mostly they think/hope/pray that the metal sleeve of the SD slot is already enough protection. There are too few 'engineers' (if you can still call them engineers) that state that once a chip is on the PCB you've already got enough ESD protection ...

For those who don't know: ESD is like those little shocks you get when pulling of a sweater during dry weather or when you tough the doorknob after walking over a carpet with sneakers. Our body works like a capacitor collecting electrical charge as we move around. Whenever we then touch some conductive device, this electric charge will be evenly distributed between two 'bodies'. If the charge is large enough we may feel this and even see a little flash in the dark.

This discharge of our charge into another device is ESD. It's a small current that flows from our body into the device. This discharge may be large enough to damage the device that we touch. Even if we don't feel anything, even if the device still works as expected, this discharge may damage the device. In the LPCXpresso controller a transistor may be damaged a little bit, a diode may be damaged or a wire on the chip may be damaged. The device may still be working but in two weeks up to a number of years this may result in a defective chip.
Compare this to a little bit of wear on a rope: it's still strong but the spot with the wear may continue to grow under stress and in the end the rope will break.

If you look at my schematics, you'll see the USB connector (top left) has a special protection circuit with 5 diodes - this is a very small device with 5 high power diodes to take the ESD pulses and protect the microcontroller.
As an extra security, the metal casing of the USB plus is not directly connected to the ground connection but through a 1 Mohm, 10 nF capacitor pair.
The idea behind this is that any ESD that hits the metal shell is discharged through the capacitor (the capacitor charges) and the 1M resistor discharges the capacitor again.

The idea of not having any ESD protection on the SD card is that this I used a hinge type connector that is embedded inside a device (no user access). The SD card is (ahum) 'factory' mounted and is not used replaceable. And if it was - the user would discharge through the metal hinge before coming in critical range of the data connections (I should have added an R/C combination on the hinge part for minimum safety ...). In fact, the USB connector is the only electrical part that will ever come in close range of the user.

Regarding the pull-up resistors: the LPC1xxx contains internal weak pull up resistors - they seem to work for me ... indeed it is much better (in a real device) to use the external 10k pull ups as on the base board.

Rob

P.s: don't think lightly about ESD. I've seen perfectly good working board suddenly having a malfunctioning peripheral (or worse)
0 件の賞賛
返信

2,110件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ranaya on Mon Jun 11 11:08:19 MST 2012
Hi thanx for replies gentlemen...

@Rob65: Ur webpost is very helpful.. btw why the original baseboard won't run with 25MHz SPI ? Because of additional circuitry used in SD card interface ???

"I use P0.7 for SCK, P0.6 for SSEL instead of PIO2_11 and PIO2_10. And rest as the same." Connections ok ?

Thanx
0 件の賞賛
返信

2,110件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ex-kayoda on Mon Jun 11 10:33:43 MST 2012
Of course there are options to protect (ESD/EMI)your SD:

http://www.nxp.com/documents/application_note/AN10911.pdf

Included schematics (for SPI connection to SD) show pullups for DO (to avoid floating SD output) and CS (to avoid unintended activation)
0 件の賞賛
返信

2,110件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Rob65 on Mon Jun 11 10:27:44 MST 2012

Quote: ranaya
schematic shows a set of 10k and 270ohm resistor pullups. Do I need all of them



No, I have no resistors at all on my board (see schematics at this page). It's a micro SD but the idea is the same.
By the way: the LPCXpresso base board (that is my base board with my micro-SD card + adapter) will not run with a 25 MHz SPI clock but on my own board (small board, short lines to the micro SD card) I've got no problem using that same card at 25 MHz.

Rob
0 件の賞賛
返信

2,110件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ex-kayoda on Mon Jun 11 09:30:19 MST 2012

Quote: ranaya
Do I need all of them to integrate with SD card socket ?
 


No :)
0 件の賞賛
返信