hi to all
i have stm32f103RB and i make program with STMCUBEMX and IAR .. the program is for test and it is led blinker . after i program it for first time it's Ok but it doesn't program again .. the stm is running correctly but i can't program it again .. it happen for 2 micro and i use both SWD and JTAG method .. and microcontroller pins are used are not same with programming pin ..
what's wrong with that?
There are two possible reasons:
1. Connection or h/w issue. Have no idea how you connected target board to debugger and how supplied.
2. You switched off both JTAG and SWD in s/w. In this case you can start mcu in boot0 mode (boot0 pin set high and reset). And then erase it.
There are some option bytes for the STM micro. Search in there for a write protection bit, in combination with the Global Read Out Protection (RDP) level. Check your program's configuration for those option bytes.
I don't think that the chip is fully protected, unless you still have problems downloading the code.
To protect a specific flash page, the FLASH_OB_EnableWRP() function will do the job. It's all in the stm32f0xx_flash.c file of the ST stdlib.