Now there's a problem description if I've ever seen one :-)
My bet is that it has something to do with the interrupts. Have you tried to disable the USB comms and change/save/read back the EEPROM values in some other way just to verify that the routine that does the EEPROM writing is actually working properly. Not that I see why it shouldn't but it'll give you further clues and/or verification that it IS the USB comms/interrupts that's the culprit.
I'm surprised that your approach with the rotation variable didn't work. I was going to suggest to put the "write to EEPROM routine (one byte at the time)" in the USB Service routine but if your main routine doesn't run slower than the USB service interval your approach would basically do the same thing. The manual says that the WRITE command is self timed and "may" take up to 10ms, have you measured how long it actually takes?
How long does your main code take to exectute? Can you, as a test, disable interrupts al togheter and just call the USB service routine once each pass?
/Henrik.




Bookmarks