cancel
Showing results for 
Search instead for 
Did you mean: 

STM8S005K6 SWIM PROG error [42004]: Memory write error

LGeor.2
Associate II

Program memory write stopped working for me. I tried with two STM8S005K6 chips. And everything works fine if I use some other STM8 chip.

Getting below error when trying using STVP.

Error : Programming failed

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

Error : < PROGRAM MEMORY programming failed.

And below error when trying through IAR compiler.

Sun Apr 04, 2021 14:16:28: Failed to write chunk with size 1024 at address 0x8480: SWIM PROG error [42004]: Memory write error 

DATA MEMORY and OPTION BYTE write is working perfectly. PROGRAM MEMORY read is working but NOT WRITE.

This discussion is locked. Please start a new topic to ask your question.
10 REPLIES 10
RAhuj.11
Associate II

Have you connected any capacitor at VCAP pin? Try the same and reprogram.

Yes, I do have 0.1uF.

LGeor.2
Associate II

OH looks like I need to use 1uF.

did that solve your problem?

I don't have 1uF with me now. I will test it later and update.

LGeor.2
Associate II

I tried connecting 1uF capacitor, but it doesn't solve the problem.

RAhuj.11
Associate II

Check the datasheet/programming manual of the device, where the suitable value for the VCAP is given.

I am using below circuit with my STM8S105C6 device. VCAP 680nF (recommended 480nF to 3300nF) and I am able to program it a couple to times.

Currently I am also facing same issue. Once it gets programmed, I can reprogram it multiple times but as I remove and reconnect the ST-Link, it is throwing same error.

Still trying to figure out what's wrong here. :\ :(

0693W000008yfs6QAA.png

LGeor.2
Associate II

For me it is not worked after that. I have 2 target boards. Both was working fine on the first day and I programmed continuously atleast 15 times without any problems. After that this problem happened and never worked after that. The 2nd board also stopped working at the same time.

I tried replacing the 0.1uF Vcap to 1uF, that also didn't worked. Below are my next steps.

  1. Try with 1uF ceramic capacitor (currently I tried with electrolytic capacitor).
  2. Try with 680nF and other values ceramic capacitors.
  3. Remove the 0.1uF capacitor in the NRST line.

LGeor.2
Associate II

I tried these, it is not solving the issue. For me it is working sometimes. Like out of 20 times it will work once.