2014-09-22 08:44 AM
Hi,
I was working with Keil+ulinkpro on a custom board using an stm32f217 and everything was fine. I start working on some automated script for inital setup for our product using openocd. Somehow, it rendered the chip unresponsive. I am now unable to write/read with openocd and with keil/ulinkpro. I can see the SW device in the keil debugging tab.... I was wondering if there is a way to reset the MCU to it's initial state?Regards,Mart2014-09-22 08:50 AM
You can reset it with BOOT0 High, and then erase it. Still things like OTP, and protection options can be irreversible.
2014-09-22 09:20 AM
where is two ways to make mcu unresponsive.
1) incorrect PLL settings, so if you have 25MHz clk, and you state that HSE is 8MHz, it will lock up ( just had this problem, shorted clk, and reprogrammed) 2) you programmed SWD pins as GPIO, (PA13-PA14), in that case you must connect under reset, and leave GPIOA 13-14 pins alone2014-09-22 09:55 AM
Turning the power off will also break the interface. WFI and DMA can also cause problems.
2014-09-22 10:29 AM
how do I erase? Using the ulinkpro doesnt seems to work so far...
2014-09-22 10:43 AM
In Keil uv4 : Flash -> Erase (with a projected loaded will perform Full Chip Erase)
The BOOT0 High trick will get the chip into System Loader mode, which is a safe harbour if user code is running errant. There's things like ST-LINK Utilities for the ST-LINK pods, the ULINKPro doesn't have any stand-alone tools2014-09-22 11:12 AM
That is exactly what I did for the erase. it took like one second and output ''Full Chip Erase Done''.. yeah right... I am still unable to program.... very strange...
2014-09-22 12:05 PM
Yeah, not much to work with there. Any messages or anything?
Program something simple. Use Flash -> Download, and make sure you have suitable ''Load Application'', ''Update Target'', ''Download to Flash'', ''Verify Code Download'' options.2014-09-23 01:19 AM
Hi
As clive1 said - not much to go on there. ''I was working with Keil+ulinkpro on a custom board using an stm32f217'' Have any of the JTAG/SWD pins been used for anything (IO or other alternate function)? Has the BOOT0 pin been used for anything ?2014-09-24 12:30 PM
well I switched back to my STM3221G-EVAL board. Knowing that I have a proper tool (ST-LINK and ST-LINK utility) to save my ass. After numerous run of the code, the keil IDE was unable to erase and flash again. I fired up the ST-LINK utility and discovered that the Readout Protection was now set to 1. All I am doing is:
HAL_FLASH_Unlock();HAL_FLASHEx_Erase();HAL_FLASH_Program()HAL_FLASH_Lock();I started to play with the Write protection of the flash today but I do believe this is completely separate from the ReadOut Protection stuff...Mart