:)
First excuse my bad english. I hope you will understand my writing.
My aim is to build a high precission (24 bit) datalogger for a student project, which stores the data to SD-Card. I use the Arduino Due (ATSAM3X8E) and additional a selfmade shield with a SD-Card Connector.
Further I use Atmel Studio 6.2 and the ASF libraries "SD/MMC stack on SPI interface" and "FatFS file system".
It is allready possible to just write and read with the sd/mmc module by spi but without file system. So the hardware works correctly.
I suppose that my fault can be localized in the FatFS module.
In main.c I call the following functions:
sd_mmc_init();
sd_mmc_check(SD_SLOT); //until this the program works and I can read and write valid values with the terminal window
f_mount(LUN_ID_SD_MMC_0_MEM, &fs);
//it returns FR_OK but nevertheless may here is the first little fault, cause I'm not sure wether I have chosen the correct LUN.
- f_open(&file_object,(char const *)test_file_name, FA_CREATE_ALWAYS | FA_WRITE);
// here appears the error FR_DISK_ERR // when I follow the error to lower level I come to the functions: - chk_mounted(&path, &dj.fs, (BYTE)(mode & ~FA_READ)); - fmt = check_fs(fs, bsect = 0); - and then in the lowest level my disk_read function which is part of diskio.c (attached)
later it has to follow the functions f_puts and f_close(&file_object); but without f_open, they cannot work.
I have attached my diskio.c file where the disk_read file is allocated which causes the error.
I really hope someone can help me. Thank you for all answers and hints!!!