Page 1 of 3

SDC on F0.

Posted: Sun May 08, 2016 2:20 pm
by rew
Hi,
I'm trying to interface with an SD card so I tried compiling the SDC example for F4 and that worked, THen I copied "HAL_USE_SDC TRUE" over to my halconf.h for my F0 project, and got a "hal_sdc_lld.h not found" or something like that.

Since I was using a version that's a few months old. I decided to upgrade. On the upgraded version, the SDC example no longer compiles:

Code: Select all

arm-none-eabi-gcc -E -mcpu=cortex-m4 -O2 -ggdb -fomit-frame-pointer -falign-functions=16 -ffunction-sections -fdata-sections -fno-common -flto -fno-rtti -Wall -Wextra -Wundef -Wa,-alms=build/lst/crt0_v7m.S -DCORTEX_USE_FPU=FALSE -DSHELL_CMD_TEST_ENABLED=0 -DTHUMB_PRESENT -mno-thumb-interwork -DTHUMB_NO_INTERWORKING -MD -MP -MF .dep/crt0_v7m.s.d ../../../../os/common/startup/ARMCMx/compilers/GCC/crt0_v7m.S > ../../../../os/common/startup/ARMCMx/compilers/GCC/crt0_v7m.s
../../../../os/common/startup/ARMCMx/compilers/GCC/crt0_v7m.S:1:0: error: target CPU does not support ARM mode
And I agree with the compiler: Target CPU does not support ARM mode.....

Update: I don't need SDC< but SD_MMC or whatever it's called.... Now working with the released chibios. Seems no SD-MMC example exists.... :-(

Re: SDC on F0.

Posted: Sun May 08, 2016 3:17 pm
by Giovanni
Hi,

True, there is no demo for MMC_SPI, I really missed that... You can download version 2.6 and see the demo ARMCM3-STM32F103-FATFS, the usage is the same in latest version.

Giovanni

Re: SDC on F0.

Posted: Mon May 16, 2016 1:49 pm
by rew
Any ideas on how to compile that demo? It can't find diskio.h ....

Re: SDC on F0.

Posted: Mon May 16, 2016 2:25 pm
by RoccoMarco
As I can see, there is a demo on trunk named RT-STM32F103-STM3210E_EVAL-FATFS-USB, which use SDMMC.
It compiles to me.
Ciao,
RM

Re: SDC on F0.

Posted: Mon May 16, 2016 3:14 pm
by rew
in an attempt to have as little variables as possible, I've gotten out my '103 board. Once I get it to compile I'll try to test on that.

I've tried two out of three RT-STM32F103-STM3210E_EVAL-FATFS-USB demos on my harddrive and neither compiles.

I have upgraded to the current version using the git mirror. My chibios repository does not contain a "diskio.h" file.

Update: I downloaded 16.1.4, same demo, same missing diskio. I switched to branch "trunk" (from master, and identical to master), and... no go.
Update2: Aw F****. The fatfs sources need to be unpacked.

Re: SDC on F0.

Posted: Mon May 16, 2016 3:16 pm
by RoccoMarco
Note that external resources like fatfs and lwip are usually provided as compressed archive. Most likely you have to extract "fatfs-0.10b-patched.7z" which is into the folder "chibios_trunk\ext\".

Re: SDC on F0.

Posted: Mon May 16, 2016 3:28 pm
by rew
Ah... That demo uses the SDIO module, not SD/MMC over SPI. And my 'F103 does not have SDIO.

Update: Got the 2.6.1 demo to compile..... Now checking the pinout of the demo compared to my board.
Update: The demo compiles to about 48k, my chip has 32k. :-(

Re: SDC on F0.

Posted: Mon May 16, 2016 3:34 pm
by RoccoMarco
Update: Got the 2.6.1 demo to compile..... Now checking the pinout of the demo compared to my board.

Indeed the problem was related to a lack of fatfs files.

Re: SDC on F0.

Posted: Mon May 16, 2016 3:54 pm
by Giovanni
Remove the test suite files, the demo size will shrink a lot. If it still not enough then we can do fine tuning.

Giovanni

Re: SDC on F0.

Posted: Mon May 16, 2016 4:36 pm
by rew
Yeah. That works. :-)

Code: Select all

ch> if
Kernel:       2.6.1
Compiler:     GCC 4.9.3 20150529 (prerelease)
Architecture: ARMv7-M
Core Variant: Cortex-M3
Port Info:    Advanced kernel mode
Platform:     STM32F10x Performance Line Medium Density
Board:        Olimex STM32-P103
Build time:   May 16 2016 - 17:02:59
ch> te
File Systm not mounted
ch>
... Although the characters from the F103 to the USB-serial module seem to be a bit flaky..... Anyway, not important now. Now I'm going to hook up the SD card.

Update: "not mounted" remains. I'm hooking it up to "SPI2" just like the original demo.

Update2: Logic analyser indicates: No activity whatsoever on the SPI2 pins. I have now added commands for "inserted" and "removed" but still not one attempt to contact the SD card.

Update3: SPI2 clock seems to be not running. All registers look to be zero.