Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Strange SD Read

Status
Not open for further replies.

UTMonkey

New Member
Dear All,

I have pretty much finished my SD Routines and have started testing them with a collection of SD cards I have accumulated.

I have had positive results with 128MB, 256MB and 1GB cards - no problem.

I am left with a 512mb and 1GB card which is giving me some odd results.

Take a look at the MBR output produced from my code.

Code:
0x0000	0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00 0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00
0x0010	0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00 0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00
0x0020	0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00 0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00
0x0030	0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00 0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00
0x0040	0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00 0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00
0x0050	0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00 0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00
0x0060	0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00 0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00
0x0070	0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00 0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00
0x0080	0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00 0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00
0x0090	0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00 0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00
0x00A0	0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00 0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00
0x00B0	0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00 0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00
0x00C0	0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00 0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00
0x00D0	0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00 0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00
0x00E0	0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00 0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00
0x00F0	0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00 0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00
0x0100	0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00 0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00
0x0110	0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00 0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00
0x0120	0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00 0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00
0x0130	0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00 0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00
0x0140	0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00 0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00
0x0150	0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00 0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00
0x0160	0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00 0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00
0x0170	0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00 0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00
0x0180	0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00 0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00
0x0190	0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00 0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00
0x01A0	0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00 0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00
0x01B0	0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00 0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x03
0x01C0	0x3F 0x04 0x06 0x03 0xC3 0xE6 0xF3 0x00 0x0F 0x04 0x0D 0xB3 0x1e 0x00 0x00 0x00
0x01D0	0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00 0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00
0x01E0	0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00 0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00
0x01F0	0x0F 0x04 0x00 0x00 0x00 0x00 0x00 0x00 0x0F 0x04 0x00 0x00 0x00 0x00 0x55 0xAA

It looks "like" an MBR as it has the 0x55AA at the end of the block and also bytes 0x1C0-0x1CC look like valid data for the first partition.

The strangeness is where all these 0x0f and 0x04's come from. I wouldnt mind so much apart from the fact that it takes the 0x0F04 and OR's it with the actual data on the sector.


Does anyone know why this happens?

Many thanks

Mark
 
It looks "like" an MBR as it has the 0x55AA at the end of the block and also bytes 0x1C0-0x1CC look like valid data for the first partition.
Yes it does look ok. Partition table looks ok too.

The strangeness is where all these 0x0f and 0x04's come from. I wouldnt mind so much apart from the fact that it takes the 0x0F04 and OR's it with the actual data on the sector.

Does anyone know why this happens?
I know that all kinds of random crap ends up in there. In the old days there used to be bootstrap code in there, but now that it's not used anymore it probably never got written and you get whatever random thing is in the flash when it came out of the factory. Could be part of an automated write/read test they do or something? No idea. Anyway, it doesn't hurt a thing, since that part of the MBR is no longer used.
 
Anyway, it doesn't hurt a thing, since that part of the MBR is no longer used.

I wish that was true, I have found the boot sector and the output from my code throws this up.

