Topic : STM8S103 Flash won't program with STM8_pgm

Forum : ST7/STM8

Original Post
Post Information Post
December 31, 2009 - 10:50pm
Guest

This is my first time to the board, but I have already read through all of the posts and haven't been able to find anything that would help solve my problem. I am trying to program some STM8S103F3 microcontrollers through the command line using STM8_pgm. I try and program the chip and it gets to the point where it says it is programming, a GUI comes up and the progress bar goes about 1/4 of the way, then it stalls, and said "!!!Error 603: Error reported by the device." I have no idea what to do. I can program the microcontrollers fine with STVP, and I even tried programming a chip with STVP, then doing a memory dump with STM8_pgm. That works fine, but when I immediatly try to reprogram with that dump file through the STM8_pgm, I get the same problem as I described above. It also won't erase the flash or EEPROM, but gives me the same Error 603 message. Any help would be greatly appreciated, thank you.

Replies
Post Information Post
+1
0
-1
January 1, 2010 - 1:09am
Guest

So after further investigation, I have a few more details. I have gotten the STM8_pgm program to do all of the erases and program the flash, but only when no program is currently running on the microprocesor. If I completely erase the flash (using STVP), then I can program with the STM8_pgm. It does not matter to to STVP if there is a program currently running. Is there any way that I can fix this so that I don't have to erase the memory using STVP so I can program it with STM8_pgm?

+1
0
-1
January 4, 2010 - 10:23am
Raisonance Support Team

Hi,

First, please make sure that you are using the latest versions of the Ride7 and RKit-STM8 software kits. (software on CDs is often obsolete by the time you receive it)

Then, if the problem is sill there, please try to program the device using one of the toggle examples from Ride (or any "while(1);" application without any config) and see if the problem appears. That will tell us if the problem is related with something in your application. In this case, we will need your application's hex file for further investigation. If not, then we will need your board's schematic for investigation.

Best Regards,

Vincent

+1
0
-1
January 4, 2010 - 5:15pm
Guest

Vincent,
Thank you for your reply. I checked my Ride7 and STM8 RKit versions and they are the same versions that are available for download from the website. I also have the patch for the STM8 RKit installed. I created a program that is nothing but a while(1) loop in the main, and I still get the same behavior as above. The only difference is that now when I try to program a second time, I get the message "!!! Error 102: No response from the DTC." As for the layout of the SWIM circuit, I just have a 1uF cap on the RESET line, and two 1uF caps on the 5V. There are no components on the SWIM line. Any more help you could give would be great. It just seems odd that STVP doesn't have a problem, but STM8_pgm does. Thanks!

+1
0
-1
January 4, 2010 - 6:15pm
Raisonance Support Team

Hi,

For sure if it works with STVP, it should be able to work with the other software. (you are talking about STVP+RLink, right?) However, there might be a bug in Ride and RFlasher that only appears under certain circumstances, and these circumstances might be related to the hardware. This is why we must also look at the board, especially because we don't see the problem here even though we are using the same software as you are.

Typically, a bigger capacitor on reset can cause a problem if some software timeout is not large enough. Can you please try to remove the 1uF capacitor and tell me if it makes a difference?

Please also give me the reference of the patch you are referring to. I need to be 100% sure that we are using exactly the same software. (several patches were issued for the latest STM8 kit...)

Finally, please give me the complete command-line that you are using to invoke STM8_pgm.
Have you tried to erase, blank-check and program using three different calls to STM8_pgm?
That would tell us which part of the process is failing.

Best Regards,

Vincent

+1
0
-1
January 4, 2010 - 9:16pm
Guest

Hi,
I removed the 1uF capacitor and it did not make any difference to the entire process. As for the patch that I have installed, it is just listed as RKit-STM8_2.26.9.0317_Patch and the readme.txt file that came with it lists the date as 2009/11/25.
I have tried many different combinations of the command line prompts, including doing the erasing and programming seperatly. Here are my complete results:

stm8s_pgm TSTM8S103F3 B ------> Error 102: No response from the DTC
stm8s_pgm TSTM8S103F3 EF ------> Error 603: Error reported by the device
stm8s_pgm TSTM8S103F3 EE ------> Error 102: No response from the DTC
stm8s_pgm TSTM8S103F3 EO ------> Error 102: No response from the DTC
stm8s_pgm TSTM8S103F3 Pwhile_test.hex ------> Error 102: No response from the DTC

I repeated these steps several times and got the same results every time.
After I erased the memory using STVP, I tried again and got these results:

stm8s_pgm TSTM8S103F3 B ------> Completed Successfully. (Flash IS blank.)
stm8s_pgm TSTM8S103F3 EF ------> Completed Successfully
stm8s_pgm TSTM8S103F3 EE ------> Completed Successfully
stm8s_pgm TSTM8S103F3 EO ------> Completed Successfully
stm8s_pgm TSTM8S103F3 Pwhile_test.hex ------> Completed Successfully

