SD-Card Insert/Remove Handlers

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Tabulous
Posts: 518
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 7 times
Been thanked: 18 times

Re: SD-Card Insert/Remove Handlers

Post by Tabulous »

so the panic msg is saying stack overflow, but is i said earlier if i increase the the thread static WORKING_AREA(waThread1, 128); from 128 (default value) upto 512, it then hits the _unhandled_exception
Tabulous
Posts: 518
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 7 times
Been thanked: 18 times

Re: SD-Card Insert/Remove Handlers

Post by Tabulous »

the unhandled_exception is hit when chThdSleepMilliseconds(1000); is called in the blinker thread
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: SD-Card Insert/Remove Handlers

Post by Giovanni »

By examining the stack areas you can understand which stack is overflowing, if you use ChibiStudio then the ChibiOS debug view does that for you.

Giovanni
Tabulous
Posts: 518
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 7 times
Been thanked: 18 times

Re: SD-Card Insert/Remove Handlers

Post by Tabulous »

do i need to enable this as by default the ChibiOS/RT view as nothing in it all fields and tabs are empty
Tabulous
Posts: 518
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 7 times
Been thanked: 18 times

Re: SD-Card Insert/Remove Handlers

Post by Tabulous »

right declaring the varibles the are used by the f_open locally caused the _unhandled_exception

FIL file;
UINT wbytes;
FRESULT result;
char msgstr[40];

if i then increased WORKING area to 512 all is working.

The RT view is working now, that must have been down to the stack issues.
Tabulous
Posts: 518
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 7 times
Been thanked: 18 times

Re: SD-Card Insert/Remove Handlers

Post by Tabulous »

Now have a working USB-CDC and SD-Card Demo for STM3241G-EVAL board.

Giovanni - if you would like this demo for your repository let me know and i'll send it to you :-)

Thanks for teh help
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: SD-Card Insert/Remove Handlers

Post by Giovanni »

Hi,

If you could post a ready-to-go zip file in the contributions forum it would be great.

About the ChibiOS view, you need to hit the refresh button in the toolbar.

Giovanni
Jeroen3
Posts: 35
Joined: Wed Apr 02, 2014 10:14 am

Re: SD-Card Insert/Remove Handlers

Post by Jeroen3 »

Returning from

Code: Select all

DWORD create_chain(FATFS* fs,   DWORD clst )

At the B instruction, seem to throw an hardfault in ff.c from fatfs R0.10b.

This gets called from f_stat, all other fatfs functionality seems ok.
Jeroen3
Posts: 35
Joined: Wed Apr 02, 2014 10:14 am

Re: SD-Card Insert/Remove Handlers

Post by Jeroen3 »

This is because a FILINFO structure is assumed to be "empty" when filled with 0. When filled with standard stackfill of 0x55 it will crash.
It was in reaction to mukululul a few pages back, not very on topic anymore.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: SD-Card Insert/Remove Handlers

Post by Giovanni »

Good to know anyway :)

Giovanni
Post Reply