完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
你好研究员,我困了,需要一些帮助与NVM程序闪存写页。我在论坛里发现了一些代码,我必须修改一下,以适应我的需要。现在模拟器里一切都很好。我可以擦除闪光灯页面并给它写。我必须写600字节。因此不止一行。据我所知,PIC32 MX中的行是512字节。我用最后两个程序Flash页面为我的用户闪存空间。我的用户Flash空间开始于0x9D01E000,结束于0x9D01FFFF。这应该是2×4096字节。我还保留了链接器脚本问题:当我写一行时,只有第一个128字节被写入一行。其余的行(80H-200小时)仍然是FFH。这是我使用的代码:MycPy((空*)PaBufff,(空虚*)用户闪存,sieZof(PaBufff));NVMyErasePoad((空*)UsFlash页面);……(NUBYTESLUT & GT;ByTeTyRoWig Simple)NyBestTestOrreTeToRoWo= BytEythRoWig大小;否则NuBestTestOWRITETROW= NuByTestLead;//从PaBufff写入512个字节(一个NVM行)。总是写一整行。//NvMyWrrrDeWORE((空洞*)(UsFlash页面+ RoRunnIn PaulBufff),(空虚*)PaBufff);/*原始*/Unt8Itt Res=NVMyWrdReWORE((空洞*)(UsFlash页面+ RoRunnIn PaulBufff),(空*)PaBuffff+RooRunnIn PaulBufff);= 0)返回Res;NuByTestLeop-= NuByTestOWrrTeToRoW;RooRunnIn PosiWoReTeToRoW;}和未签名的int nvMyWrdReWORE(无效*地址,空隙*数据){un签署int Res=0;未签名int SaveDeSt.;SaveDeStase=d int)地址和0x1FFFFFF;NVMSRCADDR=((未签名int)数据和0x1FFFFFF);RES=NVMME解锁(NvMyOptuthOpRead Err.Read);*一些帮助或提示将非常感谢。非常感谢,安德烈亚斯。
以上来自于百度翻译 以下为原文 Hello Fellows, Im stuck and need some help with NVM Program Flash write page. I found some code here in the forum, which I had to modify a little bit to suit my needs. Now in simulator everything works well. I can erase the flash page and write to it. I have to write 600bytes. Hence more than a row. According to my knowledge a row is 512 bytes in PIC32MX. I use the last two program flash pages for my user flash space. My user flash space starts at 0x9D01E000 and ends at 0x9D01FFFF. This should be 2*4096bytes. I also reserve that in the linker script Problem: When I write a row only the first 128byte are written of a row. The rest of the row (80h-200h) remains all FFh. Here is the code I use: memcpy((void *)pageBuff, (void *)userFlashPage, sizeof(pageBuff)); NVM_ErasePage((void *)userFlashPage); ... while (numBytesLeft) { if (numBytesLeft > BYTE_ROW_SIZE) numBytesToWriteToRow = BYTE_ROW_SIZE; else numBytesToWriteToRow = numBytesLeft; // Write 512 bytes (one NVM row) from pageBuff. Writes a whole row always. //NVM_WriteRow((void *)(userFlashPage + rowIndexInPageBuff), (void*)pageBuff); /* Original */ uint8_t res = NVM_WriteRow((void *)(userFlashPage + rowIndexInPageBuff), (void*)pageBuff + rowIndexInPageBuff); if (res != 0) return res; numBytesLeft -= numBytesToWriteToRow; rowIndexInPageBuff += numBytesToWriteToRow; } and unsigned int NVM_WriteRow (void* address, void* data) { unsigned int res = 0; unsigned int saved_state; saved_state = __builtin_get_isr_state(); __builtin_disable_interrupts(); NVMADDR = ((unsigned int) address & 0x1FFFFFFF); NVMSRCADDR = ((unsigned int) data & 0x1FFFFFFF); res = NVM_Unlock(NVM_OPERATION_WRITE_ROW); __builtin_set_isr_state(saved_state); /* Set back to what was before. */ return res; } Some help or hints would be very appreciated. Thank you very much. Andreas |
|
相关推荐
2个回答
|
|
嗨,我想这是RTFM的例子,不同的PIC32 m…家庭具有不同的Flash页面大小,而PIC32 MX530与其他PIC32 MX5XX设备实际上不是一个家庭,而是一个PIC32 MX230设备,具有一个从MX5设备借用的CAN总线外设,它具有PIC32 MX1xx和MX2XX设备的存储器,闪存页面大小为1024字节,256个指令字F。LASH行大小128字节,是32个指令字。参阅:DATSHETDS6601290E第63页第6章框架注释:。迈西尔
以上来自于百度翻译 以下为原文 Hi, I think this is a case of RTFM. Different PIC32M... families have different Flash Page size, and PIC32MX530 isn't really in family with other PIC32MX5xx devices. Instead, it is a PIC32MX230 device with a CAN bus peripheral borrowed from MX5 devices. It have Memory as PIC32MX1xx and MX2xx devices, with Flash Page size 1024 bytes, 256 Instruction words, Flash Row size 128 bytes, is 32 Instruction words. See: datasheet DS60001290E-page 63 chapter 6.0 the framed Note:. Mysil |
|
|
|
谢谢你,Mysil,你说得对。我太专注于PIC32 FRM内存。现在一切都如愿以偿!
以上来自于百度翻译 以下为原文 Thank you Mysil, you are absolutely correct. I was too much focused on the PIC32FRM for the memory stuff. Now everything works as expected! |
|
|
|
只有小组成员才能发言,加入小组>>
5244 浏览 9 评论
2035 浏览 8 评论
1955 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3214 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2261 浏览 5 评论
779浏览 1评论
672浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
598浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
682浏览 0评论
579浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-25 15:35 , Processed in 1.641894 second(s), Total 47, Slave 41 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号