0
votes

while i was using cubemx to set peripherals of my stm32f407 arm core, just before generating code, i checked and selected the "set all free pins as analog (to optimize the power consumption)" dialog box in project settings-> code generator-> HAL settings, without masking the debug pins (swdio and swclk). After that, i downloaded a simple blinky code inside the microcontroller successfully using keil ide. but now when i want to use keil to erase or download a code, i see "no target connected" error in debug tab and i cant download any code. How can i solve this problem? Thanks for your helps.

2
is this your board design or an off the shelf board, etc? there should be a way to change the boot0 pin, often a button or jumper. this will take an alternate boot path into their bootloader then you can come in from swd or uart or usb or whatever and try again.old_timer
Thanks for your answer. yes you were right. but i,m kind of rookie in this field and i dont know how to use uart and other facilities like that yet. but anyway thank you again for giving your time.Alex Maxwell
The stlink connect under reset sounds debugger specific, I wouldnt rely on it the boot0 pin is something you can rely on and something you should put on all your board designs. If on a chip other than an stm32 then you want to design something like that into your firmware, usually it is clock init that kills you but if you mess up the gpio then it can be game over as well. Granted there is this new chip chicken and egg problem of learning the gpio without wiping out debug/field programming access.old_timer
Some of the AVR designs and other chips program while in reset easily solving this problem the ARM vendors so far have tended to have arm software based bootloaders or rely on swd which doesnt work that way, rather than develop the logic. basically they use what came with it rather than make something new so you need to protect yourself. Another way to do that is I always buy at least two of something new to me in case I brick one right away I can try to keep going with the other one while I wait for more to come.old_timer

2 Answers

0
votes

After about 10 hours searching, i found the solution. if someone had the same problem, here is the solution :

https://electronics.stackexchange.com/questions/204996/stm32-st-link-cannot-connect-to-mcu-after-successful-programming

0
votes

As an addition to your answer - when you set all as analog, set in the SYS the correct debug interface. It will prevent code generator from setting those pins as analog.

enter image description here