今日发现数十颗STM8S903K3 MCU不能正常工作,现象是上电后每隔500us左右发生一次reset(低电平时间约20us,判断是MCU内部reset),更换MCU后在同一环境下能正常工作。
使用R-LINK进行debug,发现上电后RST_SR寄存器值为0x18,也就是说除SWIM之外,还发生了EMS RESET。
往RST_SR寄存器写0x1F后,RST_SR值变化为0x10,也就是说EMCF位并没有被清除。
STM8S的datasheet上有如下介绍:
EMS reset
To protect the application against spurious write access or system hang-up, possibly caused
by electromagnetic disturbance, the most critical registers are implemented as two bitfields
that must contain complementary values. Mismatches are automatically detected by this
mechanism, triggering an EMS reset and allowing the application to cleanly recover normal
operations.
有没有兄弟可以帮忙分析一下,为何同一台机器,有些MCU会不能正常工作,并发生EMS RESET?发生EMS RESET后如何才能恢复到正常状态?包括:RESET后the most critical registers 的两个互补值是否都会恢复正常,RST_SR的EMCF位如何清除?
多谢! |