I'm using a Arduino nano and am trying to upload a .hex file to the Arduino using the ArduinoUploader Package through a C# interface. And I run into the error:
Unable to aqcuire sync in SendWithSyncRetry for request of type ArduinoUploader.BootloaderProgrammers.Protocols.STK500v1.Messages.ReadSignatureRequest!
Code:
static SerialPort _serialPort = null!;
static void ResetArduino(string portName)
{
_serialPort = new SerialPort(portName, 1200);
using (_serialPort)
{
_serialPort.Open();
_serialPort.Close();
}
System.Threading.Thread.Sleep(5000);
}
static void Main(string[] args)
{
try
{
ResetArduino("COM8");
var uploader = new ArduinoSketchUploader(
new ArduinoSketchUploaderOptions()
{
FileName = @"PATH_TO_HEX",
PortName = "COM8",
ArduinoModel = ArduinoModel.NanoR3
});
uploader.UploadSketch();
}
catch (ArduinoUploaderException ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
}