Some question around interrupts, handler, eeprom on AtMega128:
The eeprom.h file reads:
As these functions modify IO registers, they are known to be non-reentrant. If any of these functions are used from both, standard and interrupt context, the applications must ensure proper protection (e.g. by disabling interrupts before accessing them).
Good. I have a timer handler (I'm using AVRLib) which does some eeprom read/write access among other (actually it manages keypad input, manages TCP/IP dialog through ethernet and contains some logic to control the I/O). Beside this, the main code manages a finite state machine for configuring the complete thing through LCD and keypad.
The first instruction in the handler is cli() and the last sei(), so no interrupts within interrupts. I guess this is safe.
Does the eeprom.h comment means that any eeprom_read or eeprom_write has to be between a cli() and sei() ? Just to be sure...
I'm having some strange behavior at times, and I'm not able to track this down. Keypad and LCD stops answering at some point of time, but TCP/IP is still OK, so the AVR is still alive and processing ethernet frames.....
Is putting everything in a single timer not recommended ? I don't think it is worth creating tasks for only 3 of them (TCP/IP, keypad/LCD state machine, I/O control) as my app is not time-critical.
Any comments/hints ?