完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我有一个STM8S207板,我正在使用带有Cosmic编译器的STVD版本4.3.3。我正在尝试使用@eeprom指令来写入/读取数据EEPROM,当我尝试写入数据时系统挂起。这是我到目前为止所尝试的内容。
#include< string.h> #include''stm8s.h'' #include''stm8s_flash.h'' @eeprom s16 eeData; s16 localData; / *读取数据* / localData = eeData; //工作 / *写入数据,方案1 * / eeData = localData; / *写入数据,方案2 * / eecpy(& eeData,& localData,2); 在这两种情况下,系统都会挂起我尝试写入eeData的指令。当使用调试器停止时,我看到它在函数c_eewrw(库函数?)中停止在以下指令: BTJF 0x505f,#2,0xb155 为了让系统准备好写入数据EEPROM,我还需要做些什么吗? 谢谢, 布赖恩 以上来自于谷歌翻译 以下为原文 I have a STM8S207 board and I'm using STVD version 4.3.3 with the Cosmic compiler. I am trying to use the @eeprom directive for writing/reading the data EEPROM and my system hangs when I try to write the data. Here's what I've been trying so far. #include #include ''stm8s.h'' #include ''stm8s_flash.h'' @eeprom s16 eeData; s16 localData; /* Read the data */ localData = eeData; // Works /* Write the data, scenario 1 */ eeData = localData; /* Write the data, scenario 2 */ eecpy(&eeData, &localData, 2); In both cases, the system hangs on the instruction in which I attempt to write to eeData. When stopping with the debugger I see that it is stopped inside function c_eewrw (library function?) at the following instruction: BTJF 0x505f, #2, 0xb155 Is there something else I need to do to get the system ready to write to data EEPROM? Thanks, Bryan |
|
相关推荐
3个回答
|
|
我使用STM8L,但它可能是等效的。
我必须在写入之前解锁eeprom,但是在8L写入受保护的内存时不要挂起CPU。 以上来自于谷歌翻译 以下为原文 I work with STM8L, but it is probably equivalent. I have to unlock the eeprom before writing it, but on 8L writing to a protected memory don't hang the CPU. |
|
|
|
布莱恩,
程序挂起的指令等待EEPROM编程结束。 正如Argail告诉你的那样,如果你没有通过在FLASH_DUKR中写入序列:0xAE 0x56来解锁EEPROM,那么你的代码将永远等待。 问候, EtaPhi 以上来自于谷歌翻译 以下为原文 Bryan, the instruction where your program hangs waits for the EEPROM programming end. As Argail told you, if you don't unlock EEPROM by writing the sequence: 0xAE 0x56 in FLASH_DUKR, your code will wait forever. Regards, EtaPhi |
|
|
|
所有,
谢谢您的帮助。事实证明我做错了一些事情。首先,我在调用_fctcpy时输入了一个拼写错误,因此我的flash编程例程没有加载到RAM中。然后,如上所述,我也忘了解锁EEPROM。此外,我正在使用一个工作在16 MHz以上的外部振荡器,所以我设置OPT7以添加数据表建议的等待状态。 我还发现在使用调试器加载程序时数据EEPROM会被清除。有道理,但我认为调试器只是重写程序闪存,而不是数据EEPROM。只需在不停止/启动调试器的情况下重新启动调试器,就不会重写数据EEPROM。一旦我完成了所有这一切,我就能够写入数据EEPROM并在电源循环时看到我的数据。 谢谢, 布赖恩 以上来自于谷歌翻译 以下为原文 All, Thanks for the help. Turns out I was doing a few things wrong. First, I had a typo in my call to _fctcpy, so the flash programming routines of mine were not loaded into RAM. Then, as mentioned, I had also forgotten to unlock EEPROM. Also, I am using an external osciallator that operates above 16 MHz, so I set OPT7 to add a wait state as suggested by the datasheet. I also discovered that the data EEPROM gets cleared upon loading the program with the debugger. Makes sense, but I thought the debugger just re-wrote program flash, not the data EEPROM. Just restarting the debugger without stopping/starting the debugger does not re-write data EEPROM. Once I got all that straight I was able to write to data EEPROM and see my data still there upon a power cycle. Thanks, Bryan |
|
|
|
只有小组成员才能发言,加入小组>>
请教:在使用UDE STK时,单片机使用SPC560D30L1,在配置文件怎么设置或选择?里面只有SPC560D40的选项
2642 浏览 1 评论
3208 浏览 1 评论
请问是否有通过UART连接的两个微处理器之间实现双向值交换的方法?
1783 浏览 1 评论
3611 浏览 6 评论
5989 浏览 21 评论
940浏览 4评论
1317浏览 4评论
在Linux上安装Atollic TRUEStudio的步骤有哪些呢?
585浏览 3评论
使用DMA激活某些外设会以导致外设无法工作的方式生成代码是怎么回事
1304浏览 3评论
1362浏览 3评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-25 06:13 , Processed in 1.197881 second(s), Total 82, Slave 65 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号