I have used timer interrupt in my application, mainly for timing reasons like timeout detection for processes,pulse generation etc, every 1 ms. Now i have a doubt.
Suppose in main(), if im doing another operation like, maybe writing to a SPI Flash a huge chunk of data, and the timer interrupt occurs,will the data writing process stop due to interruption by timer ISR or data be corrupted due to interruption by timer ISR? Im just wondering if whether the timer interrupt time is decided considering such operations that make up the complete application code?
If so,if a SPI flash write takes about 5ms and timer interrupt happens every 1ms, how can i keep track of timeouts,pulse generations etc without compromising of data corruption scenarios,because now ill have to change the timer interrupt to greater than 5 ms, and then i cant keep a reference of timeouts for processes where small timeouts like 1 ms may be needed.
Im using a hardware timer, and when the interrupt occurs,il be using a software timer counter(variable) in the ISR,to keep track of time.