SD card + FAT32

Go To Last Post
9 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi! I need some help. I've an EVK1100. I've to make a program for reading and storing data in a simple .txt file on a SD card with FAT32 filesystem. Can anyone help me? Are there any examples? I'm a newbie and the FAT driver in the framework too complex for me...
Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well FAT *is* complicated... Did you look at the framework FAT examples?

-sma

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, but I have big difficulties to find what I have to change for using sd-mmc instead of SPI-flash...

I'm going mad!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The actual example is using the dataflash through SPI.

In conf_access.h, try to change this:
#define AT45DBX_MEM LUN_1
#define LUN_ID_AT45DBX_MEM LUN_ID_1
#define LUN_1_INCLUDE "at45dbx_mem.h"
#define Lun_1_test_unit_ready at45dbx_test_unit_ready
#define Lun_1_read_capacity at45dbx_read_capacity
#define Lun_1_wr_protect at45dbx_wr_protect
#define Lun_1_removal at45dbx_removal
#define Lun_1_usb_read_10 at45dbx_usb_read_10
#define Lun_1_usb_write_10 at45dbx_usb_write_10
#define Lun_1_mem_2_ram at45dbx_df_2_ram
#define Lun_1_ram_2_mem at45dbx_ram_2_df
#define LUN_1_NAME "\"AT45DBX Data Flash\""
//! @}

and plug here the SD driver here.
For the dataflash, all these functions are written in
\COMPONENTS\MEMORY\DATA_FLASH\AT45DBX\at45dbx_mem.c

-sma

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank's for the suggestions. before this I have to solve another problem. I'm trying to do my first FAT experiment using the dataflash FS_ACCESS framework example, but I get these strange errors:

Quote:

at45dbx.o: In function `at45dbx_read_multiple_sector':
/cygdrive/c/Documents and Settings/tesi/workspace/FAT/Debug/..\at45dbx.c:526: undefined reference to `at45dbx_read_multiple_sector_callback'
at45dbx.o: In function `at45dbx_write_multiple_sector':
/cygdrive/c/Documents and Settings/tesi/workspace/FAT/Debug/..\at45dbx.c:539: undefined reference to `at45dbx_write_multiple_sector_callback'

These two fuctions definitions aree contained in "at45dbx_mem.c"
I've not modified any file, why do I get this error?
Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Did you modify any include path? Any #include missing?

-sma

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

no, no modifications...I solved by commenting multiple sector read/write and callbacks...
It seems working.
For my project I have to do two task:
1) Load a .txt file from SD, taking some values from it
2) Do some logging, storing values from ADC to a .txt file on the SD

For task 1 I'm using "fsaccess_get_filename()" and "fsaccess_read()" from "FSACCESS_EXAMPLE" of Framework.
For the second task I'm using "nav_setcwd()" "file_open()" "file_putc()" and "file_close()" from "file.c".

Are these choices correct? Wht's the differences between the two classes of funcions (fsaccess.c vs file.c)?

Any optimization to suggest?

Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've just strayed over here from the 8 bit forums and discovered this thread.
It's basically the same thing that I'm doing however using FAT-12 ..or just FAT..and writing to flash chips rather than SD..fairly similar. I originally tried using the tiny fatfs found there -->ttp://elm-chan.org/fsw/ff/00index_e.html However, I didn't have much luck integrating it into my code.

In the end I scrapped this idea, and went to writing my own pseudo system. May work well for you as you are only using text files (as am I) as the dir table 'header' is fairly simple and the data just raw text basically. So you don't need the functionality of the entire FS.

However, FAT32 is different from lower FATS..so all might be different.

I can provide a bit of a structure of how ive done this if you like.. ( its almost working well and reliable now)

Michael

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

what i am looking for are routines that could be easily implemented into my code. I have also tried with ELF as well as with YAMMP and I did not succeed.
Myabe you guys are able to help with your codes and/or the routines you used?