Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows] Added flashing support for Artery AT32 DFU #481

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ This is a collection of flashing tools packaged into one app. It supports auto-d

QMK Toolbox supports the following bootloaders:

- ARM DFU (APM32, Kiibohd, STM32, STM32duino) via [dfu-util](http://dfu-util.sourceforge.net/)
- ARM DFU (APM32, AT32, Kiibohd, STM32, STM32duino) via [dfu-util](http://dfu-util.sourceforge.net/)
- Atmel/LUFA/QMK DFU via [dfu-programmer](http://dfu-programmer.github.io/)
- Atmel SAM-BA (Massdrop) via [Massdrop Loader](https://github.com/massdrop/mdloader)
- BootloadHID (Atmel, PS2AVRGB) via [bootloadHID](https://www.obdev.at/products/vusb/bootloadhid.html)
Expand Down
2 changes: 1 addition & 1 deletion windows/QMK Toolbox/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private void MainWindow_Load(object sender, EventArgs e)

logTextBox.LogInfo($"QMK Toolbox {Application.ProductVersion} (https://qmk.fm/toolbox)");
logTextBox.LogInfo("Supported bootloaders:");
logTextBox.LogInfo(" - ARM DFU (APM32, Kiibohd, STM32, STM32duino) and RISC-V DFU (GD32V) via dfu-util (http://dfu-util.sourceforge.net/)");
logTextBox.LogInfo(" - ARM DFU (APM32, AT32, Kiibohd, STM32, STM32duino) and RISC-V DFU (GD32V) via dfu-util (http://dfu-util.sourceforge.net/)");
logTextBox.LogInfo(" - Atmel/LUFA/QMK DFU via dfu-programmer (http://dfu-programmer.github.io/)");
logTextBox.LogInfo(" - Atmel SAM-BA (Massdrop) via Massdrop Loader (https://github.com/massdrop/mdloader)");
logTextBox.LogInfo(" - BootloadHID (Atmel, PS2AVRGB) via bootloadHID (https://www.obdev.at/products/vusb/bootloadhid.html)");
Expand Down
1 change: 1 addition & 0 deletions windows/QMK Toolbox/Resources/drivers.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
winusb,STM32 Bootloader,0483,DF11,6d98a87f-4ecf-464d-89ed-8c684d857a75
winusb,APM32 Bootloader,314B,0106,9ff3cc31-6772-4a3f-a492-a80d91f7a853
winusb,WB32 Bootloader,342D,DFA0,89b0fdf0-3d22-4408-8393-32147ba508ce
winusb,AT32 Bootloader,2E3C,DF11,04e7a875-779e-4fd5-90c1-57a5644bfc42
winusb,GD32V Bootloader,28E9,0189,e1421fd6-f799-4b6c-97e6-39e87d37f858
winusb,STM32duino Bootloader,1EAF,0003,746915ec-99d8-4a90-a722-3c85ba31e4fe
libusbk,USBaspLoader,16C0,05DC,e69affdc-0ef0-427c-aefb-4e593c9d2724
Expand Down
30 changes: 30 additions & 0 deletions windows/QMK Toolbox/Usb/Bootloader/At32DfuDevice.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System.IO;
using System.Threading.Tasks;

namespace QMK_Toolbox.Usb.Bootloader
{
class At32DfuDevice : BootloaderDevice
{
public At32DfuDevice(UsbDevice d) : base(d)
{
Type = BootloaderType.At32Dfu;
Name = "AT32 DFU";
PreferredDriver = "WinUSB";
IsResettable = true;
}

public async override Task Flash(string mcu, string file)
{
if (Path.GetExtension(file)?.ToLower() == ".bin")
{
await RunProcessAsync("dfu-util.exe", $"-a 0 -d 2E3C:DF11 -s 0x08000000:leave -D \"{file}\"");
}
else
{
PrintMessage("Only firmware files in .bin format can be flashed with dfu-util!", MessageType.Error);
}
}

public async override Task Reset(string mcu) => await RunProcessAsync("dfu-util.exe", "-a 0 -d 2E3C:DF11 -s 0x08000000:leave");
}
}
1 change: 1 addition & 0 deletions windows/QMK Toolbox/Usb/Bootloader/BootloaderType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ public enum BootloaderType
Apm32Dfu,
AtmelDfu,
AtmelSamBa,
At32Dfu,
AvrIsp,
BootloadHid,
Caterina,
Expand Down
8 changes: 8 additions & 0 deletions windows/QMK Toolbox/Usb/UsbListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ private static IUsbDevice CreateDevice(ManagementBaseObject d)
return new AtmelDfuDevice(usbDevice);
case BootloaderType.AtmelSamBa:
return new AtmelSamBaDevice(usbDevice);
case BootloaderType.At32Dfu:
return new At32DfuDevice(usbDevice);
case BootloaderType.AvrIsp:
return new AvrIspDevice(usbDevice);
case BootloaderType.BootloadHid:
Expand Down Expand Up @@ -315,6 +317,12 @@ private static BootloaderType GetDeviceType(ushort vendorId, ushort productId, u
return BootloaderType.Wb32Dfu;
}
break;
case 0x2E3C: // Artery Technology Co. Ltd.
if (productId == 0xDF11)
{
return BootloaderType.At32Dfu;
}
break;
}

return BootloaderType.None;
Expand Down