Page 2 of 2
Re: Chibios and FATFS SDHC support
Posted: Tue Aug 26, 2014 2:31 pm
by Giovanni
See my second point, I think that is the problem.
The code looks OK but without trying it I cannot be sure. I wish to was able to tell if some code is OK by just looking at it

Giovanni
Re: Chibios and FATFS SDHC support
Posted: Sat Sep 06, 2014 10:20 am
by fastlink30
Tectu wrote:Jeroen3 wrote:I''m at 4e11d82, "Fixed bug #514". (git)
As far as I know that repo state even uses the 'old' FatFS library. The new one is 0.10b.
Personally don't have issues to use SDHC cards. I didn't have issues with them in the past and with the latest master.
~ Tectu
I tried to use the 0.10b (ffrom original site) , but receive some errors during compilation, need 'patched' version? where i found?
or i must do ssomething (not only overwrite the old llibrary)?
Compiling fatfs_diskio.c
Compiling fatfs_syscall.c
Compiling ff.c
c:/ChibiStudio/chibios/os/various/fatfs_bindings/fatfs_diskio.c:111:9: error: conflicting types for 'disk_read'
In file included from c:/ChibiStudio/chibios/os/various/fatfs_bindings/fatfs_diskio.c:11:0:
c:/ChibiStudio/chibios/ext/fatfs/src/diskio.h:37:9: note: previous declaration of 'disk_read' was here
c:/ChibiStudio/chibios/os/various/fatfs_bindings/fatfs_diskio.c:152:9: error: conflicting types for 'disk_write'
In file included from c:/ChibiStudio/chibios/os/various/fatfs_bindings/fatfs_diskio.c:11:0:
c:/ChibiStudio/chibios/ext/fatfs/src/diskio.h:38:9: note: previous declaration of 'disk_write' was here
make: *** [build/obj/fatfs_diskio.o] Error 1
make: *** Waiting for unfinished jobs....
Re: Chibios and FATFS SDHC support
Posted: Sat Sep 06, 2014 11:13 am
by Giovanni
Please try using FatFS provided with ChibiOS, there could be patches.
Giovanni
Re: Chibios and FATFS SDHC support
Posted: Sat Sep 06, 2014 11:24 am
by fastlink30
with the fatfs-0.9-patched.zip (in the etc\ directory) not have problem with compilation, but thinked can use the 0.10b from the orginal site
but still have problem with mmcard, anyway today i have time to look what happen
thanks
Re: Chibios and FATFS SDHC support
Posted: Wed Sep 10, 2014 3:54 pm
by Jeroen3
I've got more card features running. And I wanted to ask if ~220 KB/s of file copy operation is reasonable?
Running with 3 open files. Copy A->B with files of 1 to 10 MB. And a continuous data logging file in the background.
Re: Chibios and FATFS SDHC support
Posted: Wed Sep 10, 2014 4:40 pm
by Giovanni
Consider that FatFS is done to be small not necessarily fast, it lacks any kind of buffering so the library continuously reads/writes FAT blocks. It is unlikely that you will reach the transfer rate of the naked SPI port.
Giovanni
Re: Chibios and FATFS SDHC support
Posted: Thu Sep 11, 2014 6:47 am
by Jeroen3
Correct, It doesn't have buffering. That would be waste of the already limited resources.
I don't need it to be ultra fast, I was just wondering if this is a reasonable speed. Seems like it is.
It also seems like the card itself is the limiting factor since the chRegistry says copying 10 MB uses 1 unit of cpu, 1 ms, of the copying thread.
Or everything is running in interrupt mode.
Re: Chibios and FATFS SDHC support
Posted: Fri Sep 12, 2014 2:34 pm
by Giovanni
Everything runs on DMA and IRQs so very little CPU time is involed.
Giovanni
Re: Chibios and FATFS SDHC support
Posted: Mon Dec 15, 2014 1:24 pm
by Jeroen3
Meanwhile, I can confirm writing and reading from an 8GB SanDisk SDHC card works*.
However, getting metadata doesn't. It won't read the filesize correctly anymore. It does with a FILINFO.
It seems after f_open, the fsize isn't being set correctly if the file is beyond 4 GB.
Re: Chibios and FATFS SDHC support
Posted: Mon Dec 15, 2014 1:32 pm
by Giovanni
That is probably a FatFS limitation.
Giovanni