cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to Program STM8 using STVD Light Programmer or STVP

RAhuj.11
Associate II

Hello Everyone,

I am using a STM8S105C6T6 in one of my application and I am facing problem while programming it.

Software used: STVD version 4.3.12

Compiler: Cosmic CXSTM8 Special Edition 4.5.1 (Free 1yr License version)

I have build my application and when I click on ''start Debug'' in STVD, below error comes

Debug Seesion:

Starting debug session...

 -> Emulator reset (usb://usb)...

 done.

Opening application C:\Users\Micro\Desktop\STM8\STM8S105\led\Debug\led.elf...

 -> failed to download application: error: swim prog error [42004]: memory write error

Application closed.

Debug session closed.

0693W000008yErVQAU.png 

2. When I am Trying to Program using STVD in-built Programmer, it is showing below error:

''STVD > Tools > Programmer'' or using STVP.

Programming...

PROGRAM MEMORY:

> Blank Check not feasible

> Programming

Error : Programming failed

Error : Problem while trying to Reset swim and device. Apply a Power On Reset

0693W000008yErfQAE.png 

The interesting thing is, sometimes the MCU is getting programmed (LEDs are blinking as per requirement) but the software is showing same error message as above.

I don't understand why I am getting this error. My hardware connection and the SWIM communication are OK because I am able to program my other MCU i.e. STM8103F3P6 bare minimum board using same settings in STVD

How can I solve this error ?

Thanks in advance.

8 REPLIES 8
LGeor.2
Associate II

I am also facing the same issue.

Please check this : https://community.st.com/s/question/0D53W00000gfqjeSAA/stm8s005k6-swim-prog-error-42004-memory-write-error

Did you managed to solve it ?

WilkoL
Senior

Is there anything that might disturb the NRST function? Such as a large capacitor or a pull-up resistor? Also, as suggested in the other post, is there a suitable capacitor on the VCAP pin? Is the power stable? Do the powerline(s) have good decoupling capacitors?

VCAP is having 1uF capacitor. I tried with laptop power supply via the programmer, also tried by giving separate power to the chip. Both having similar results.

Everything was working good, and I programmed few times without any issues. Suddenly it stopped working. I even tried using a different hardware, same results.

But working fine if I try with a different chip.

And nothing strange on the NRST line? Well, then it looks like you need a new microcontroller....

I have a 10K pull up and 0.1uF capacitor a NRST line. Will it cause any issues ?

Everything was working fine and I have programmed it atleast 15 times without any issues. It stopped working suddenly. Then I tried in another clone of the same target board. That also showed the same issues. This makes me think that it is not a microcontroller related issue.

My STLINK is working fine, I tested it in a different board which using another STM8 chip.

And more over, Option Bytes and Data Memory write is working fine. Program memory read is working fine but write is failing.

What I would do is, first remove (if possible) the 0.1uF capacitor and try again. And second, take a look at the signals on the lines from the STLink with an oscilloscope, both with devices that work and the one that doesn't. If they all look exactly the same and the microcontroller still didn't work, I would probably hang it on my "wall of shame" next to the other devices I murdered.

OK, Thanks for your suggestions. I will try by removing 0.1uF in the NRST line.

Currently I am using a 1uF electrolytic capacitor for Vcap, I think I should try with a ceramic capacitor.