core-common-lib icon indicating copy to clipboard operation
core-common-lib copied to clipboard

Feature/sdcard fatfs support

Open satishgn opened this issue 10 years ago • 5 comments

With this FatFs module's application interface functions(http://elm-chan.org/fsw/ff/00index_e.html) can be used to mount the sdcard, perform file read/write operations etc. An Arduino wrapper for sdcard based on this feature would be provided in core-firmware repo.

satishgn avatar Apr 21 '14 13:04 satishgn

Satish, I have not been able to get the SD stuff working. Maybe its me but I created an "application.cpp" that is based on the speed benchmark example I have. The plan is to use SD_Init() to connect to the SD, then SD_GetCardInfo() and print the info then run the test using f_open(), f_write(), f_read() and f_sync(). To compile application.cpp, I include sdcard_spi.h and ff.h. However, I had to add the path to ff.h in the core-firmware makefile. Though it finds the files, the compiler flags a re-declaration conflict of "INT" in integer.h (FatFs_Module) and spark_wiring.h. I cannot proceed.

pkourany avatar Apr 27 '14 02:04 pkourany

Sorry @pkourany , I could not get the Arduino wrapper for this feature added in the core-firmware repo as planned. The error you are getting is because of the "INT" enum value in spark_utilities required for COAP use. Probably we need to rename this enum to some other and associated code changes. I thought of completing the development and end-to-end testing after coming back from vacation(after 9th May). In the mean while you will have to rename this INT and continue with testing.

satishgn avatar Apr 27 '14 03:04 satishgn

Satish, I got everything to compile and load on a core. However, the could would not past SD.init() and I no time to dig in because of the upcoming Faire.

pkourany avatar Apr 30 '14 21:04 pkourany

IMHO this shouldn't be part of the core firmware, but provided as a library. The core firmware is already pretty big! :)

When the spark libraries support dependencies, it would be good to provide fatfs as one library, and then the low level storage engines as separate libraries, and combining these give the complete stack. This will allow the same FAT code to be reused with different storage engines, to store to different types of media, e.g. SD card, FRAM shields (when ready), external flash (flashee library).

m-mcgowan avatar Jun 23 '14 14:06 m-mcgowan

Thanks @m-mcgowan, totally agreed. This one is on hold until there's more testing and verification done, and it should definitely not increase binary size or RAM usage unless intentionally included by the user.

towynlin avatar Jun 23 '14 19:06 towynlin