EEVblog Electronics Community Forum

Electronics => Beginners => Topic started by: Vindhyachal.takniki on November 08, 2014, 10:37:17 am

Title: STM8 SWIM pin as output/Debug
Post by: Vindhyachal.takniki on November 08, 2014, 10:37:17 am
1. I have STM8S003F3 & want to use its debug pin as output.
So I will configure it my code.

2. Will that make debug option dead?
On next power up, will I be able to debug the code?? Because pin will already be configured as output by that time
Title: Re: STM8 SWIM pin as output/Debug
Post by: HackedFridgeMagnet on November 08, 2014, 11:15:16 am
I haven't used 8bit swim but use the swd for the stm32 range. So I haven't read the datasheet.
you should be able to intercept the chip on boot to debug it.
but you will need to debug it without the pin being used as a gpio.
wrap the pins initialisation in

#ifndef debug
 // set pin as output.
#endif

obviously while in debug mode you cant use this pin as normal gpio, but this way you can debug the rest of your code and hardware.
Title: Re: STM8 SWIM pin as output/Debug
Post by: Kjelt on November 08, 2014, 01:53:57 pm
For SWIM debugging no, you need to continuously keep communicating to the device so you can not configure it during debugging as a hard output for instance.
For final product, it also is kinda tricky so I never do this but it should be possible.
The problem I encountered in the past was that the SWIM signal is high frequency (order of 10MHz) so for instance a small capacitance on that pin can already inhibit the use of SWIM programming/debugging.
So my advice is to breadboard your design first and do a lot of testing before putting it in a real product. For hobby purposes you can always make a jumper or small switch.
Title: Re: STM8 SWIM pin as output/Debug
Post by: Vindhyachal.takniki on November 19, 2014, 05:20:29 am
I checked it & working.
But for now, in professional boards I won't use SWIM pin