cancel
Showing results for 
Search instead for 
Did you mean: 

STM8S001J3 SWIM pin setting

Sang hyeon Jeong
Associate II
Posted on November 28, 2017 at 10:01

Hi.

I have a problem using STM8S001J3.

The program can not be downloaded because the SWIM pin is set to output.

Is there a way to revert the settings?

I am using STVD and IAR for program development.

#stm8 #stm8s
3 REPLIES 3
Szymon PANECKI
Senior III
Posted on November 28, 2017 at 13:12

Hello Sang hyeon Jeong,

Once SWIM pin is configured as output, it is no longer possible to establish SWIM communication with MCU.

Default state of SWIM pin is remained when STM8 device is in reset state. As a result it is still possible to use SWIM when MCU is in reset state by controling reset pin. Unfortuantely for STM8S001 you can't use this solution, because there is no reset pin.

In your case there is still a very short time when STM8S001 has active SWIM pin. This is during POR (Power On Reset) and also for a short while during code execution, until application reconfigures SWIM pin to output. But this time slot is very short. So the only solution, which teoretically could help here is a custom SWIM programmer, which would keep sending SWIM initial sentence to STM8S001 starting from the moment, when supply voltage is attached to MCU. This would probably allow MCU to receive a SWIM command in moment of time, when SWIM is active.

To avoid this problem in future I would propose using one of the two solutions listed below:

1. To add few seconds of delay as a first code executed by MCU. This is recommended by our documentation.

2. To implement simple UART communication in a way that after receiving specific pattern of UART data MCU will reconfigure SWIM pin back to its original configuration.

Regards

Szymon
Posted on November 29, 2017 at 01:56

Thank you for answer.

Do you mean that once you receive a specific pattern of UART data, you can communicate with SWIM again?

So what is the specific pattern of UART data?

Posted on November 29, 2017 at 04:34

Hi,

Yes, I mean this solution, but please note that it is just a hint. So there is no firmware inside MCU, which implements it.The code has to be added by user in his application. 

Regards

Szymon