Skip to content

Commit

Permalink
Improve flashing STM32 with JTAG (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
josesimoes authored Aug 16, 2021
1 parent 01ddab2 commit 2365aba
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion nanoFirmwareFlasher/StmJtagDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;

namespace nanoFramework.Tools.FirmwareFlasher
{
Expand Down Expand Up @@ -100,6 +101,9 @@ public ExitCodes FlashHexFiles(IList<string> 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");

Expand Down Expand Up @@ -229,8 +233,11 @@ public ExitCodes FlashBinFiles(IList<string> files, IList<string> 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."))
{
Expand Down

0 comments on commit 2365aba

Please sign in to comment.