I am using fle system middleware component to store some data in the RAM of LPC1768.But whenever the function fmount() is called after calling finit() function, it returns an error code of fsNoFileSystem. What could be causing this issue ?
I am sorry to poke you again but I have been encountered with one more issue.My code looks like this :-
#include "lpc17xx.h" #include "rl_fs.h" #include <stdio.h> char *opt ="NULL"; fsStatus stat; char *fname="r.txt"; FILE *f; void init_filesystem (void) { LPC_PINCON->PINSEL4=0X00000000; LPC_GPIO2->FIODIR=0XFFFFFFFF; LPC_PINCON->PINSEL2=0X00000000; LPC_GPIO1->FIODIR=0XFFFFFFFF; stat = finit ("R0:"); if (stat == fsOK){ stat = fmount ("R0:"); if(stat==fsOK) { LPC_GPIO1->FIOPIN=0XFFFFFFFF; } else if(stat==fsNoFileSystem) { if (fformat ("R0:", "") == fsOK){ stat = fmount ("R0:"); if(stat==fsOK) { LPC_GPIO2->FIOPIN=0X0000000F; }} }} } void tst_fopen (void) { f = fopen ("R0:\\r.txt","r"); if (f == NULL) { LPC_GPIO2->FIOPIN=0XFFFFFFF3; } else { LPC_GPIO2->FIOPIN=0XFFFFFFF6; } } int main (void) { SystemInit(); init_filesystem(); tst_fopen(); }
Calling init_filesystem() initializes and mounts the RAM drive successfully and turns the corresponding pins of PORT2 HIGH.This happens so if am not calling the tst_fopen() function.But whenever am calling tst_fopen function,fopen() runs out by an exception and the corresponding pins of PORT2 are switched as LOW. What could be the issue ?