Some functions hang in timers

Hi,

I’ve come across a problem regarding the execution of certain functions in a timer. They seem to work differently than they do in the main program.

Here’s an overview of the function (its purpose is to make sure everything is allright and reboot the module otherwise) :

void wd_verif(ULONG param) {
int erreur, fd;
erreur = 0;
/* various checks done here to get the value of the error variable */
if( erreur != 0 ) {
fd = open (“FLASH0/erreur”, O_WRONLY);
if( fd != -1 ) {
write(fd, &erreur, sizeof(erreur));
close( fd );
}
customizeReset();
}

The timer itself is started in applicationStart() like this :

tx_timer_create( &timer_wd, “Timer Watchdog”, wd_verif, 0, 5NABspTicksPerSecond, 5NABspTicksPerSecond, TX_AUTO_ACTIVATE );

It appears the program hangs on the ‘open’ function. If I remove the part writing to a file, customizeReset() reboots the part as expected.

If I call the function directly from applicationStart() by wd_verif(0);, everything works OK.

Any idea of what could be wrong here ?

Thanks,
vic

This is just an idea, but since open(), write() and such map to NAFS functions, try the base functions.

I bet the problem is that since the NAFS functions are asyncronous, that there are internal timers in the open(), write() and such wrapper functions.

-Erik

Thank you !

I replaced libc functions by NAFS* functions and now everything works OK.

vic