I have been using an STM8L051F3P6 microcontroller in my sensor project. I have followed all the guidelines mentioned in the datasheet. After burning the firmware into the controller, it works for about a minute or less than that. But after that, the controller starts resetting indefinitely. Because of resetting, I'm not able to program it again. At times, inserting the ST link cures this problem as the NRST pin is pulled high and the resetting stops. But the programming issue pertains.
Adding more light, as per my design, the controller should sense some data, go to sleep, then wake up after a fixed interval of time. But it wakes up before the specified time setting. This keeps on repeating again and again. The waking up time is also random. I am able to witness this because of an led on the board that keeps on blinking in an erratic manner.
The same design used to work before with old batch of STM8L controllers but resets with the new design. One thing that I noticed was that previous controllers had 501 mentioned while the newer ones have 701 mentioned on them.
Is the newer series of controller different from the older series?
I am attaching the schematic also if it helps.