cancel
Showing results for 
Search instead for 
Did you mean: 

SWIM interface code to run on STM32

ron
Associate
Posted on December 09, 2013 at 17:21

I have an application requiring the use of an STM32F107 to program a number of STM8S parts in-circuit, therefore I must implement the SWIM protocol on the STM32F107.  I have requested the source code for the SWIM driver in the STM32F103 part that is on the STM8 Value Line Discovery board, but ST has declined.

Has anyone implemented the SWIM protocol on and STM32 part (or any embedded microcontroller)?  Would you be willing to share the source code?

Thanks

#swim-stm8
4 REPLIES 4
chen
Associate II
Posted on December 12, 2013 at 12:28

Hi

Sort of - I am working on it.

No, I cannot share it. This is a commercial development I am working on so I cannot give away any of the source code, Sorry.

I can however give you hints on how to go about it.

The timing of the SWIM bits means it is impractical to try and bit bang it.

The timers inside the STM32 have a PWM mode which can be used to generate the 1/0 pulses.

I have not found it possible to use a single timer to do both write and read.

Our design uses 1 timer for write (set timer up as PWM output)

and another timer for read (set timer up for output compare)

I also had to make the SWIM driver work in a multi-tasking system (FreeRTOS) so the implementation is heavily built on the ISR and a state machine within the ISR.

zzdz2
Associate II
Posted on December 20, 2013 at 09:38

Look at 

http://www.versaloon.com/

I think it can do what you need.

Uwe Bonnes
Principal II
Posted on January 05, 2017 at 13:46

The versaloon website seems offline. At the moment, there is some effort on the OpenOCD list around SWIM. Join the discussion.

https://sourceforge.net/p/openocd/mailman/openocd-devel/?viewmonth=201701

 
qwer.asdf
Senior
Posted on January 09, 2017 at 15:42

FYI: the STlink programmers firmware encryption had been broken, so you could easily get the firmwares. If you are familiar with ASM you could quiclky get an overview how they implemented it.