完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨,当编程EEPROM时,我正在写写地址的腐败。例如,我将一个计数器设置为传输的大小,让我们A9H。我指向一个带有数据的RAM缓冲区。我在EEPROM中设置了一个两字节的地址,比如说,000小时。大多数时候,所有数据都被正确存储。然而,有时目标EEPROM地址被清除到FFH,并且数据字节被存储在下一页上。当高地址指针移动到下一页即1xx时,我设置一个断点来触发,当它触发时,我看到计数器只从A9h计数到41h(所以尚未完成),低阶地址值为零(因此滚到下一页)。我的代码中没有一个在0FFH上面写EEPROM,所以没有理由在那里看到任何数据。高阶地址总是在调用EEyWrad之前清除。我有一个中断禁用周围的关键部分EEAI写routtin。我不使用任何其他的地址指针。中断程序不使用任何寄存器——或者至少存储和恢复任何寄存器。我在RAM中保持EEPROM地址指针,并在写入之前将其转移到EEADRL和EEADRH,因为在使用SCIF EEADRL等指令之前,我曾见过问题。作为一种解决方案,我已经把中断禁用到EEI写调用之前(到目前为止),防止了损坏。有没有其他人经历EEPROM编程结果,不如预期?
以上来自于百度翻译 以下为原文 Hi, I am getting a corruption of the write address when programming the EEPROM. For instance, I set a counter to the size of the transfer, let's A9h. I point to a RAM buffer with the data. I set up a two byte address in EEPROM - let's say 0000h. Most of the time all data gets stored correctly. However, sometimes the target EEPROM address gets cleared to FFh and the data byte gets stored in the next page up. I set a breakpoint to trigger when the high address pointer moves to the next page i.e. 1xx and when it triggers I see the counter having only counted down from A9h to 41h (so not yet finished) and low order address value is zero (hence the roll over to the next page). None of my code address EEPROM above 0FFh so there is no reason to see any data there. The high order address is always cleared before the call to EE_WRITE. I have an interrupt disable around the critical part of the EE_WRITE rountine. I do not use the address pointers for anything else. The interrupt routine does not use any of the registers - or at least stores and restores any. I maintain the EEPROM address pointer in RAM and transfer it to EEADRL and EEADRH prior to a write as I have seen problems before when using instructions like INCF EEADRL. As a workaround I have moved the interrupt disable to before the EE_WRITE call and (so far) that has prevented the corruption. Has anyone else experienced EEPROM programming results that were not as expected? |
|
相关推荐
10个回答
|
|
一般来说,如果移动中断禁止点消除了这个问题,那么代码中的某些东西就会被中断,但不应该在没有看到程序代码的情况下,我怀疑任何人都能具体说什么。这是一个普遍的问题,答案当然是。对。
以上来自于百度翻译 以下为原文 In general if moving the point of the interrupt disable eliminates the issue then something in your code is being interrupted that should not be however without seeing your program code I doubt anyone will be able to say specifically what. This is such a general question that the answer is of course yes. |
|
|
|
这是一个普遍的问题,答案当然是。
以上来自于百度翻译 以下为原文 This is such a general question that the answer is of course yes. indeed |
|
|
|
HiYes。不止一次,当我的代码中有bug时,这个和其他未被破坏的东西就会发生。
以上来自于百度翻译 以下为原文 Hi Yes. More than once, this and other unexpexted things tend to happen when I have bugs in my code. |
|
|
|
你真的在问“有人发现EEPROM存在问题”吗?答案是否定的。
以上来自于百度翻译 以下为原文 Are you really asking "has anyone found a problem with the EEPROM"? The answer to that is no. |
|
|
|
我没有看到这张照片上的关于EEPROM的勘误表……我错过了吗?
以上来自于百度翻译 以下为原文 I see nothing in the errata for this pic about the EEPROM......did I miss it? |
|
|
|
|
|
|
|
|
|
|
|
我没有看到这张照片上的关于EEPROM的勘误表……我错过了吗?你错过什么了。最后的编辑日期是2016,并且没有EEPROM问题列出。这意味着它更有可能是OPS代码而不是芯片中未检测到的bug。
以上来自于百度翻译 以下为原文 I see nothing in the errata for this pic about the EEPROM......did I miss it? You missed Nothing. The last edit date was 2016, and there is No EEPROM issues listed. That means it is more likely the OPs code rather than an undetected Bug in the Chip. |
|
|
|
我没有看到这张照片上的关于EEPROM的勘误表……我错过了吗?你错过什么了。最后的编辑日期是2016,并且没有EEPROM问题列出。这意味着它更有可能是OPS代码而不是芯片中未检测到的bug。我同意这个问题最有可能在OP的代码中(目前还没有看到)。
以上来自于百度翻译 以下为原文 I see nothing in the errata for this pic about the EEPROM......did I miss it? You missed Nothing. The last edit date was 2016, and there is No EEPROM issues listed. That means it is more likely the OPs code rather than an undetected Bug in the Chip. I agree the issue is most likely in the OP's code (which have as yet to see). |
|
|
|
嗨,谢谢你的输入。我已经看过勘误表了,知道那里什么也没有。按大众的要求,这里是代码。有两个例程:一个编程EEPROM(主要是缺货的MSPICE样例代码)和中断,可以中断写例程每2秒。应该没有触发It1的活动,所以我已经打折了。我设置一个断点来检测EEPROPL中的溢出,导致EEPROPH变为01H。当断点偶尔触发时,我看到要编程的字节数已经递减部分到0,但EE-PROPL已清除为零,导致增量为EEPROPH(参见EEI Wrre2)。尽管所有写入都是在EEPROM的前256个字节上进行的。例如,我将A9H字节编程到EEPROM地址0h到A9h。当写文件CNT减少到42h时,我可以看到EEOPROL的清除,所以还没有达到零。因此,EEPROPL增加了66小时、67小时、68小时、0h。缓冲器和寄存器分配是通过编译器完成的。从缓冲区到变量空间没有冲突或溢出。我不使用任何银行交换,依赖于访问RAM的变量和以上的缓冲区。当我可以找到附加图标时要遵循的代码。
以上来自于百度翻译 以下为原文 Hi, thanks for the input. I've already seen the errata so knew there was nothing there. By popular request, here is the code. There are two routines: the one that programs EEPROM (largely out of stock Mchip sample code) and the interrupt that can interrupt the write routine every 2 seconds. There should be no activity that triggers INT1 so I have discounted that. I set a breakpoint to detect an overflow in EE_PROGL causing EE_PROGH to change to 01h. When the breakpoint occasionally triggers I see that the number of bytes to program has decremented part way down to zero but EE_PROGL has cleared to zero causing an increment to EE_PROGH (see EE_WRITE2). This is despite all writes being targetted at the first 256 bytes of EEPROM. For instance I program A9h bytes into EEPROM address 0h to A9h. I may see the clearing of EE_PROGL happen when WRITE_CNT decrements to 42h, so not yet reached zero. So EE_PROGL increments 66h, 67h, 68h, 0h. Buffers and register allocation is done via the compiler. There are no conflicts or overflows say from a buffer into variable space. I don't use any bank switching, relying on access ram for variables and above for buffers. Code to follow when I can find the attach icon. |
|
|
|
只有小组成员才能发言,加入小组>>
5223 浏览 9 评论
2024 浏览 8 评论
1949 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3198 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2252 浏览 5 评论
769浏览 1评论
655浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
583浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
667浏览 0评论
569浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-16 18:44 , Processed in 1.425692 second(s), Total 93, Slave 77 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号