cancel
Showing results for 
Search instead for 
Did you mean: 

STM8S103F3 can't be programmed anymore

loder
Associate II
Posted on January 18, 2017 at 20:59

Hi,

i use IAR EWSTM8 to debug and flash the STM8S103F3 controller which i have here on a small blue breakout board. Yesterday i flashed the Controller via the ST-Link V2 as always but instead of going into the debug menu, IAR gave me this on the console:

C-SPY Processor Descriptor V2.20.1.176 for STM8

C-SPY Debugger Driver, ST-LINK V2.20.1.176 for STM8

Failed to set configuration with MCU name STM8S103F3P: SWIM error [30006]: Comm init error: chip does not answer

The last code i successfully uploaded was this:

#include ''iostm8s103f3.h''

#pragma vector = TIM4_OVR_UIF_vector

__interrupt void TIM4_UPD_OVF_IRQHandler(void){

PC_ODR ^= (1<<4); //Toggle Pin

TIM4_SR &=~(1<<0); //Clear Update interrupt flag

}

void initTimer(){

CLK_PCKENR1 |= (1<<4); //Enable Clock for Timer 4

TIM4_PSCR = (0x0F); //Prescaler, Divide Clock by Max

TIM4_IER = 1; //Enable Update Interrupt

TIM4_CR1 |= 1; //Enable Timer

asm(''rim''); //Enable Interrupts

}

void initGPIO(){

PC_DDR |= (1<<4); //Set Pin as Output

PC_CR1 |= (1<<4); //Set Pin as PushPull

PC_ODR |= (1<<4); //Set to High

}

void main()

{

initTimer();

initGPIO();

CLK_CKDIVR = 0x08;

while(1){

;

}

}

I was told to pull the NRST-Pin of the board to GND while switching power on / off and then try again, but that didn't help. I also tried to flash via STVP but i got this error message:

0690X0000060623QAA.png

The last program i flashed works fine but putting a new program on the chip doesn't work

:(

Anyone here who has a solution / ideas to this problem?

Best regards
4 REPLIES 4
ahmad sina
Associate II
Posted on January 22, 2017 at 13:49

maybe your NRST pin was Pulled down by hardware

i have same problem in the past

or you have high Impedance

junction between VCC and GND

loder
Associate II
Posted on January 22, 2017 at 15:06

Hi and thanks alot for your answer,

maybe your NRST pin was Pulled down by hardware

What do you mean? Why should the board pull the NRST pin to GND from one moment to another? As i said i pulled the NRST pin to low (via a jumper wire) to mimic the SWIM-Initialization.

Could you explain in detail how you fixed the problem in the past, please?

Best regards
Posted on January 22, 2017 at 16:50

in my case the reset button was burn

so my MCU was reset Continuously

but in your case i dont know so much

i suggest you that put an amper meter before your supply and Measure the board amper

so you find that any part of you PCB is burn or not

Excuse me for my English

Thuan NC
Associate
Posted on February 22, 2017 at 08:31

Hi all, I have a similar problem with ST-Link V2 and IAR, but there are some diffirent things in my case. To be more specific, I use 4 wire of ST-link: RST, SWIM, GND and 5V for first case, 3.3V for second case.

In first case, when I use 5VDC line, I can load code and debug successfully, and everything is fine.

But, in second case, when I use 3.3VDC line to load code, IAR display the message '

Failed to set configuration with MCU name STM8S105C6: SWIM error [30006]: Comm init error: chip does not answer

'. And, if I use 5V to load code then I use 3.3V to supply power, STM8S105C6 still not work.

It seems that STM8S105C6 cannot operate at 3.3V, while datasheet show that it can work from 2.95V to 5.5V.

Anyone here who has ideas to this problem?

(

Excuse me for my English

)

Best regards