嗨,MCC还没有为PIC32毫米设备做任何事情。所有的PIC32毫米设备在写入闪存的数据方面都是一样的,设备之间的唯一区别是闪存的总大小。硬件在芯片中,并在数据表第5章中描述。注:表26-11:在数据表的规范部分。在家庭参考手册第5部分中有更多的描述。它是一个单独的文档,您可以从产品网页下载您的设备:HTTP://www. MyCHIP.COM/WWWORDSTMS/En/PIC32 MM00 64 GPL028打开:OnAb,在页面的最下面。在闪存中写两个单词的功能可能是这样的:问候,Mysil
以上来自于百度翻译
以下为原文
Hi,
MCC have not yet done anthing to help with this for PIC32MM devices.
All PIC32MM devices behave the same when it comes to writing data into Flash memory,
the only difference between devices is the total size of flash memory.
The hardware is in the chip, and is described in Datasheet chapter 5.
Also note: TABLE 26-11: in the specifications part of the datasheet.
There is more description in Family Reference Manual section 5.
it is a separate document that you may download from the product webpage for your device:
http://www.microchip.com/wwwproducts/en/PIC32MM0064GPL028
open the: > Documentation
tab, far down in the page.
A function to write two words in Flash memory may be like this:
unsigned int NVM_WriteWord2(void* address, unsigned int data0, unsigned int data1)
{
unsigned int res = 0;
NVMDATA0 = data0;
NVMDATA1 = data1
/* convert virtual address to physical address and load into NVMADDR register */
NVMADDR = ((unsigned int) address & 0x1FFFFFFF);
/* Unlock and Perform the NVM operation */
res = NVM_Unlock (NVM_OPERATION_WRITE_WORD);
return res;
}
unsigned int NVM_Unlock (unsigned int nvmop)
{
unsigned int status = 0;
/* Suspend or Disable all Interrupts */
asm volatile ("di %0" : "=r" (status));
/* clearing error bits before performing an NVM operation */
NVMCONCLR = NVM_NO_OPERATION_MASK;
/* Enable Flash Write/Erase Operations and Select Flash operation to perform */
NVMCON = (NVM_WRITE_OR_ERASE_ENABLE_BIT | nvmop);
NVMKEY = NVMKEY1;
NVMKEY = NVMKEY2;
/* Start the operation using the Set Register */
NVMCONSET = NVM_WRITE_CONTROL_BIT;
/* Wait for operation to complete */
while (NVMCON & NVM_WRITE_CONTROL_BIT);
/* Restore Interrupts */
if (status & 0x00000001) {
asm volatile ("ei");
} else {
asm volatile ("di");
}
/* Disable NVM write enable */
NVMCONCLR = NVM_WRITE_OR_ERASE_ENABLE_BIT;
/* Return WRERR and LVDERR Error Status Bits */
return (NVMCON & NVM_WRERR_LVDERR_MASK);
}
Regards,
Mysil
嗨,MCC还没有为PIC32毫米设备做任何事情。所有的PIC32毫米设备在写入闪存的数据方面都是一样的,设备之间的唯一区别是闪存的总大小。硬件在芯片中,并在数据表第5章中描述。注:表26-11:在数据表的规范部分。在家庭参考手册第5部分中有更多的描述。它是一个单独的文档,您可以从产品网页下载您的设备:HTTP://www. MyCHIP.COM/WWWORDSTMS/En/PIC32 MM00 64 GPL028打开:OnAb,在页面的最下面。在闪存中写两个单词的功能可能是这样的:问候,Mysil
以上来自于百度翻译
以下为原文
Hi,
MCC have not yet done anthing to help with this for PIC32MM devices.
All PIC32MM devices behave the same when it comes to writing data into Flash memory,
the only difference between devices is the total size of flash memory.
The hardware is in the chip, and is described in Datasheet chapter 5.
Also note: TABLE 26-11: in the specifications part of the datasheet.
There is more description in Family Reference Manual section 5.
it is a separate document that you may download from the product webpage for your device:
http://www.microchip.com/wwwproducts/en/PIC32MM0064GPL028
open the: > Documentation
tab, far down in the page.
A function to write two words in Flash memory may be like this:
unsigned int NVM_WriteWord2(void* address, unsigned int data0, unsigned int data1)
{
unsigned int res = 0;
NVMDATA0 = data0;
NVMDATA1 = data1
/* convert virtual address to physical address and load into NVMADDR register */
NVMADDR = ((unsigned int) address & 0x1FFFFFFF);
/* Unlock and Perform the NVM operation */
res = NVM_Unlock (NVM_OPERATION_WRITE_WORD);
return res;
}
unsigned int NVM_Unlock (unsigned int nvmop)
{
unsigned int status = 0;
/* Suspend or Disable all Interrupts */
asm volatile ("di %0" : "=r" (status));
/* clearing error bits before performing an NVM operation */
NVMCONCLR = NVM_NO_OPERATION_MASK;
/* Enable Flash Write/Erase Operations and Select Flash operation to perform */
NVMCON = (NVM_WRITE_OR_ERASE_ENABLE_BIT | nvmop);
NVMKEY = NVMKEY1;
NVMKEY = NVMKEY2;
/* Start the operation using the Set Register */
NVMCONSET = NVM_WRITE_CONTROL_BIT;
/* Wait for operation to complete */
while (NVMCON & NVM_WRITE_CONTROL_BIT);
/* Restore Interrupts */
if (status & 0x00000001) {
asm volatile ("ei");
} else {
asm volatile ("di");
}
/* Disable NVM write enable */
NVMCONCLR = NVM_WRITE_OR_ERASE_ENABLE_BIT;
/* Return WRERR and LVDERR Error Status Bits */
return (NVMCON & NVM_WRERR_LVDERR_MASK);
}
Regards,
Mysil
举报