in the main.cpp file:
Code: Select all
void UserMain(void *pd) {
OSChangePrio(MAIN_PRIO);
f_enterFS();
InitExtFlash();
f_releaseFS();
StartDHCPServer();
while (1) {
OSTimeDly(TICKS_PER_SECOND);
}
}
Code: Select all
void WaitForDHCPPackets(void * pd) {
f_enterFS();
DisplayEffsSpaceStats(); //This works
char* FileName = "testfile.txt";
ReadWriteTest(FileName); //This throws an error.
<... more code here ...>
}
void StartDHCPServer() {
#define DHCPSERVER_PRIO (MAIN_PRIO - 5)
OSTaskCreate(WaitForDHCPPackets, (void *)67, &DHCPServerUDPStk[USER_TASK_STK_SIZE], DHCPServerUDPStk, DHCPSERVER_PRIO);
}
*** Error in f_open(testfile.txt) during task(45)
F_ERR_INVALIDNAME
I have found that if I move the "InitExtFlash();" command from the main.cpp file into my other .cpp file right after "f_enterFS();", then the ReadWriteTest completes fine. However, this doesn't seem like a good solution to initialize the flash in one task if I'm going to have multiple tasks accessing the flash. If InitExtFlash() is supposed to be called from the main task, how would I get the readwrite test to work in another task?
Thanks,
Lance