CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

SD memory card what is the dirty little secret.
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Guest








PostPosted: Thu Jul 22, 2004 7:31 pm     Reply with quote

Nick wrote:
if your looking for old files check the web archiver. The way back machine archives can help you get old files, I use that website so much, its almost abuse.

Nick


Sounds intersting, how about a link ?
Guest








PostPosted: Thu Jul 22, 2004 7:35 pm     Reply with quote

ckielstra wrote:
Quote:
I the meatime I searched the web and found the (I thin is latest) data sheet V1.7 on a Russian site !

The SD manual V1.7 can still be found on the Sandisk site http://www.sandisk.com/download/Product%20Manuals/Product%20ManualSDCardv1.7.pdf
And a few months ago I downloaded V1.9 from the Sandisk site, but these links are now broken and you have to contact Support. According to the revision history the only changes from v1.7 to v1.9 are VDD read/write values.


It's as I said. try to download it and they tell you to join the club... Your link to 1.7 still works for me, but no 1.9....

As you have the manul, did you check on the MMC initialization CMD0 CMD1 ?
Guest








Re: SD memory card what is the dirty little secret.
PostPosted: Thu Jul 22, 2004 7:36 pm     Reply with quote

Jerry I wrote:
Reading about your problem I had found some app. notes on web.

Don't know if they will help.

Links

http://www.intel.com/design/pca/applicationsprocessors/applnots/278533-001.htm

http://www.tomsnetworking.com/Sections-article82.php

Good Luck Very Happy


Thanks I'll downlaod what I can...
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Fri Jul 23, 2004 11:21 am     Reply with quote

Hans,

After a good night of sleep I suspect your problem with two FAT's must have something to do with your new formatting routine. Is your MBR correct? Are you sure you are writing the MBR to the first sector in the Flash card? How many partitions are you configuring?

Like I wrote before, the only difference between the V1.7 en V1.9 manuals has to do with updated VDD values according to the Change Notes (and the manual is 200kb smaller...). I couldn't find any reference to differences in the CMD0-CMD1 or CMD0-ACMD41 sequences, but as I don't have all documentation there is a possibility for differences between the SPI and SD-card mode.

Some more documentation for your growing collection:
MMC-System-Summary-v3.31.pdf
In Chapter 8 this document gives a description of two file formats for the MMC card, these are the same as described in the FILE_FORMAT field of the SD-card CSD-register. I mentioned this field in an earlier post and it seems that the value '0, Hard disk-like file system with partition table' is the only practical value used in DOS-compatible file systems. Very likely this value is correct in your system and can be dismissed as a possible error cause.
Guest








If you have Data sheet V1.7
PostPosted: Fri Jul 23, 2004 8:03 pm     Reply with quote

If you have Data sheet V1.7 Page 4-6 Figure 4-7 you will see a diagram of how the MMC is initialized . Eveyrthing satrts with CMDO Then CMD1 for MMC SPI mode.

Also Page 4-7 4.3.2
The MultiMediaCard will not respond to ACMD41 (actually it will not respond to APP_CMD—CMD55, that
precedes it). The MultiMediaCard will be initialized as per the MultiMediaCard spec, using SEND_OP_COND
command (CMD1 of MultiMediaCard). The host should ignore an ILLEGAL_COMMAND status in the
MultiMediaCard response to CMD3, since it is a residue of ACMD41 which is invalid in the MultiMediaCard
(CMD0, 1, 2 do not clear the status register). Actually, ACMD41 and CMD1 will be used by the host to distinguish between MultiMediaCard and SD Cards in a system.

As you see it is in the data sheet, yet you claim it is not...

Boot sector is of course at address ZERO like I would writ e it to someother location...! These cards do NOT have DOS partitions...

No. the two boot sectors are NOT because of my format routine.!

My format routine was writen to PROVE the existance of the "other boot sector" !
In the example I described, I had an original 16 MEG card factory formated by Toshiba as FAT12 readable on the USB card reader as FAT12.
I then put it in my hardware where upon reading Sector 0 I got all 00's . This led me to try and write the boot sector to what the SPI sees as adress zero.

That new FAT16 boot sector WORKS, but cannot be seen by the USB card reader which is using SD protocol, the USB card reader still sees FAT12...

I was then able to boot and read/write files using the bootsector/FAT16 that I put on the card.
However on the PC USB card reader it is still showing as FAT12 ! and my files are not showing up.

Futher in the doc. you will find a reference to the secure DOS area. It's an area I cannot "get at" because it requires the secure access protocol, which SD Org. are charging $11K for...... Arrrrrrrrgh ! bastards, I hope they fry in hell..


