cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to program flash of STM8S105C6T8 using stlinkv2 although I can read the flash.

RKong.1
Associate II

I am unable to write to flash of STM8S105C6T8 although I can read the flash. I am using stlinkV2 via SWIM and stm8flash programming tool under ubuntu. I tried to reset option bytes to factory default and use the -u (unlock) option of stm8flash but both failed. I tried this on two boards (which I built); on one, the read out was all zero, and on the other one there seems to be something there. I had experienced something similar before and that problem was fixed by writing option bytes to default values. Can anyone help?

2 REPLIES 2
Philipp Krause
Senior II

The STM8S105?6 is a very common part (used on many evaluation boards), any problems with the toolchain would have been found long ago. I've used stm8flash with an stlinkv2 (both the original from ST and clones) for this part myself, and encountered no problems so far.

Are these new parts (you seem to suspect some issue with the option bytes - do you have reason to assume that they might have been set to something weird)?

Since you've build the boards: Is there something unusual in the power supply, the rest circuitry or on the SWIM pins?

Does it work for you for other STM8S105?6 on other boards?

RKong.1
Associate II

Thank you for taking time to answer my question. While three days ago I was having absolutely no success writing to the STM8S105, today, to my (happy) surprise, it worked(and as far as I am aware, I did not do anything differently)!

In answer to your questions, yes, it worked for me before on multiple boards that I have designed and assembled. Typically, I reserve the SWIM pin for programming the MCU. I mentioned in my post, there was an instance when the MCU on a freshly assembled PCB would not accept new firmware and after writing option bytes to factory default, things would work again. Also, as I noted, most of the ICs I have, although they appear to be brand-new, seem to have non-blank flash, and it is not random data either - I disassembled the code and looked at part of it, and it seems to make sense. Do you know if ST ships the ICs with flash erased?