Page 1 of 1

in circuit programming of ST micro using swim

Posted: Wed Jan 22, 2020 1:47 pm
by gavin mack
Hi

As part of a test rig circuit I'm doing using flowcode 8 and a PIC micro has any one done, or can suggest best way to achieve the following reliably.
programming a ST micro (STM8) using the SWIM protocol an 8K hex file stored on an SD card (or other storage).
On previous test rigs I used an external laptop and ST-LINK programmer but I want to eliminate this.

Below are several methods, I'm sure there are more
1.) a USB interface to external programmer such as ST-LINK,
2.) directly programming using SWIM pins connected directly to the pic.
3.) program using SPI interface from this website http://kuku.eu.org/?projects/stm8spi/st ... _toc_head6

Re: in circuit programming of ST micro using swim

Posted: Wed Jan 22, 2020 1:59 pm
by Benj
Hello,

It sounds possible. I do something similar on the EB2 BL0061 board to program the on-board ST-ARM using it's built in bootloader.

If you look at the EB2 datasheet then the schematic for the board is included there. I connect to the chip using SPI and also via UART for backup. The programming is currently done using the UART connection plus a few of the IO.

Changing the source so that it comes from a file on an SD card rather than steamed via USB should be possible.

Here are my firmware files I created to facilitate programming the ST32 device, hopefully they are useful for you.
stm32prog.c
(5.46 KiB) Downloaded 200 times
stm32prog.h
(2.93 KiB) Downloaded 211 times
If you need more then I can maybe help but I might have to share files in private to avoid loosing EB2 IP.

I've not done ST8 so not sure how compatible these are. Probably not at all :cry:

Re: in circuit programming of ST micro using swim

Posted: Wed Jan 22, 2020 2:34 pm
by gavin mack
Hi Ben

thanks for that, unfortunately any stm8 less than 16Kb does not have the ST bootloader. this means a user bootloader has to be written and programmed in somehow before spi programming can be used. we are using an 8K STM8