Hi everybody,
I'm new in programming mbed, for feww weeks. I also have a problem with localfilesystem that nobody seems to have (after a look in the forum).
My program do chrono things like this :
* Create an ini file if not exists, to store the default hardcoded IP conf to use with (default : DHCP),
------------------------------------------------------------------
int Save() {
LocalFileSystem local("local");
FILE *fp = fopen("/local/config.ini", "w");
if (fp == NULL) {
printf("\n\rERROR IN SAVING CONTROLER CONFIG FILE\n\r");
return -1;
}
fprintf(fp,"[IPADDRESS=%s]\n", _ipaddress);
fprintf(fp,"[SUBNETMASK=%s]\n", _subnetmask);
fprintf(fp,"[GATEWAY=%s]n", _gateway);
fprintf(fp,"[DNSSERVER=%s]\n", _dnsserver);
fprintf(fp,"[UDPPORT=%d]\n", _udpport);
fprintf(fp,"[NTPSERVER=%s]\n", _ntpserver);
fprintf(fp,"[UTCOFFSET=%d]\n", _utcoffset);
fprintf(fp,"[NBACCESSUNITS=%d]\n", _nbaccessunits);
fprintf(fp,"[USEDHCP=%d]\n", _usedhcp);
fclose(fp);
return 0;
}
------------------------------------------------------------------
* Initiate the IP conf, which result is success
* Get local time from my ntp server, with set_time just after, which result is also ok
* Than wait for a tag from an rfid2 reader
=> When a tag is passed, strore the timcode and tag id in a log file
------------------------------------------------------------------
int Writetageventlog(int id, int status) {
LocalFileSystem local("local");
FILE *fp = fopen("/local/ctrler.log", "a");
if (fp == NULL) {
printf("\n\rERROR IN SAVING TAG EVENT LOG FILE\n\r");
return -1;
}
fprintf(fp,"[%s//%d//%d]\n", GetUTCTIMESTR(), id, status);
printf("[%s//%d//%d]\n", GetUTCTIMESTR(), id, status);
fclose(fp);
return 0;
}
------------------------------------------------------------------
INI and LOG file are 8.3 files on localfilsystem /local/...
The problem is that INI file is correctly created (recreated after reboot), but the log one not ! fopen seems to do the job because I have no ERROR message back, but the fprintf freeze the mbed, printf is also not output, and after a while, USB disk on my PC is removed !!!....
Did you encountered such freezing attitude using localfilesystem ?
One thing next : when I test my program, I'm connected both with the USB interface (to see debug messages in Teraterm), and with the Ethernet plug.
Does it mean the problem of both masters could have this symptomatic result ?
When I omit the printf, an empty file is created. Even I limit my fprintf to a simple string, it freeze, so that I think the problem is not with my variables types....
Can someone Help please ?
Hi everybody,
I'm new in programming mbed, for feww weeks. I also have a problem with localfilesystem that nobody seems to have (after a look in the forum).
My program do chrono things like this :
* Create an ini file if not exists, to store the default hardcoded IP conf to use with (default : DHCP),
------------------------------------------------------------------
int Save() {
LocalFileSystem local("local");
FILE *fp = fopen("/local/config.ini", "w");
if (fp == NULL) {
printf("\n\rERROR IN SAVING CONTROLER CONFIG FILE\n\r");
return -1;
}
fprintf(fp,"[IPADDRESS=%s]\n", _ipaddress);
fprintf(fp,"[SUBNETMASK=%s]\n", _subnetmask);
fprintf(fp,"[GATEWAY=%s]n", _gateway);
fprintf(fp,"[DNSSERVER=%s]\n", _dnsserver);
fprintf(fp,"[UDPPORT=%d]\n", _udpport);
fprintf(fp,"[NTPSERVER=%s]\n", _ntpserver);
fprintf(fp,"[UTCOFFSET=%d]\n", _utcoffset);
fprintf(fp,"[NBACCESSUNITS=%d]\n", _nbaccessunits);
fprintf(fp,"[USEDHCP=%d]\n", _usedhcp);
fclose(fp);
return 0;
}
------------------------------------------------------------------
* Initiate the IP conf, which result is success
* Get local time from my ntp server, with set_time just after, which result is also ok
* Than wait for a tag from an rfid2 reader
=> When a tag is passed, strore the timcode and tag id in a log file
------------------------------------------------------------------
------------------------------------------------------------------
INI and LOG file are 8.3 files on localfilsystem /local/...
The problem is that INI file is correctly created (recreated after reboot), but the log one not ! fopen seems to do the job because I have no ERROR message back, but the fprintf freeze the mbed, printf is also not output, and after a while, USB disk on my PC is removed !!!....
Did you encountered such freezing attitude using localfilesystem ?
One thing next : when I test my program, I'm connected both with the USB interface (to see debug messages in Teraterm), and with the Ethernet plug.
Does it mean the problem of both masters could have this symptomatic result ?
When I omit the printf, an empty file is created. Even I limit my fprintf to a simple string, it freeze, so that I think the problem is not with my variables types....
Can someone Help please ?