Thanks for your help!

+1
0
-1
January 5, 2010 - 10:48am
Raisonance Support Team

Hi,

This is a very strange problem. Right now I cannot imagine how this situation might happen.

Do you have another PC to try? The problem might be due to a conflict between Ride and STVP.

Can you please send me the 'while' project?
zip the whole folder, with sources, includes, listings, objects, hex files, etc. and send it to 'suport@raisonance.com'

The board should be inquired too.
Do you have a commercial demo board from Raisonance or ST to try?
What voltage is your STM8 powered at?
Which version of the RLink-SWIM adapter are you using?
How did you set the jumpers on it?
Can you send the schematic of the board to us?

Best Regards,

Vincent

+1
0
-1
January 5, 2010 - 10:51am
Raisonance Support Team

Please also confirm that the dump of the memory using STM8_pgm is correct when the device is programmed.

+1
0
-1
January 5, 2010 - 4:19pm
Guest

I don't have another PC I can try at this very moment, but I might be able to later. I just sent you an email with the "while_test" project, as well as a schematic of the board that I am trying to program. For this board the STM8 is powered by 5V. The marking on the back of the RLink-SWIM adapter has printed "RLink-ADP-ST7-STM8-V1.2" I have jumpers set on the "SWIM" and "Adapt" pins. I will post shortly about whether or not the dump is correct. Thanks!

+1
0
-1
January 5, 2010 - 4:27pm
Guest

Hi,
So I just tried the dump test and using my largest ~5 Kbyte project I got an identical dump to what I am programming the microcontroller with, so it appears that the dump is working correctly adn it is correctly accessing teh onboard flash. Thanks!

+1
0
-1
January 6, 2010 - 2:03am
Guest

I just put all of the ride7 and RKit-STM8 Software on another computer that does not have any of the ST development and programming tools on it, and I got the same results on that computer as I did on my own. I hope that helps as well.

+1
0
-1
January 6, 2010 - 11:50am
Raisonance Support Team

Hi,

Thanks for the information.

I have tried your files and observed no problem for programming and reprogramming them.

I have looked at your schematic and saw nothing that can explain the problems you experience.

But at last here is some interesting information: I observed exactly what you describe when I disconnected the RESET signal from the RLink to the STM8. I was able to blank-check and program when the device was blank, but after programming I could not do anything except read the Die Id...

Please make sure that your connection of the reset line is not broken or disconnected. Please also check with an oscilloscope that the reset signal is going down for some time when you launch some programming operations. If the connection is OK but the signal does not go down, then maybe your adapter is damaged. Please look at its schematic here:
ftp://www.raisonance.com/pub/forum/RLink_ADPs/ADP_ST7_STM8.pdf
I would suspect that Q3 might be burned. Can you inspect or replace it? Since you are working at 5V, you could even replace it by a simple wire: unsolder Q3, solder a wire between its pins 2 and 3, leave its pin1 unconnected.

Finally, I suggest you remove the ADAPT jumper, as it is only required for voltages under 3V and can overload the power for voltages higher than 3.5V. That might also explain the problem, depending on your power supply. (quite unlikely but not impossible)

Best Regards,

Vincent

+1
0
-1
January 6, 2010 - 11:52am
Raisonance Support Team

Hi,

I tried STVP when reset is not connected and it works.

Maybe it uses a different initialization process that does not require the reset line in some cases. But anyways that cannot work in all cases (with applications that disable SWIM for example), so a software workaround like that would not be a satisfactory solution and we will not implement it in the Raisonance software. The reset line must be connected as specified in the SWIM protocol spec, so that the RLink can tie it low. This is not optional.

Best Regards,

Vincent

+1
0
-1
January 6, 2010 - 5:36pm
Guest

Hi,
I believe we have solved the problem! So your mention of the reset line got me thinking, and I have had mine disconnected for some time now because whenever I had it connected neither STVP or stm8_pgm would program the microprocessor but would say there was a power problem.I reconnected the reset and was still getting the same problem. Just a few days ago we got in several new RLink programmers, so I figured I would swap out the adapter to see if it made a difference, and now stm8_pgm works great. I can program, erase, and program again without a problem. I'm not sure if it is that my Ver. 1.2 adapter is broken, or whether there is a fix in the new adapter which is Ver 2.1. Thank you so much for all of your help, you have been great!

+1
0
-1
January 6, 2010 - 6:26pm
Raisonance Support Team

Hi,

I'm glad to hear that you solved your problem. Thank you for your patience and detailed reporting.

I don't think that the design of the ADP v1.2 is faulty, because this is the version that I used.
I'd rather think that your ADP is damaged. If you want to investigate it, please first give me the exact error message that you receive when you try to use it with the reset line connected. (using STM8_pgm)

Best Regards,

Vincent