Accessing SDHC Cards with 8 GB

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Accessing SDHC Cards with 8 GB

Richard Rauch
Dear  All,

has anybody tried already to read from SDHC Cards >= 8GByte?
We ported SDCard driver to our hardware, which is working well with a bunch of SDCards.
But with SDCards >= 8 GByte we have problems.

We found , that the eCos FileSystem/Partition Manager is not able to interpret the MBR.
After analyzing we found strange content of MBR, which we cannot explain.
Even if SDCard is formatted with GUUID/GPT format, in MBR/LBA0 there should be a valid partition entry at offset 0x1BE, which protects the SDCard content with a "protective" MBR partition entry with code 0xEE.

But HexDump of our SDCard shows only text, where the partition table should be. We verified with formatting the card on different systems (Windows 7 64 Bit, Windows XP 32 Bit), but result is the same.
So the MBR in our opinion actually looks invalid, but the SDCard is readable on every PC bases system.
We still have not found the key hint in web, how to interpret such an MBR. Maybe somebody has already an idea.

By the way... we found also, that some "8GB Cards" have a few sectors less than 8GB and this cards are formatted in well known manner.

Content of MBR (partition table at 0x1BE has text content only):

000 - EB 58 90 4D 53 44 4F 53 35 2E 30 00 02 08 22 00 |?X.MSDOS 5.0.....
010 - 02 00 00 00 00 F8 00 00 3F 00 FF 00 00 00 00 00 |.....?.. ..?.....
020 - 00 E0 EC 00 1B 3B 00 00 00 00 00 00 02 00 00 00 |.??..... ........
030 - 01 00 06 00 00 00 00 00 00 00 00 00 00 00 00 00 |........ ........
040 - 00 00 29 91 D3 18 B0 4E 4F 20 4E 41 4D 45 20 20 |....?..N O.NAME..
050 - 20 20 46 41 54 33 32 20 20 20 33 C9 8E D1 BC F4 |..FAT32. ..3??.?
060 - 7B 8E C1 8E D9 BD 00 7C 88 4E 02 8A 56 40 B4 08 |.?N?... .N.?V...
070 - CD 13 73 05 B9 FF FF 8A F1 66 0F B6 C6 40 66 0F |?.s.??? ?f..?.f.
080 - B6 D1 80 E2 3F F7 E2 86 CD C0 ED 06 41 66 0F B7 |.?.?..?. ???.Af..
090 - C9 66 F7 E1 66 89 46 F8 83 7E 16 00 75 38 83 7E |?f.?f.F? ?...u8?.
0A0 - 2A 00 77 32 66 8B 46 1C 66 83 C0 0C BB 00 80 B9 |..w2f.F. f??....?
0B0 - 01 00 E8 2B 00 E9 48 03 A0 FA 7D B4 7D 8B F0 AC |..?..?H. .?....?.
0C0 - 84 C0 74 17 3C FF 74 09 B4 0E BB 07 00 CD 10 EB |.?t..?t. .....?.?
0D0 - EE A0 FB 7D EB E5 A0 F9 7D EB E0 98 CD 16 CD 19 |?.?.??.? .??.?.?.
0E0 - 66 60 66 3B 46 F8 0F 82 4A 00 66 6A 00 66 50 06 |f.f.F?.. J.fj.fP.
0F0 - 53 66 68 10 00 01 00 80 7E 02 00 0F 85 20 00 B4 |Sfh..... ........
100 - 41 BB AA 55 8A 56 40 CD 13 0F 82 1C 00 81 FB 55 |A.?U?V.? ......?U
110 - AA 0F 85 14 00 F6 C1 01 0F 84 0D 00 FE 46 02 B4 |?....??. ....?F..
120 - 42 8A 56 40 8B F4 CD 13 B0 F9 66 58 66 58 66 58 |B?V..??. .?fXfXfX
130 - 66 58 EB 2A 66 33 D2 66 0F B7 4E 18 66 F7 F1 FE |fX?.f3?f ..N.f.??
140 - C2 8A CA 66 8B D0 66 C1 EA 10 F7 76 1A 86 D6 8A |??f.?f? ?..v..?
150 - 56 40 8A E8 C0 E4 06 0A CC B8 01 02 CD 13 66 61 |V.????.. ?...?.fa
160 - 0F 82 54 FF 81 C3 00 02 66 40 49 0F 85 71 FF C3 |..T?.?.. f.I..q??
170 - 4E 54 4C 44 52 20 20 20 20 20 20 00 00 00 00 00 |NTLDR... ........
180 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |........ ........
190 - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |........ ........
1A0 - 00 00 00 00 00 00 00 00 00 00 00 00 0D 0A 52 65 |........ ......Re
1B0 - 6D 6F 76 65 20 64 69 73 6B 73 20 6F 72 20 6F 74 |move.dis ks.or.ot
1C0 - 68 65 72 20 6D 65 64 69 61 2E FF 0D 0A 44 69 73 |her.medi a.?..Dis
1D0 - 6B 20 65 72 72 6F 72 FF 0D 0A 50 72 65 73 73 20 |k.error? ..Press.
1E0 - 61 6E 79 20 6B 65 79 20 74 6F 20 72 65 73 74 61 |any.key. to.resta
1F0 - 72 74 0D 0A 00 00 00 00 00 AC CB D8 00 00 55 AA |rt...... ..??..U?

Thanks

Richard


--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

Reply | Threaded
Open this post in threaded view
|

AW: [ECOS] Accessing SDHC Cards with 8 GB

Richard Rauch
Maybe I found an answer (partially) right now.

I am always formatting SDCards ny usage of Windows (I have not verified with Linux, because our customers rarely using Linux)

I discovered this:
when a SD Card less than 8GB is formatted, it is formatted in a more standard way.
In this case in  first sector there is a valid MBR with a valid partition table.

When a SD Card has a size >= 8GB, it is formatted differently. No MBR is generated. In Sector 0 there is located already Bootsector with BPB.

Unfortunately eCos do not know about this. When mounting the SD Card, it tries to interpret the BPB as MBR.

What I do not know right now: Do I have a unique criteria to decide, if first sector needs to be interpreted as MBR or as boot sector already.
And, what would be the best position in eCos driver hierarchy, to code such a decision.

Or maybe, somewhere a solution is already available?

Thanks again

Richard


--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss