Showing results for 
Search instead for 
Did you mean: 

STM8L050J3 Bug?


I am experiencing a serious problem with STM8L050J3.

Due to an unused pin configuration of port A (PA1..PA7) then excluding PA0 used as SWIM, in order to check for any difference in current consumption, I have configured Port A with the following command:

GPIO_Init(GPIOA, GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7, GPIO_Mode_Out_PP_Low_Slow);

As a result, the firmware uploaded now does not run, and it is no longer possible to access it with ST-LINK V2, neither for debugging nor for programming.

Since the RESET pin is missing on this micro, there is no way to reset this situation and recover the functionality of the micro, which is otherwise no longer usable.

Any suggestions for solving this?

Thank you for your attention.

Translated with (free version)


Hi Sisto,

I assume that your new circuit (with an STM8L051F3P6) uses the 38kHz LSI as the RTC clock (the WUT is a bit easier to use). In Active Halt mode the current consumption should be much lower.

I've never used the STVD or the Cosmic compiler (my projects are all based on the SDCC tool chain). STM8 eForth gives the programmer full control of the chip, for the better or the worse (i.e., you know what you're doing, and there is no one else to blame).

Communicating with an STM8L chip through the serial interface uses a few tricks, e.g., waking up from Active Halt with an external interrupt from the pin that's configured as USART_RxD. That way it's possible to reconfigure GPIOs by interactive command entry.

If you're interested, setting up a test system isn't hard. It's easiest using Linux - but programming the Forth system to the chip any serial terminal with a standard "TTL" serial interface will be sufficient for an interactive session. You'll find a binary here ( and some guidance for the STM8L051F3P6 here. An introduction to using Forth on the STM8 is here.