STM32F4 Discovery MMC over SPI how to accelerate

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

Moderator: RoccoMarco

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

Re: STM32F4 Discovery MMC over SPI how to accelerate

Post by Giovanni »

Of course, DMA cannot write in CCM and SPI uses DMA. The main() and exceptions stacks are allocated in CCM using that script, automatic variables of the main thread are in CCM by default.

Giovanni
User avatar
russian
Posts: 368
Joined: Mon Oct 29, 2012 3:17 am
Has thanked: 16 times
Been thanked: 14 times

Re: STM32F4 Discovery MMC over SPI how to accelerate

Post by russian »

Awesome! We've nailed the root cause of the issue.

Obviously an easy fix would be not to use CCM, but I'd rather have the extra memory.

So, why does the default CCM .ld place the main() & exception stacks into the toxic CCM? Would not it be safer to make it... safer in the primary chunk of memory?

For my local fix, would it be enough for me to change

Code: Select all

.stacks :
    {
        xxx
    } > [b]ccmram[/b]


to

Code: Select all

.stacks :
    {
        xxx
    } > [b]ram[/b]

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

Re: STM32F4 Discovery MMC over SPI how to accelerate

Post by Giovanni »

Hi,

Stacks in CCM are there for performance reasons, accesses to stack are frequent and by putting them in CCM DMA won't affect them. You may try to move the process stack in normal RAM and keep exceptions stack in CCM (DMA is never used there).

Giovanni
User avatar
russian
Posts: 368
Joined: Mon Oct 29, 2012 3:17 am
Has thanked: 16 times
Been thanked: 14 times

Re: STM32F4 Discovery MMC over SPI how to accelerate

Post by russian »

I have moved the whole .stacks section and this has solved the problem. Once again, thank you very much for you help and patience :)
Kot_dnz
Posts: 10
Joined: Tue Jan 28, 2014 9:21 am

Re: STM32F4 Discovery MMC over SPI how to accelerate

Post by Kot_dnz »

Giovanni,

Thank you.
Problem resolved.
Kot_dnz
Posts: 10
Joined: Tue Jan 28, 2014 9:21 am

Re: STM32F4 Discovery MMC over SPI how to accelerate

Post by Kot_dnz »

Dear Giovanni,

On fact my troubles not cleared, but first at all question:
Are you has planed upgrade FatFs to current FatFs R0.10a with according http://elm-chan.org/fsw/ff/00index_e.html ?
I check: enough in chibios-os-various in fatfs_diskio.c in functions disk_read and disk_write instead "byte count" write "UINT count".
And in end-user programs require change arguments f_mount & type of second argument in f_opendir.

Thank you for you reply.
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: STM32F4 Discovery MMC over SPI how to accelerate

Post by Giovanni »

There is a patch already: http://sourceforge.net/p/chibios/feature-requests/31/

It will be included at some point.

Giovanni
Kot_dnz
Posts: 10
Joined: Tue Jan 28, 2014 9:21 am

Re: STM32F4 Discovery MMC over SPI how to accelerate

Post by Kot_dnz »

Actual is
Jan 15,'14 R0.10a Added arbitrary strings as drive number in the path name. (_STR_VOLUME_ID)
Added a configuration option of minimum sector size. (_MIN_SS)
2nd argument of f_rename() can have a drive number and it will be ignored.
Fixed f_mount() with forced mount fails when drive number is >= 1.
Fixed f_close() invalidates the file object without volume lock.
Fixed f_closedir() returns but the volume lock is left acquired.
Fixed creation of an entry with LFN fails on too many SFN collisions.
User avatar
russian
Posts: 368
Joined: Mon Oct 29, 2012 3:17 am
Has thanked: 16 times
Been thanked: 14 times

Re: STM32F4 Discovery MMC over SPI how to accelerate

Post by russian »

Giovanni wrote:In general I agree with not having dead loops, this means that the error should be propagated out of wait(), it should not simply return from there.


Just got into this loop once again, created a ticket https://sourceforge.net/p/chibios/bugs/530/
Post Reply