XMEGA Non-volatile memory (EEPROM) writes and interrupts

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This question may apply to MEGA series as well. My question regards non-volatile memory, EEPROM specifically.

Non-volatile memory writes takes many milliseconds and this will be many clock cycles if my clock is 24MHz. If I start my NVM write, is it possible that interrupts will be processed (not just received), during this non-volatile memory write? Based on the xmega au manual, I infer this is what will happen, but I want to confirm.

I think this might be dangerous in that interrupts handled during this time will perform actions that will corrupt my NVM write (like starting a motor).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

you need to disable interrupts while writing to eeprom

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Interrupts will be processed while NVM is writing to EEPROM. You can keep them running, however you do need to be very careful not to affect the NVM in any way. That means no change of power state (except perhaps idle sleep mode), no reprogramming the NVM registers, no trying to access EEPROM.

FWIW I write to EEPROM with interrupts enabled without issue.