• AVR Freaks

Hot!Harmony Driver "Flash" or "NVM" for a single 16 bit unsigned?

Author
luker
Super Member
  • Total Posts : 183
  • Reward points : 0
  • Joined: 2015/04/17 06:24:04
  • Location: 0
  • Status: offline
2020/08/26 03:04:53 (permalink)
0

Harmony Driver "Flash" or "NVM" for a single 16 bit unsigned?

Hi forum,
 
there is a project with a relay. After 10000 switching cycles, this relay needs to be replaced. A PIC32MK0512GPE064 needs to keep track of the switches this relay has done already. The value must survive power cycles.
 
In Harmony 2.06 without RTOS, do I use the "NVM" driver or the "Flash" driver to store that value?
#1
NKurzman
A Guy on the Net
  • Total Posts : 19034
  • Reward points : 0
  • Joined: 2008/01/16 19:33:48
  • Location: 0
  • Status: offline
Re: Harmony Driver "Flash" or "NVM" for a single 16 bit unsigned? 2020/08/26 08:10:00 (permalink)
0
You may be better off with an external EEPROM.
You may want to read the data sheet for how long a flash location will last.
And note you must erase an entire page at a time. You can use this to your advantage by using multiple bites or bits to record Relay operations, without wearing up the flash.
#2
Mysil
Super Member
  • Total Posts : 3952
  • Reward points : 0
  • Joined: 2012/07/01 04:19:50
  • Location: Norway
  • Status: offline
Re: Harmony Driver "Flash" or "NVM" for a single 16 bit unsigned? 2020/08/26 11:25:05 (permalink)
5 (2)
Hi,
The PIC32MK device have a hardware EEPROM  peripheral,
that is actually a separate section of Flash memory with hardware wear leveling.
It use 16 words of 33 bits each for storing each 32 bit word, in a round robin sequence.
When 16 write operations have been done, a Erase is performed by hardware with the next write,
but this will cause the operation to need up to 20 millisecond to complete.
 
See Datasheet chapter 6 and Table 36-19.
 
I do not know the Harmony code for handling this peripheral, or what it is called in the GUI.
You may make sure that the code generated use EECON, EEKEY, EEADR and EEDATA control registers.
 
Note that Program Flash memory is controlled by NVMCON register.
 
    Mysil
#3
Jump to:
© 2020 APG vNext Commercial Version 4.5