So if you READ the data sheet that you say you have you can find all of this...

There are TWO bootsectors and two FAT areas in the secure DOS image area. See page 1-8 Figure 1-2 where you will see a diagram showing TWO sector 1 each with Block 0,1,2,n
And on that same page you can read this
"Protected Area—The part of the Card that relates to the secured copyright management and has separate DOS
partitioning including sectors and blocks. The card write protection mechanism does not effect this area."

See the words
SEPARATE DOS PARTITIONING inclduing sectors and blocks...

it does not say in that many words, but the default protocol is the SD protocol and I suspect that is what the USB card reader is using and seeing the SEPARATE DOS partitioning...

In the MMC mode which I am using, it sees the un-secured area which ALSO has a boot sector...
Just look at the after thought of the connectors…. The MMC card had equal spacing and lots of it, they never thought further than that, and when SD came along the squeezed in the 1/3 wide connector. It is a typical “designed by committee product” both in the hardware and in the firmware, and it shows…


Thanks but unless you are offering some new information I refuse to lead you through the data sheet any more...
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Sun Jul 25, 2004 12:46 pm     Reply with quote

No new information.

Sorry for having upset you. I'm only trying to help, no personal gain for me other than the attraction of solving a good puzzle.

Good luck.
bye.
Guest








PostPosted: Sun Jul 25, 2004 7:59 pm     Reply with quote

ckielstra wrote:
No new information.

Sorry for having upset you. I'm only trying to help, no personal gain for me other than the attraction of solving a good puzzle.

Good luck.
bye.


Well your replies have been full of incorrect statements, and everything that could be confirmed in the data sheet.

It's not helpful to start rumors about thin SD cards, and saying MMC is not initialized using CMD0 and CMD1, when it clearly is...etc. etc. etc.

Anyway, no offense, just try to stick to the fact....

Best regards
Hans Wedemeyer
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Mon Jul 26, 2004 2:25 am     Reply with quote

Hans Wedemeyer wrote:
It's not helpful to start rumors about thin SD cards

Rumors???
See 'SD-Memory Card Specifications / Part 1. Physical Layer Specification; Version 1.01, chapter 8.4: Thin (1.4mm) SD Memory Card'.

Enough said.
Guest








PostPosted: Mon Jul 26, 2004 2:58 pm     Reply with quote

ckielstra wrote:
Hans Wedemeyer wrote:
It's not helpful to start rumors about thin SD cards

Rumors???
See 'SD-Memory Card Specifications / Part 1. Physical Layer Specification; Version 1.01, chapter 8.4: Thin (1.4mm) SD Memory Card'.

Enough said.


OK you win on that...
How about you insistance that CMD0 and CMD 1 are not used to init. MMC... yes enough said...
kevin



Joined: 08 Sep 2003
Posts: 6
Location: salina,ks

View user's profile Send private message Send e-mail

SD memory card spec sheets
PostPosted: Mon Jul 26, 2004 3:17 pm     Reply with quote

Quote:
I the meatime I searched the web and found the (I thin is latest) data sheet V1.7 on a Russian site !


Is this the same russian site where we can buy cheap flowers? Razz

http://www.ccsinfo.com/forum/viewtopic.php?t=19984

sorry...couldn't resist!

kevin
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Mon Jul 26, 2004 4:45 pm     Reply with quote

Hi Hans,

You really like pushing it, don't you? Smile

I've been angry with you all day because I'm only trying to help you and then you give me this kind of [censored], but after your last post I could see the humor of it and had to laugh about the two us. I don't know if I offended you in some way by my style of writing, English is not my native language so I sometimes do miss the small nuances.

Quote:
How about you insistance that CMD0 and CMD 1 are not used to init. MMC...

This must be my remark you are referring to:
Quote:
Wait a moment, you are initializing the SD-card with CMD0 and CMD1? I didn't know this was possible! The normal sequence for an SD-card is to use CMD0-ACMD41, I checked it and only in SPI-mode the SD card supports CMD1. So this difference in startup commands is one more difference between your application and the USB-readers.

I never mentioned MMC, so I think I win here too.... Cool
Reading it again I think I didn't make myself very clear, but what I meant to say was that I never realized this difference between SPI- and SD-card mode. I was surprised to have overlooked this detail in the manual and you gave me some new knowledge. So I was just saying 'thank you'....

I should have been more specific in my boot sector 0 address reference: Ofcourse I knew you know it is the first sector on the disk, but LBA access refers to it as block number 0 while other methods call it cylinder0, head 0, sector 1. So depending on your access method you have to refer to it with a parameter 0 or 1.
I do like brainstorming as a method of keeping an open mind, and I know some of the results were pointing in the wrong direction. On the other hand I was the person who pointed you at the "seperate DOS partitioning" phrase which I think is the clue to your problem. I'm not perfect but sometimes I do have my good moments.

