SDC on F0.

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: SDC on F0.

Post by Giovanni »

There is something wrong with SPI configuration, clocks or pins.

Giovanni
rew
Posts: 383
Joined: Sat Jul 19, 2014 12:59 pm
Has thanked: 2 times
Been thanked: 14 times

Re: SDC on F0.

Post by rew »

Update: SPI2 is not present in the device.....
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: SDC on F0.

Post by Giovanni »

That is a good reason... you should have got a compilation error, is the registry file correct?

Giovanni
rew
Posts: 383
Joined: Sat Jul 19, 2014 12:59 pm
Has thanked: 2 times
Been thanked: 14 times

Re: SDC on F0.

Post by rew »

The compilation was thinking it was an "MD" device, while I have LD.

So using the physical 103 that I have is "out".
So now I moved to "porting" the SDC based demo to MMC_SPI and from 103 to 072. Current situation: It crashes on:

Code: Select all

259       RCC->CR |= RCC_CR_HSION;                  /* Make sure HSI is ON.         */
(gdb) step
Breakpoint 1, _unhandled_exception () at ../../../os/common/startup/ARMCMx/compilers/GCC/vectors.c:46

(in stm32_clock_init).

I'm now running on an STM32F072RB, just like on the nucleo64-072. So I copied over those board files....
rew
Posts: 383
Joined: Sat Jul 19, 2014 12:59 pm
Has thanked: 2 times
Been thanked: 14 times

Re: SDC on F0.

Post by rew »

OK. I've now gotten it to run into "main.c". I've apparently hacked something "wrong", as MMCD1 is not initialized as it should have been.

It seems SDCD1 is defined "elsewhere" and initialized properly, but MMCD1 does not work the same... Suggestions?
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: SDC on F0.

Post by Giovanni »

Make sure that all configuration files and makefile come from a demo for F0, you could have mixed some of them with F1 files.

Said that, the driver has never been tested on F0 because lack of HW, there could be a problem somewhere.

Giovanni
rew
Posts: 383
Joined: Sat Jul 19, 2014 12:59 pm
Has thanked: 2 times
Been thanked: 14 times

Re: SDC on F0.

Post by rew »

I removed the USB-serial code and went back to hardware serial.

Code: Select all

ChibiOS/RT hell
ch> this isa test.

It still crashes with an unhandled exception:

Code: Select all

Breakpoint 5, _unhandled_exception () at ../../../os/common/startup/ARMCMx/compilers/GCC/vectors.c:46
46      void _unhandled_exception(void) {
(gdb) where
#0  _unhandled_exception () at ../../../os/common/startup/ARMCMx/compilers/GCC/vectors.c:46
#1  <signal handler called>
#2  0x55555554 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb)
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: SDC on F0.

Post by Giovanni »

It is possible you are hitting a stack overflow somewhere. Are debug options enabled in chconf.h?

Giovanni
rew
Posts: 383
Joined: Sat Jul 19, 2014 12:59 pm
Has thanked: 2 times
Been thanked: 14 times

Re: SDC on F0.

Post by rew »

Many DEBUG options were OFF. Working on it to get them enabled.

Here is a patch that adds a few lines to some readme's that would have saved me some time....
http://prive.bitwizard.nl/readme.fixes.patch

(when it doesn't compile I look for instructions in "COMPILING" and if that is absent, a readme.... In this case we have a readme, and it even has a "compiling" section. )
rew
Posts: 383
Joined: Sat Jul 19, 2014 12:59 pm
Has thanked: 2 times
Been thanked: 14 times

Re: SDC on F0.

Post by rew »

OK. I started from scratch.

I took the F0 CDC demo, then copied the parts I though relevant from the fatfs demo on 103 into my source.

I'm seeing about 125 clocks with CS high, then 136 clocks (17 bytes) with CS low, followed by a single byte (8 clocks) every 1ms.

MOSI goes high before the first clock. MISO does not show any activity.

All this activity happens about 10 seconds after starting the CPU. I think that's because I increased the polling interval and delay to 100. (I thought the timer was starving the USB process at one point in time..)

Is this expected? (Feel free to assume that my SD card is dead or wrongly connected... )
Post Reply