I'm running an EMC test. During the test my stm8l152c6 immediately goes into some mode where everything stops working (neither LEDs nor buttons react). Only turning the power off and on helps.

I looked through the documentation and tried to fix this "glitch". I configured watchdog but it didn't help. When stm8l152c6 goes into this unclear state, for some reason it does not reboot. I also configured it to reboot itself every 10 seconds, but again after EMC test the microcontroller just went into glitch and that's all.

Is there any way to get out of this state?

  • 1
    \$\begingroup\$ I'm running an EMC test. what EMC test? Conducted immunity or radiated immunity or emission (unlikely)? Only turning the power off and on helps. during or after the test? ` I also configured it to reboot itself every 10 seconds, but again after EMC test the microcontroller just went into glitch and that's all.` could you please elaborate this? Does the MCU reset itself every 10 seconds during the test or does it just drop into that grey state during the test and remains there and can't clear without a power cycle? \$\endgroup\$ Commented Apr 4 at 8:34
  • \$\begingroup\$ @RohatKılıç I have an EMC testing device. I use it to create interference and my stm8 just shuts down (but for some reason it doesn't reboot). So for the test I made the microcontroller reboot every 10 sec . it just goes to a gray state during the test and stays there and can't clear itself without power off and on. \$\endgroup\$
    – Arthas
    Commented Apr 4 at 8:52
  • \$\begingroup\$ @Athas, You haven't answered Rohat Kılıç question. EMC test consists of many different tests. Which tests that caused the glitch? You indicated that you have an EMC testing device. What is/are the devices? \$\endgroup\$
    – kaosad
    Commented Apr 4 at 10:14
  • \$\begingroup\$ It sounds like either latch-up and/or low voltage reset. \$\endgroup\$
    – Lundin
    Commented Apr 4 at 10:51
  • \$\begingroup\$ What is the type of test? What waveforms, and how applied? What is MCU supply current after the event? \$\endgroup\$ Commented Apr 4 at 11:29

1 Answer 1


Is there any way to get out of this state?

Other than cycling the power probably not.

The trick here is to avoid going into this state. Entering that state is due to poor/weak layout on the circuit board (or lack of protection circuits) causing a vulnerability to the ESD transients.

These can be tricky to debug but, everyone who has tried to pass ESD testing usually succeeds with a fair amount of head-scratching, a decent amount of trial and error and possibly a few modifications.

I'll also add that ESD problems aren't limited to circuit boards that have MCUs on them.

  • \$\begingroup\$ As I was told by the people who made the board, everything on the board is "good". I was offered to improve my "code". According to the documentation I found, I was able to implement almost everything, but nothing helped me. Well, maybe nothing will help here \$\endgroup\$
    – Arthas
    Commented Apr 4 at 8:44
  • 3
    \$\begingroup\$ If the system only fails during one of the EMC tests, that is always because of some hardware vulnerability. Using a watchdog timer to reset when the system fails, is a software patch that only works until the EMC is severe enough to disrupt or destroy the CPU. That can't normally be fixed in software. Hardware guys always blame the software, and software guys always blame hardware, but the actual EMC test results point towards hardware. I recommend Electromagnetic Compatibility Engineering, Henry Ott, Wiley press, ISBN 978-0-470-18930-6 -- has good mitigation and diagnostics. \$\endgroup\$
    – MarkU
    Commented Apr 4 at 9:02
  • 3
    \$\begingroup\$ @Arthas you may have to consider whether what you were told by those people was actually reliable. I think you will find that anyone commenting here who has been through ESD testing will support what I say. \$\endgroup\$
    – Andy aka
    Commented Apr 4 at 9:26
  • 2
    \$\begingroup\$ @Arthas Those who design the board need to work closely with the programmers or the end result will be poor. If you have one pure hw guy and one pure sw guy and they aren't even speaking or understanding what the other person is doing, they both tend to think that the part they aren't doing themselves can solve everything through "magic". This would be the main reason why good universities force computer engineers to at least take a few electronics classes and force EE to at least take a few programming classes - so that they can speak with each other of technical terms. \$\endgroup\$
    – Lundin
    Commented Apr 4 at 11:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.