Cannot get SD Card to work in user created Task
Re: Cannot get SD Card to work in user created Task
I will work on getting you an example that works, hang on.
Re: Cannot get SD Card to work in user created Task
Couple of things here. First off if you're trying to simply add a task to the http-effs example and it's failing, this seems odd.
Note for Tod and seulater, you are incorrect in your assumptions. It is perfectly valid to use the following code to set up the filesystem in a new task
This is exactly how all the multitasking EFFS examples set it up. I've seen what is going on down in the bowels of the filesystem that uses the task registration magic (btw, filesystems are complicated...), and when you register a task the only thing the filesystem cares about is the task priority number.
Lachlanp, it would help to see your UserMain function in its entirety here. Somehow it feels as if you haven't initialized the SD card before making this call in your other task.
-Dan
Note for Tod and seulater, you are incorrect in your assumptions. It is perfectly valid to use the following code to set up the filesystem in a new task
Code: Select all
OSChangePrio( TASK_PRIO );
f_enterFS();
Lachlanp, it would help to see your UserMain function in its entirety here. Somehow it feels as if you haven't initialized the SD card before making this call in your other task.
-Dan
Dan Ciliske
Project Engineer
Netburner, Inc
Project Engineer
Netburner, Inc
Re: Cannot get SD Card to work in user created Task
First note, i am wondering if you are using "f_chdrive( MMC_DRV_NUM );" in your uCFG task.
Try that first and see if that helps.
I took the same EFFS-HTTP example and added another task called Task_1.
Here is what that looks like
Then in user main just before it calls " DisplayMenu();" i placed:
Now when the program runs, Main displays the drive files, and just before it calls DisplayMenu it allows Task_1 to run, and also show the files.
NOTE: that if you do not use "f_chdrive( MMC_DRV_NUM );" in the new task it will not show the files which is why i am wondering if you have that in there, and this is causing the trouble for you.
Try that first and see if that helps.
I took the same EFFS-HTTP example and added another task called Task_1.
Here is what that looks like
Code: Select all
//*********************************************************************
//**************************** TASK 1 *******************************
//*********************************************************************
void Task_1( void *pd )
{
/* The following call to f_enterFS() must be called in every task that accesses
the file system. This must only be called once in each task and must be done before
any other file system functions are used. Up to 10 tasks can be assigned to use
the file system. Any task may also be removed from accessing the file system with a
call to the function f_releaseFS(). */
f_enterFS();
while(1)
{
// Wait here until we are called, this ensures that all other f_enterFS() have been called first
// We dont want to access the file system until everything else has been initialized.
OSSemPend(&PTask1_Wait,0);
f_chdrive( MMC_DRV_NUM );
iprintf("\r\n****************************************************\r\n");
iprintf("Task 1, Showing SD Card Info\r\n");
DisplayEffsSpaceStats(); // Display file space usage
DumpDir(); // Display flash card files and directories
iprintf("****************************************************\r\n");
OSTimeDly( TICKS_PER_SECOND );
}
}
Then in user main just before it calls " DisplayMenu();" i placed:
Code: Select all
// Allow PTask1_Wait to run once
OSSemPost(&PTask1_Wait);
NOTE: that if you do not use "f_chdrive( MMC_DRV_NUM );" in the new task it will not show the files which is why i am wondering if you have that in there, and this is causing the trouble for you.
Re: Cannot get SD Card to work in user created Task
Solved.
Thank you for you support.
Regards
Lachlan
Thank you for you support.
Regards
Lachlan
Re: Cannot get SD Card to work in user created Task
What was the culprit ?
Re: Cannot get SD Card to work in user created Task
The f_chdrive. As soon as I add that, all worked.
Thanks again or your help.
Regards
Lachlan
Thanks again or your help.
Regards
Lachlan
Re: Cannot get SD Card to work in user created Task
Dan I think the mistake was all mine, I made incorrect assumptions about what seulater meant. Sorry about that, I should know better.
Re: Cannot get SD Card to work in user created Task
Tod, I wasn't trying to admonish you or anything, just trying to make sure the correct information was available as well as the explanation as to why it was correct. Keep being awesome!
Dan Ciliske
Project Engineer
Netburner, Inc
Project Engineer
Netburner, Inc
Re: Cannot get SD Card to work in user created Task
Just to clarify, you can do it either way. You can call f_enterFS() in the main task, or you can call it in the thread itself.
Without having enough of the original code to go on it was not clear to me where he was calling it, i figured the best way under the circumstances was to have him call it in the thread itself.
Without having enough of the original code to go on it was not clear to me where he was calling it, i figured the best way under the circumstances was to have him call it in the thread itself.
Re: Cannot get SD Card to work in user created Task
Not to mention that doing it in the task itself avoids the potential problem of OSChangePrio returning error 40, indicating that the task priority is already in use.