vdudouyt / stm8flash

program your stm8 devices with SWIM/stlinkv(1,2)
GNU General Public License v2.0
401 stars 182 forks source link

Target is left in ICP mode after reading flash #153

Open allanwmacdonald opened 1 year ago

allanwmacdonald commented 1 year ago

I've been playing around with this tool with an STM8L101F3U on a little project board connected to an ST-LINK V2.

If I read a portion of memory, the target stops working. If I program the hex file again, the target starts to work.

The target board is powered with a power supply, not the ST-LINK V2 by itself.

If, after reading, I disconnect the power and the USB, and plug the power back in again, the target starts to work.

I browsed around the code and found the following code snippet:

if(pgm->reset) { // Restarting core (if applicable) pgm->reset(pgm); }

and if I add this snippet to the end of each of the read operations (lines 512 and 553 of main.c), the problem goes away.

Thank you for this wonderful project. I hope my comments will contribute to its success.

Cheers, Allan

schneidersoft commented 1 year ago

I suggest that there is an additional option added to allow the direct control of the reset line. in some workflows it is necessary to leave the device under reset after flashing is done. I can add/test this feature. can we align on the desired behavior?