Now that I have my Nucleo board wired up for SD Card access, I want to use the FATFS library to access the SD card.
http://stm32f4-discovery.com/2014/07/library-21-read-sd-card-fatfs-stm32f4xx-devices/ contains a library which acts as a wrapper for FATFS for the STM32F4XX chips. It looks like it is well documented and used by quite a few people. My goal will be to get this working on my board using 4-wire SDIO.
First, I am creating a new project in Eclipse called ‘sd_test’. I also have to create a new openocd debugger profile for the new project (just duplicate the old one and change the project). I created a blank c++ project for the stm32f401. It compiles and debugs properly.
The following dependancies are listed:
- STM32F4xx RCC
- STM32F4xx GPIO
- STM32F4xx SPI (only when SPI)
- STM32F4xx DMA (only when SDIO)
- STM32F4xx SDIO (only when SDIO)
- MISC (only when SDIO)
- TM GPIO
I downloaded the “TM” dependancies and added them to the project. I also included his attached FatFS directory.
Before moving forward I am going to follow part 3 of the carminenoviello NucleoTutorial because I think the extra debugging messages might be helpful: http://www.carminenoviello.com/en/2015/01/16/setting-gcceclipse-toolchain-stm32nucleo-part-iii/
Now I am following an example to setup CMSIS: http://mcuoneclipse.com/2013/02/14/tutorial-using-the-arm-cmsis-library/
I have the STMCube32 firmware version 1.6 installed at: \bead2\NucleoSoftware\STM32Cube_FW_F4_V1.6.0 so this is where I will point CMSIS_LOC to.
After setting this up, I am still unable to find the file: stm32f4xx_rcc.h. After some googling, it appears I am missing the Standard Peripheral Library from ST. I am downloading from here:
Interestingly, these libraries seem like they will eventually become obsolete and replaced by the HAL (STM32Cube) libraries from ST. People don’t seem too happy with the code from STM32CubeMX so far, and the author of the SD card library I am using has said he will not port over to HAL. That said, with time ST will probably work out the bugs and will only support their HAL libraries. I may need to port things over myself in the future.
As I look into this more, it appears I will have to do quite a bit of work to get the library provided to work. I am concerned that using the SPL is too outdated and I should work to get FATFS working. As an example of the complication — I removed all references to HAL from my build definitions and now I will need to rewrite all of the code to setup the oscillator.
I think I would rather make this effort to rewrite the FATFs code and make it compatible with modern STM reference code.
I need to look into it more.
For now, I have made way too many changes to the project to trust anything about it — I am going to delete “sd_test” and re-create it. Confirmed trace output is working.
Done for today.