ST意法半导体
直播中

赖治添

7年用户 212经验值
私信 关注
[问答]

掉电时EEPROM写入问题

嗨,
我正在使用STEVAL-IHM041V1演示板来开发我自己的应用程序。 mcu

是STM8S103F3P6。我检查了EEPROM位置以验证EEPROM是否读/写
当+ 5V稳定时,它们很好。但是我试图保存最后的数据时遇到问题
断电后设置为EEPROM。 EEPROM写入正在发生
在+ 5V降至3V以下(BOR电压)之前。但它没有用,我没有得到
电路板再次上电后,最后从EEPROM读取保存的数据。为什么?有没有人
遇到类似的问题?

以上来自于谷歌翻译


以下为原文




Hi,
I am using the STEVAL-IHM041V1 demo board to develop my own application. The mcu

is STM8S103F3P6. I checked the EEPROM locations to verify that the EEPROM read/write
are fine when the +5V is stable. But I have problem trying to save the last data  
settings to EEPROM after the power has been removed. The EEPROM write is happening  
before the +5V drops below 3V(BOR voltage). But it didn't work and I didn't get the
last saved data from EEPROM read once the board is powered up again. Why? Does anyone
experience similar problem?

回帖(2)

王玉华

2018-11-7 10:04:28
你好,
使用EEPROM时,MCU需要时间来实现写操作。
您可以使用相同的测试进行测试,但在切断电源之前增加50 ms吗?
添加电容以帮助MCU实现操作。
此外,通过在一个部分中写入数据+校验和+时间戳来使用冗余。
例如:对于10字节数据,我使用2个字节作为校验和,4个字节作为时间戳。所以每次保存需要16个字节。我使用EEPROM的64字节部分,我在循环模式下使用了4个以上的位置。我从未丢失过所有数据。

以上来自于谷歌翻译


以下为原文




Hello,
When the EEPROM is used, the MCU need time to realize the write.
Can you test, with the same test, but adding 50 ms before you cut the power supply ?
Add capacitor to help the MCU to realize the operation.
Also, use the redundancy by write your data + checksum + timestamp in a section.
For example : For 10 bytes data, I use 2 bytes for checksum and 4 bytes for timestamp. So I need 16 bytes for each save. I use 64 bytes section of EEPROM and I have than 4 locations that I used in circular mode. I never lost all my data.
举报

赖治添

2018-11-7 10:15:43
Sebastien B,
感谢您的回复!我找到了EEPROM读/写问题的原因。编写EEPROM需要比我想象的要长很多,所以我的看门狗会重置cpu。数据表说写4个字节需要6mS,但我的测试表明了这一点
1MHz CPU时钟需要20mS。无论如何,它现在正在运作。谢谢!
山姆

以上来自于谷歌翻译


以下为原文




Sebastien B,
Thanks for your reply! I found the cause of my EEPROM Read/Write problem. It takes a lot longer than I think to write the EEPROM so my Watchdog resets the cpu. The datasheet says it takes 6mS to write 4 bytes but my tests showed it
takes 20mS at 1MHz CPU clock. Anyway, it is working now. Thanks!
Sam
举报

更多回帖

发帖
×
20
完善资料,
赚取积分