cancel
Showing results for 
Search instead for 
Did you mean: 

STM8S SWIM pin unused handling

ota-s
Associate II

Hello everyone.

I am in trouble with the SWIM pin of STM8S.

According to the data sheet, unused pins should be set to OUTPUT.

However, I would like to keep SWIM pins in a state where they are normally unused and can be debugged only when necessary.

How can this be achieved?

Thank you for your advice.

�?Postscript】

I supplement my questions.

UM0470 has the following description.

0690X0000098FTzQAM.png

Perhaps I think that I can switch between SWIM function and I / O function with a jumper, but I don't know the internal settings to achieve this.

In addition, when I / O is used, I want to apply unused-pin processing such as pull-up to the SWIM pin.

(In normal times, I / O is used to perform unused processing such as pull-up, and I want to be able to debug when there is an error.)

In summary, I have two questions.

・ How can I implement a specific method to switch between SWIM function and I / O as in the above example?

・ How to perform unused processing when SWIM is in I / O mode ?

Thank you.

4 REPLIES 4
CInge
Associate

we have the same problem. We are using STM8L050J3 and we need to include one delay of 5 secons in our program.

How can I erase program?

Cristian Gyorgy
Senior III

Hello Ota-s!

If you use the SWIM pin in your application, you will have to disable the SWIM interface from within the application. After it's disabled, only a MCU reset can re-enable the SWIM interface to do debugging (if you activate the SWIM interface before you disable it from within the aplication). So, it cannot do 2 functions at once.

And, if you don't use the SWIM pin, you don't have to set it as output, it has an active pull-up by default after reset.

Abedw.1
Associate

@Cristian Gyorgy​ You stated

"After it's disabled, only a MCU reset can re-enable the SWIM interface to do debugging"

Did you get this info from a datasheet? If so which one?

or

Is this from gained experience?

It's just that in our product we disable the swim pin as a safety precaution and enable the swim via CFG->GCR&=~(CFG_GCR_SWD); triggered via specific message through a uart interface. But this does not re-enable the swim and I cannot find any reference, apart from you comment, as to why.

Any info would be appreciated.

Cheers

Cristian Gyorgy
Senior III

If I remember well is was from experience, and then, searching for an explanation I found the activation sequence below. The one way arrows confirmed it for me.

Not sure if it applies to all SWIM revisions and devices.0693W000008GJxfQAG.png