I'm wondering: Not all your SD-cards are giving problems, isn't it? Have you studied the differences in the status registers for the working and failing cards? Especially the SECURED_MODE field seems interresting to prove your theory for the failing cards to be in secure mode.

Carlo


Last edited by ckielstra on Mon Jul 26, 2004 5:01 pm; edited 1 time in total
Guest
Guest







PostPosted: Mon Jul 26, 2004 4:59 pm     Reply with quote

ckielstra,
Please check your PM box.
Hi
Guest







What is ACMD41 ?
PostPosted: Tue Jul 27, 2004 12:03 pm     Reply with quote

Hi,

I know that CMD1 is 0x41. What is ACMD41 ?
I have been all around the SD card datasheet and unable to figure this out.

Also, If I understand the documents right, a SD card will not initialize to SPI mode with code written for a MMC card. Is this correct ?

Given that I have enough IO pins, how hard is it to use an SD card in 4Bit SD card mode ? I expect that the ansver will explain why there's no sample code for that mode around the web.

Any clues ?

Thanks.
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Tue Jul 27, 2004 4:33 pm     Reply with quote

Hi Guest, who are you?

Quote:
I know that CMD1 is 0x41. What is ACMD41 ?
I have been all around the SD card datasheet and unable to figure this out.

Which document are you using? I searched the "SanDisk Secure Digital (SD) Card Product Manual" and found 130 hits. This document used to be on the Sandisk website but all links to it have now been removed, search this thread, somewhere I posted a direct link to the document on the Sandisk website. Basically the ACMD commands are an SD-card extension to the MMC command set, these commands are preceded with a CMD55. An ACMD41 is constructed of first sending CMD55 and then CMD41.

Quote:
Also, If I understand the documents right, a SD card will not initialize to SPI mode with code written for a MMC card. Is this correct ?

This is part of the discussion going on here and not sorted out yet. As I understand it, the SD-card is backwards compatible meaning that you can insert an MMC in an SD slot and it will work. The other way around, forward compatibility, is not garuanteed. Treating an SD-card the same way as an MMC card has resulted in some behavior that can't be explained yet.

One major drawback from SD-cards is that the organization behind it wants every company creating a design with this type of cards to become a member, annual costs starting at US$1500 membership and US$1000 per product type. It's an open standard but not comming for free. Without the membership you don't have access to the full documentation which turned out to be a pain in the ***.

Another drawback is that SD-cards have a minimum erase size of 512 bytes, so modifying a single byte requires temporary storage of the other 511 bytes. RAM is limited in most PICS so often you end up adding something like a small serial FRAM chip to your design. I think Compact Flash is not having this limitation.

Quote:
Given that I have enough IO pins, how hard is it to use an SD card in 4Bit SD card mode ? I expect that the ansver will explain why there's no sample code for that mode around the web.

Using the card in 4Bit mode is not extremely difficult, but why do you want to do this? 4-bit mode allows a larger set of commands, registers and CRC check so there is more code required to cover all this. Speed enhancement is not an issue as the PIC is the bottleneck in SPI-mode.

The most important reason for choosing SD-cards is the low I/O pin count. If you can spare the I/O-pins Compact Flash has the best features.
direnc



Joined: 28 Jul 2004
Posts: 5

View user's profile Send private message Visit poster's website

PostPosted: Wed Jul 28, 2004 5:59 am     Reply with quote

Hi ckielstra,

Thanks for your aswers.

Quote:
Hi Guest, who are you?

My name is Direnc. I am trying to interface an MMC card to an 16f877.
I can read from the MMC card. The card is a 32MB one. I also have an 8MB Panasonic SD card, from which I have not been able to read yet.

I have the documentd titled "SanDisk Secure Digital Card Product Manual Version 1.9".

Quote:

Another drawback is that SD-cards have a minimum erase size of 512 bytes, so modifying a single byte requires temporary storage of the other 511 bytes. RAM is limited in most PICS so often you end up adding something like a small serial FRAM chip to your design. I think Compact Flash is not having this limitation.


32MB of storage is more than enough for me and I will use only the first 64 bytes of each block and fill the rest with zeros.

One more question. I formatted my card to fat16. Filled the whole card with a single file, each byte of which is 0x00. When I open the card with a disk editor software the beginning of the file is at 0x41000. When I read it from the PIC the file begins at 0x45000, and at 0x41000 I have the volume name followed by the name of that file.

Any explanation for this behaviour ?

Regards,

Direnc
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group