Quote:
|
Originally Posted by Mike Bortfeldt
Kevin,
I haven't tried this, but from the PIC documentation, it looks like you only have to disable the interrupts during the period that you call "pre-write sequence" and "execute the write" in the EEPROM_Write_Handler routine. You should be able to re-enable the interrupts after these 3 lines (from the 39609b Microchip document, section 7.4) rather than waiting until the 2ms write is complete.
|
Thanks for the suggestion. I'd heard from another source that interrupts had to be disabled for the entire period to ensure a reliable write. As I wasn't sure what the answer was, I decided to err on the conservative side and disable interrupts globally for the entire period (at least on the first revision). When I get some time to work on it, I'll talk with the folks at Microchip to see what they say.
Quote:
|
Originally Posted by Mike Bortfeldt
This may also eliminate the code error by allowing the high priority interrupts to mostly go on schedule.
|
That isn't a problem because the high-priority interrupt never gets disabled (i.e., EEPROM_Write_Handler() never gets called). The problem is that getdata() and putdata() won't be called once the code gets stuck in the while() loop, which makes the master processor cranky. BTW, if EEPROM_Write Handler() gets called from Process_Data_From_Master_uP(), disabling the high-priority interrupt isn't a problem because it won't fire-off again until the next SPI packet arrives from the master processor in a period of time much greater than two milliseconds.
-Kevin