完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
你好。如果软件或看门狗复位发生,SRAM存储器是否被删除?我知道RAM内存是ValATyle,我使用PSoC5。
这里是我用来测试SRAM是否被删除的代码,如果重置发生的话。我想知道是否可以。 包括: 空主程序() { 无符号char p=(unChar char)0x200 000; 无符号字符CNT=0; 如果(p)!= 0xAA) { *P= 0xAA; 如果SRAM被擦除,Pin 1x写(1);//LeD1打开。 Pin 2x写(0); } 其他的 { Pin 1-写(0); 如果SRAM不擦除,Pin 2x写(1);//DEL2打开。 } (;) { CNT+; CyTeles(1000); 如果(CNT=16) CythStiGRIG8(RESETYCR2,1);/软件复位 } } 以上来自于百度翻译 以下为原文 Hello. Is SRAM memory deleted if software or watchdog reset occurs? I know that RAM memory is volatyle, and i am using PSoC5. Here is the code i would use for testing if SRAM is deleted or not if reset occurs. I am wondering if it is ok. #include void main() { unsigned char *P = (unsigned char*)0x20000000; unsigned char cnt = 0; if(*P != 0xAA) { *P = 0xAA; Pin1_Write(1); //led1 is on if SRAM is erased Pin2_Write(0); } else { Pin1_Write(0); Pin2_Write(1); //led2 is on if SRAM is not erased } for(;;) { cnt++; CyDelay(1000); if(cnt == 16) CY_SET_REG8(RESET_CR2, 1); //software reset } } |
|
相关推荐
9个回答
|
|
就我所理解的“重置”,启动代码被执行,C程序的初始化也被执行。这将把RAM中的所有变量(无s的“s”)带到一个已知的状态:Initialized。
只有存储的(而不是编程的)闪存被保存在PSoC的回复中。 鲍勃 以上来自于百度翻译 以下为原文 As far as I understand "Reset" the code for boot is executed AND the initialization for your C-Program is executed as well. This will bring all your variables in Ram (reardless of the "S") to a known state: Initialized. Only values stored (rather:programmed) into flash are kept across resetings of the PSoC Bob |
|
|
|
我刚刚找到了这个HTTP://www. CyPress?当PSOC 1发生看门狗重置时,RID=40931以保存内存。
仅仅为了完整性:SRAM的“S”代表“静态”,但这与保持数据重置无关。它与“动态”或DRAM相反,必须时时更新(几毫秒)来保持数据。 有一个标志,你可以阅读看看是看门狗复位或外部重置。请看这里的HTTP://www. CyPress。APP =论坛和ID ID=2233和;RID=56423 鲍勃 以上来自于百度翻译 以下为原文 I just found this http://www.cypress.com/?rID=40391 to preserve memory when watchdog reset occurs for PSoC 1. Just for the completeness: The "S" in SRAM stands for "Static" but this has nothing to do with keeping the data across resets. It is ment in opposite to "Dynamic" or DRAM which must be refreshed from time to time (a few ms) to keep the data. There is a flag you may read to see if is was a watchdog reset or an external reset. Have a look here http://www.cypress.com/?app=forum&id=2233&rID=56423 Bob |
|
|
|
这就是我正在寻找的。但我需要PSOC5,我在网站上搜索类似的文章(PSOC5),看了一下TRM,但是我没有发现任何东西。
以上来自于百度翻译 以下为原文 That is what i am looking for. But i need it for PSoC5, i searched the site for simillar article (for PSoC5) and looked in the TRM but i didn't found anything. |
|
|
|
其中一个问题是,CPU在复位时启动,就像开机一样。这意味着所有初始化都会重新进行,硬件和软件。这种行为会破坏我们在PSoC1中的内存,当在汇编中编程时,会有可能保留一些内存位置。
这是闪存下降的地方:通常可以在重置到非常小的数量之后,减少所需的绝对数据(一个浮标、一些int和一些状态变量)。当这个区域被编程成闪光灯时,即使在断电后,你也可以访问它。你需要一个小技巧,看看Flash是否已经被编程,但仅此而已。在编程闪光灯时,电源损耗是可以克服的,在电源上有一定的容量可以克服。 鲍勃 以上来自于百度翻译 以下为原文 One of the problems is, that the CPU starts anew at reset just like at power-on. This implies all initialization is done anew as well, hardware and software. This behaveour will spoil the memory in a PSoC1 as well, exept when programming in assembly, then there might be a chance to preserve some memory locations. This is the point where flash memory drops in: you can normally reduce the absolutely required data needed after a reset to a very small amount (a handfull of floats, some ints and a couple of state-variables). When this area is programmed into flash you can access it even after a power-loss. You'll need a little trick to see whether the flash is programmed already or not, but that's all. To concider is a power-loss when programming the flash which can be overcome with some capacity on the power-supply. Bob |
|
|
|
我不明白,我可能错过了什么。
在FLASH中加载代码后,程序正在运行,是否可以在闪存中保存变量(存储在DRAM或SRAM中,WHASHEVER)?让我们说这是可以做到的。 但你不知道何时会出现看门狗重置。在这种情况下,你应该定期保存你需要的变量,在闪存(我想,如果它可以做,它会使程序慢得多)。 我可以使用EEPROM(512字节对我来说足够了)。但问题是,它有1.000万个读/写周期。所以,让我在EEPROM中保存每分钟需要的变量。这意味着EEPROM在694天之后(2年)不能使用,这是很低的。 最好的解决方案是保存RAM位置,因此在从复位(看门狗复位)恢复之后,有用的变量不会丢失。但我仍然没有找到我能做到这一点(在PSoC5或PSoC3上)。谢谢你的回复,他们很有帮助。 以上来自于百度翻译 以下为原文 I don't understand, i might have missed something. After the code is loaded in flash, and the program is running, is it possible to save variables (stored in DRAM or SRAM, whathever), in flash memory? Let's say that this can be done. But you don't know when a watchdog reset would occur. In this case, you should regularly save the variables you need, in the flash memory (which, i suppose, if it can be done, it would make the program much slower). I could use the EEPROM (512bytes are more than enough for me). But the problem is that, it have 1.000.000 read/write cycles. So, let's say that i save the variables i need, in EEPROM, every minute. That means that the EEPROM can't be used after ~694 days (that's 2 years), which is low. The best solution is preserving RAM locations, so after recovering from reset (watchdog reset) useful variables won't get lost. But i still didn't found how can i do this (on PSoC5 or PSoC3). Thanks for your replys, they are helpful. |
|
|
|
我试图用礼貌的方式指出:你不能那样做!看门狗复位就像紧急刹车,当火车停下来时,你可能不会坐在原来的地方(宽泛的微笑)。看门狗复位显示您的程序(或您的硬件)访问了电子NiWaWa,否则WD中断就不会发生。它就像你的PC上的重置按钮:当你按下它时,所有当前的RAM信息都不是(!)!!!)失去了,但他们被认为是无用的和覆写的。
我想,你正在尝试一些特殊的东西,如果你和我们分享更多的信息,我们可能会帮助你一点。 你用WD做什么,你的应用程序会执行什么? 鲍勃 以上来自于百度翻译 以下为原文 I tried to point out in a polite way: you cannot do that! A watchdog reset is like an emergency brake, when the train has stopped you'll probably not sitting on your original place (broad smile). A watchdog reset shows that your program (or your hardware) visited electronic nirwana or else the WD interrupt would not have occured. It is like the Reset-button on your PC: when you press it all the current RAM - information are NOT(!!!) lost, but they are assumed to be useless and overwritten. I thinki, you are trying something special, if you share a bit more information with us, we might help you a bit further. What are you using the WD for, what will your application perform. Bob |
|
|
|
我知道看门狗的计时器是干什么的。
我在寻找感兴趣的如果有办法从看门狗复位恢复,数据不丢失。 我没有具体的应用程序。肯定的是,我会在psoc5 / PSoC3产品开发的应用程序将被用于工业环境。在这样的环境中有很高的概率,处理器可能进入一个“电子娜湾”,这就是为什么我需要使用看门狗。 您向我展示了PSOC1的文章,并保存了RAM。如果PSOC3/5有类似的文章,我很感兴趣。我想我已经很好地描述了我想要做的事情。 我的问题的另一个解决办法是定期冲洗缓冲(存储在RAM)到外置SD卡,所以如果发现看门狗复位,该变量可以被恢复,和过程得以持续,不是从一开始就开始了。而这一解决方案是昂贵的。 以上来自于百度翻译 以下为原文 I know what a watchdog timer do. I am interested in finding-out if there is some way to recover from a watchdog reset, without loss of data. I don't have a specific application in mind. Certain is that the applications that i will develop on PSoC5/PSoC3 will be used in industrial environment. And in such environment there is a high probability that the processor might go in a "electronic nirwana" and that's why i need to use a watchdog. You showed me that article for PSoC1, with preserving RAM. I am interested if there is a similar article for PSoC3/5. I think i described well enough what i am trying to do. Another solution for my problem would be to periodically flush a buffer (stored in RAM) to an external SD card, so if a watchdog reset was detected, the variables could be restored, and the process can be continued, not started from the beggining. But this solution is to expensive. |
|
|
|
试一试:
在一个特定的固定地址256bytes比如声明一个存储区。(不是在开始,而不是在RAM的末尾) 检查在该地区的一个已知的模式,信号与一个领导的结果 如果结果是假的,就把已知的图案写进这个区域。 停止程序(无限循环) 按下重置或让WD发生 你会看到有内存区域的内容将不会被摧毁。 问题可能是,这取决于你的程序的内存使用256字节的区域可能覆盖。 但它比外部SRAM便宜。 鲍勃 以上来自于百度翻译 以下为原文 Give it a try: Declare a memory-area at a specific fixed address of 256Bytes for instance. (Not at the beginning and not at the end of RAM) Check for a known pattern in the area, signal the result with a LED If result was FALSE, write known pattern into the area. stop Program (infinite Loop) Press reset or let WD happen You will see that there are memory areas where the contents will not be destroyed. The problem might be that depending on your program's memory usage the 256-byte Area MIGHT become overwritten. But it's cheaper than external SRAM. Bob |
|
|
|
使用调试器的方式更容易看到内存中会发生什么。谢谢这些家伙:
以上来自于百度翻译 以下为原文 Using the debugger is way easier to see what happens in memory. Thanks for the triks :) |
|
|
|
只有小组成员才能发言,加入小组>>
752个成员聚集在这个小组
加入小组2071 浏览 1 评论
1827 浏览 1 评论
3640 浏览 1 评论
请问可以直接使用来自FX2LP固件的端点向主机FIFO写入数据吗?
1761 浏览 6 评论
1513 浏览 1 评论
CY8C4025LQI在程序中调用函数,通过示波器观察SCL引脚波形,无法将pin0.4(SCL)下拉是什么原因导致?
511浏览 2评论
CYUSB3065焊接到USB3.0 TYPE-B口的焊接触点就无法使用是什么原因导致的?
361浏览 2评论
CX3连接Camera修改分辨率之后,播放器无法播出camera的画面怎么解决?
410浏览 2评论
357浏览 2评论
使用stm32+cyw43438 wifi驱动whd,WHD驱动固件加载失败的原因?
858浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-25 11:54 , Processed in 1.191261 second(s), Total 93, Slave 76 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号