Discussion in "8051 Discussion Forum" started by    Help    Dec 8, 2008.
Sun Jan 04 2009, 12:37 am
#41
Its better to follow PIC code coz its much easy to transfer it.
Now the thing is, you need not to modify the whole code, all you need to do is edit the diskio file and replace the basic functions like

xmit_spi(dat) --> transmit single byte
rcvr_spi() --> receive single byte
rcvr_spi_m(p) --> receive byte and store it in variable pointer p

so you need not to worry whats been going on in program. because all functions depends on these three simple functions
Sun Jan 04 2009, 10:17 am
#42
Dear Fren,

I'm doing the editing coding part. Currently the compiler showing 2 warning C265 message.

warning C265: '_scan_files': recursive call to non-reentrant function
static
FRESULT scan_files (char* path)
{
	DIR dirs;
	FRESULT res;
	BYTE i;

	if ((res = f_opendir(&dirs, path)) == FR_OK) {
		i = strlen(path);
		while (((res = f_readdir(&dirs, &finfo)) == FR_OK) && finfo.fname[0]) {
			if (finfo.fattrib & AM_DIR) {
				acc_dirs++;
				*(path+i) = '/'; strcpy(path+i+1, &finfo.fname[0]);
				res = scan_files(path); <--------- WARNING C265				*(path+i) = '\0';
				if (res != FR_OK) break;
			} else {
				acc_files++;
				acc_size += finfo.fsize;
			}
		}
	}
	if (res) put_rc(res);
		return res;
} 


warning C265: '_scan_cmd': recursive call to non-reentrant function
static
BYTE send_cmd (
	BYTE cmd,		/* Command byte */
	DWORD arg		/* Argument */
)
{
	BYTE n, res;


	if (cmd & 0x80) {	/* ACMD<n>
 is the command sequense of CMD55-CMD<n>
 */
		cmd &= 0x7F;
		res = send_cmd(CMD55, 0); <--------- WARNING C265
		if (res >
 1) return res;
	}
....
...
..


Another error message is error C202: 'PORTB': undefined identifier.

#define SOCKPORT PORTB /* Socket contact port */

What does PORTB mean? May i know how to edit?

Thank you.
Mon Jan 05 2009, 02:02 am
#43
hmm this is going to be hard not easy as i thought
hmm how bout extracting the FAT basic and implementing it on our own? I mean we really don't need fread fopen right now.. rather implementing fat is more important.

There are reference links on chan's page. this is not going to be easy.. but its doesnt mean its impossible
Mon Jan 05 2009, 10:44 pm
#44
Dear Fren,

Look like don't where to start now Please can you guide me? How to extract the basic FAT?

Thank you.
Tue Jan 06 2009, 08:30 pm
#45
hmm.. let try this way.. we will read MBR of MMC and display it..

we will try to analyze the block (you can paste it here.. after reading)

FAT16:
http://home.teleport.com/~brainy/fat16.htm

FAT32:
http://www.pjrc.com/tech/8051/ide/fat32.html
official: http://www.microsoft.com/whdc/system/platform/firmware/fatgen.mspx
Mon Jan 12 2009, 01:12 pm
#46
Dear fren,

Thank for your information. I have read the information and try fat32_08-04-07 sample code last week. Now getting more blur and no direction already...

How to apply the sample code for 8051?

Thank you.
Tue Jan 13 2009, 03:24 am
#47
i told you to read MBR (sector 0) of MMC, copy the data o/p in txt file and upload here.. we will analyze it and break the data packet according to MBR structure. just read sector 0. You will understand by yourself
Tue Jan 13 2009, 09:30 am
#48
Dear Fren,

i told you to read MBR (sector 0) of MMC


May i know how to read the MBR of MMC? Is it we have to use WriteSector function to write some data in MMC and then read the sector 0 data back and check whether the data have according Figure1: MBR(fisrt sector) layout format, am i rite?
The last 2 byte of sector 0 must be 55 and AA.



copy the data o/p in txt file...


I have do the testing after format the SD card and write some data in SD using Hyperterminal. When dump the sector 0 last 2 byte 511 and 512 the data was not 55 and AA.

Do i do it correct way?

Thank you.
Wed Jan 14 2009, 03:31 am
#49
you should never write in MBR, its created automatically when you format your card. I checked MBR of my MMC, i got perfect reading.

try downloading HxD hex viewer and open your MMC in it. see MBR (sector 0). open in read only format. then try to analyse it there. you can also compare your data on termial and actual one.
Thu Jan 15 2009, 07:43 am
#50
Dear fren,

Ya, i able to read the MBR (sector 0) on SD. The result is attached in Excel sheet (Sheet1: after format, Sheet2: Text file in SD).

I have analyse the SD card after format. I realize there are few data alway in SD card. ex:..
SD card formated.
Sector 1 Offset 200h = F8 FF FF FF 00 00...
Sector 62 Offset 7C00h = F8 FF FF FF 00 00...
Sector 155 Offset 13600h = FF FF FF FF FF FF....

What's the data in Sector 1 and Sector 62? and The card is formated, why start from Sector 155 the data is FF?

SD card with Text file.
Sector 1 Offset 200h = F8 FF FF FF FF FF 00 00...
Sector 62 Offset 7C00h = F8 FF FF FF FF FF 00 00...
Sector 156 Offset 13800h = FF FF FF FF FF FF....

After a HELLO.txt file is paste in SD card the Sector 1 and 62 is add another 2 FF data. What does the FF mean? Is it important?

I think from Sector 123 Offset F600h to F6C0h is the .txt data and start from Sector 155 offset 13600 is content of .txt file.

May i know why the Text data is store in Sector 123? Why not start at Sector 1?
Attachment

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

Gordonfax
Fri May 17 2024, 10:28 am
Davidspils
Fri May 17 2024, 10:19 am
Patricknoind
Fri May 17 2024, 09:53 am
JeremyCycle
Fri May 17 2024, 09:46 am
FrabSeby
Thu May 16 2024, 07:31 pm
PeterGem
Thu May 16 2024, 06:27 am
Timothywalay
Thu May 16 2024, 04:40 am
Timothypet
Wed May 15 2024, 06:14 pm