Code:
0xEF 0x04 0x90 0x4D 0x53 0x44 0x4F 0x53 0x3F 0x04 0x30 0x00 0x02 0x20 0x04 0x00
0x0F 0x04 0x02 0x00 0x00 0xF8 0xF6 0x00 0x3F 0x04 0x20 0x00 0xF3 0x00 0x00 0x00
0x0F 0x04 0x1E 0x00 0x80 0x00 0x29 0x92 0xAF 0x04 0x9E 0x4E 0x4F 0x20 0x4E 0x41
0x4F 0x04 0x20 0x20 0x20 0x20 0x46 0x41 0x5F 0x04 0x36 0x20 0x20 0x20 0x33 0xC9
0x8F 0x04 0xBC 0xF0 0x7B 0x8E 0xD9 0xB8 0x0F 0x04 0x8E 0xC0 0xFC 0xBD 0x00 0x7C
0x3F 0x04 0x24 0x7D 0x24 0x8B 0xC1 0x99 0xEF 0x04 0x01 0x72 0x1C 0x83 0xEB 0x3A
0x6F 0x04 0x1C 0x7C 0x26 0x66 0x3B 0x07 0x2F 0x04 0x57 0xFC 0x75 0x06 0x80 0xCA
0x0F 0x04 0x56 0x02 0x80 0xC3 0x10 0x73 0xEF 0x04 0xC9 0x8A 0x46 0x10 0x98 0xF7
0x6F 0x04 0x03 0x46 0x1C 0x13 0x56 0x1E 0x0F 0x04 0x0E 0x13 0xD1 0x8B 0x76 0x11
0x6F 0x04 0x46 0xFC 0x89 0x56 0xFE 0xB8 0x2F 0x04 0xF7 0xE6 0x8B 0x5E 0x0B 0x03
0xCF 0x04 0xF7 0xF3 0x01 0x46 0xFC 0x11 0x4F 0x04 0x61 0xBF 0x00 0x00 0xE8 0xE6
0x0F 0x04 0x39 0x26 0x38 0x2D 0x74 0x17 0x6F 0x04 0x0B 0xBE 0xA1 0x7D 0xF3 0xA6
0x6F 0x04 0x32 0x4E 0x74 0x09 0x83 0xC7 0x2F 0x04 0xFB 0x72 0xE6 0xEB 0xDC 0xA0
0xFF 0x04 0xB4 0x7D 0x8B 0xF0 0xAC 0x98 0x4F 0x04 0x0C 0x48 0x74 0x13 0xB4 0x0E
0xBF 0x04 0x00 0xCD 0x10 0xEB 0xEF 0xA0 0xFF 0x04 0xEB 0xE6 0xA0 0xFC 0x7D 0xEB
0xEF 0x04 0x16 0xCD 0x19 0x26 0x8B 0x55 0x1F 0x04 0xB0 0x01 0xBB 0x00 0x00 0xE8
0x3F 0x04 0x72 0xE8 0x5B 0x8A 0x56 0x24 0xBF 0x04 0x7C 0x8B 0xFC 0xC7 0x46 0xF0
0x3F 0x04 0xC7 0x46 0xF4 0x29 0x7D 0x8C 0xDF 0x04 0x4E 0xF2 0x89 0x4E 0xF6 0xC6
0x0F 0x04 0x7D 0xCB 0xEA 0x03 0x00 0x00 0x2F 0x04 0xB6 0xC8 0x66 0x8B 0x46 0xF8
0x6F 0x04 0x46 0x1C 0x66 0x8B 0xD0 0x66 0xCF 0x04 0x10 0xEB 0x5E 0x0F 0xB6 0xC8
0x4F 0x04 0x8A 0x46 0x0D 0x32 0xE4 0xF7 0xEF 0x04 0x46 0xFC 0x13 0x56 0xFE 0xEB
0x4F 0x04 0x50 0x06 0x53 0x6A 0x01 0x6A 0x1F 0x04 0x8B 0x46 0x18 0x96 0x92 0x33
0xDF 0x04 0xF6 0x91 0xF7 0xF6 0x42 0x87 0xCF 0x04 0x76 0x1A 0x8A 0xF2 0x8A 0xE8
0xCF 0x04 0x02 0x0A 0xCC 0xB8 0x01 0x02 0x8F 0x04 0x02 0x0E 0x75 0x04 0xB4 0x42
0x8F 0x04 0x8A 0x56 0x24 0xCD 0x13 0x61 0x6F 0x04 0x0B 0x40 0x75 0x01 0x42 0x03
0x5F 0x04 0x49 0x75 0x06 0xF8 0xC3 0x41 0xBF 0x04 0x00 0x60 0x66 0x6A 0x00 0xEB
0xBF 0x04 0x4F 0x4F 0x54 0x4D 0x47 0x52 0x2F 0x04 0x20 0x20 0x0D 0x0A 0x52 0x65
0x6F 0x04 0x76 0x65 0x20 0x64 0x69 0x73 0x6F 0x04 0x20 0x6F 0x72 0x20 0x6F 0x74
0x6F 0x04 0x72 0x20 0x6D 0x65 0x64 0x69 0x6F 0x04 0xFF 0x0D 0x0A 0x44 0x69 0x73
0x6F 0x04 0x65 0x72 0x72 0x6F 0x72 0xFF 0x0F 0x04 0x50 0x72 0x65 0x73 0x73 0x20
0x6F 0x04 0x79 0x20 0x6B 0x65 0x79 0x20 0x7F 0x04 0x20 0x72 0x65 0x73 0x74 0x61
0x7F 0x04 0x0D 0x0A 0x00 0x00 0x00 0x00 0x0F 0x04 0x00 0xAC 0xCB 0xD8 0x55 0xAA

Every 1st and 2nd byte of an 8 byte group has a 0x0F and 0x04 through it.
Looking at the boot sector from WinHex (I'm getting better at using this) doesn't reveal any of these.

Bizarre! any suggestions would be welcome.

Regards

Mark
 

Attachments

  • bootsector.jpg
    bootsector.jpg
    178.8 KB · Views: 142
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top