AnsweredAssumed Answered

STM8S103F3 can't be programmed anymore

Question asked by gustamko.master on Jan 18, 2017
Latest reply on Feb 22, 2017 by NC.Thuan

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:

 

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

Outcomes