diff --git a/nanoFirmwareFlasher/StmJtagDevice.cs b/nanoFirmwareFlasher/StmJtagDevice.cs index caf32446..fb831613 100644 --- a/nanoFirmwareFlasher/StmJtagDevice.cs +++ b/nanoFirmwareFlasher/StmJtagDevice.cs @@ -10,6 +10,7 @@ using System.Linq; using System.Text; using System.Text.RegularExpressions; +using System.Threading; namespace nanoFramework.Tools.FirmwareFlasher { @@ -100,6 +101,9 @@ public ExitCodes FlashHexFiles(IList files) return ExitCodes.E5003; } + // need a couple of seconds before issuing next command + Thread.Sleep(2000); + // try to connect to device with RESET var cliOutput = RunSTM32ProgrammerCLI($"-c port=SWD sn={DeviceId} mode=NORMAL"); @@ -229,8 +233,11 @@ public ExitCodes FlashBinFiles(IList files, IList addresses) } } + // need a couple of seconds before issuing next command + Thread.Sleep(2000); + // try to connect to device with RESET - var cliOutput = RunSTM32ProgrammerCLI($"-c port=SWD sn={DeviceId} mode=UR"); + var cliOutput = RunSTM32ProgrammerCLI($"-c port=SWD sn={DeviceId} mode=NORMAL"); if (!cliOutput.Contains("Connected via SWD.")) {