Skip to content

Commit aeb88b6

Browse files
author
QuantAsylum
committed
Release 1.77
Signed-off-by: QuantAsylum <git@quantasylum.com>
1 parent 75974ee commit aeb88b6

File tree

5 files changed

+33
-23
lines changed

5 files changed

+33
-23
lines changed

Application/QA350/QA350/Bootloader.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ static public void EnterBootloader(FlashStatusCallback statusUpdate)
7070
}
7171

7272
// Tell the device to enter BSL if we're already connected
73-
if (Hardware.IsConnected && Hardware.USBSendData(new byte[] { 0xFF, 0x00 }))
73+
if (Hardware.IsConnected)
7474
{
75-
Thread.Sleep(4000);
75+
Hardware.EnterBSL();
7676
}
7777

7878
// Now reconnect with BL. Do not enter this section of code if
@@ -81,7 +81,6 @@ static public void EnterBootloader(FlashStatusCallback statusUpdate)
8181
try
8282
{
8383
Hardware.OpenBSL();
84-
Thread.Sleep(1000);
8584

8685
SubmitPassword(); // This might fail and perform mass erase
8786
SubmitPassword(); // This will always succeed and perform mass erase
@@ -93,9 +92,8 @@ static public void EnterBootloader(FlashStatusCallback statusUpdate)
9392

9493
// Run ram-based BSL
9594
SetPC(0x2504);
96-
Thread.Sleep(4000);
97-
Hardware.OpenBSL();
9895
Thread.Sleep(1000);
96+
Hardware.OpenBSL();
9997
Debug.WriteLine("BSL Version: " + GetBSLVersion().ToString("X"));
10098

10199
// Erase everything

Application/QA350/QA350/Constants.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class Constants
1212
static public string CalibrationFile = DataFilePath + "CalibrationData.xml";
1313
static public string SettingsFile = DataFilePath + "QA350Settings.xml";
1414

15-
static public double Version = 1.76;
15+
static public double Version = 1.77;
1616

1717
static public Int32 RequiredFwVersion = 12;
1818
}

Application/QA350/QA350/Form1.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ private void reflashToolStripMenuItem_Click(object sender, EventArgs e)
784784
LEDKickerTimer.Enabled = false;
785785
SetUsbStatus("Reflashing...");
786786

787-
if (MessageBox.Show("You are about to reflash the firmware. If you proceed, it will take 3-4 minutes wihtout any updates until the end. Proceed?", "Important!", MessageBoxButtons.OKCancel) != DialogResult.OK)
787+
if (MessageBox.Show("You are about to reflash the firmware. If you proceed, it will take 3-4 minutes without any updates until the end. Proceed?", "Important!", MessageBoxButtons.OKCancel) != DialogResult.OK)
788788
{
789789
LEDKickerTimer.Enabled = true;
790790
AcqTimer.Enabled = true;
@@ -793,8 +793,6 @@ private void reflashToolStripMenuItem_Click(object sender, EventArgs e)
793793

794794
AcqTimer.Enabled = false;
795795
LEDKickerTimer.Enabled = false;
796-
Hardware.EnterBSL();
797-
Thread.Sleep(2000);
798796
Bootloader.EnterBootloader(FlashStatusUpdate);
799797

800798
MessageBox.Show("Restart the application and replug the hardware");
@@ -810,6 +808,8 @@ private void reflashToolStripMenuItem_Click(object sender, EventArgs e)
810808
private void flashVirginDeviceToolStripMenuItem_Click(object sender, EventArgs e)
811809
{
812810
Bootloader.EnterBootloader(FlashStatusUpdate);
811+
MessageBox.Show("Restart the application and replug the hardware");
812+
Close();
813813
}
814814

815815
/// <summary>

Application/QA350/QA350/Hardware.cs

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ static class Hardware
3434
/// </summary>
3535
static HidDevice Msp430;
3636

37-
static int timeout = 50;
37+
static int Timeout = 50;
3838

3939
static public bool IsConnected = false;
4040

@@ -52,7 +52,7 @@ static public bool Open()
5252
// See if we can see the USB ID of this product
5353
Msp430 = HidDevices.Enumerate(0x2047, 0x0301).FirstOrDefault();
5454

55-
timeout = 50;
55+
Timeout = 50;
5656

5757
if (Msp430 != null)
5858
{
@@ -74,18 +74,27 @@ static public bool Open()
7474
/// that the product ID differs when in bootloader mode
7575
/// </summary>
7676
/// <returns></returns>
77-
static public bool OpenBSL()
77+
static public bool OpenBSL(int secondsToTry = 15)
7878
{
79-
// See if we can see the USB ID of this product
80-
Msp430 = HidDevices.Enumerate(0x2047, 0x200).FirstOrDefault();
81-
timeout = 8000;
79+
DateTime start = DateTime.Now;
8280

83-
if (Msp430 != null)
81+
while (DateTime.Now.Subtract(start).TotalSeconds < secondsToTry)
8482
{
85-
// Device ID is connected. Open it.
86-
Msp430.OpenDevice();
87-
IsConnected = true;
88-
return true;
83+
// See if we can see the USB ID of this product
84+
Msp430 = HidDevices.Enumerate(0x2047, 0x200).FirstOrDefault();
85+
Timeout = 8000;
86+
87+
if (Msp430 != null)
88+
{
89+
// Device ID is connected. Open it.
90+
Msp430.OpenDevice();
91+
IsConnected = true;
92+
Thread.Sleep(1000);
93+
return true;
94+
}
95+
96+
Thread.Sleep(1000);
97+
Debug.WriteLine("Looping in OpenBsl");
8998
}
9099

91100
// Device ID wasn't connected. No need to try and open
@@ -347,7 +356,7 @@ static public bool USBSendData(byte[] data)
347356

348357
Array.Copy(data, 0, frame, 2, data.Length);
349358

350-
bool retVal = Msp430.FastWrite(frame, timeout);
359+
bool retVal = Msp430.FastWrite(frame, Timeout);
351360
return retVal;
352361

353362
}
@@ -368,7 +377,7 @@ static public bool USBRecvData(out byte[] buffer)
368377
{
369378
buffer = new byte[0];
370379

371-
HidDeviceData hdd = Msp430.FastRead(timeout);
380+
HidDeviceData hdd = Msp430.FastRead(Timeout);
372381

373382
if (hdd != null)
374383
{

Application/QA350/QA350/Releases.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
1.76 (May 2019)
1+
1.77 (June 2019)
2+
- Increased USB timeout period
3+
4+
1.76 (May 2019)
25
- Added QA350 CPU temp display in status bar and logging. Temp accuracy will bounce around +/- 1 degree
36
- Firmware version must match release, otherwise a reminder is shown at launch
47
- This requires FW release 12

0 commit comments

Comments
 (0)