GithubHelp home page GithubHelp logo

twinearthsoftware / arduinosketchuploader Goto Github PK

View Code? Open in Web Editor NEW
177.0 177.0 72.0 1009 KB

A .NET library and a command line utility to upload a compiled sketch (. HEX file) directly to an Arduino board.

License: MIT License

C# 100.00%

arduinosketchuploader's People

Contributors

andymac4182 avatar blahlicus avatar christophediericx avatar general-fault avatar jeremiepatron avatar sijk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arduinosketchuploader's Issues

Verification exception when uploading to Mega2560 board.

I am getting the exception: "Difference encountered during verification, write failed." When attempting to upload to a board with mega 2560. I am using .NET 4.5.2, and ArduinoUploader 3.1.

There are no expections if i upload firmware with avrdude and powerterminal, and then use Arduino Uploader with the same hex file. But if I try to upload the .hex file that is generated by Arduino ide a still get them problem.

Any clues?

Exception unhandled on arduino Uno

I am working on arduino Uno (not UnoR3) and developing a VB .Net windows form app.
It seems to upload the hex file but throwing an exception on uploader.UploadSketch()
Exception: Unable to aqcuire sync in SendWithSyncRetry for request of type ArduinoUploader.BootloaderProgrammers.Protocols.STK500v1.Messages.ReadSignatureRequest!
VB code:

    Dim options As New ArduinoSketchUploaderOptions
    options.ArduinoModel = ArduinoModel.UnoR3
    options.FileName = "C:\Users\nauma\AppData\Local\Temp\arduino_build_335470\LoadCell_MeasurementV1.0.ino.hex"
    options.PortName = "Com3"
    Dim uploader As New ArduinoSketchUploader(options)
    uploader.UploadSketch()

Is it because of

  1. Uno vs Uno R3
  2. C# vs VB .Net
  3. something else

and how to solve this?

Progress indicator

Hi,
Thank you for your ArduinoSketchUploader. It works perfect for my projects with ATmega1284p and ATmega328p. But is there a way to know the flashing progress?

Mono/Linux support, SerialPortStream DTR handshaking

I was trying to modify ArduinoSketchUploader to work with Mono/Linux but apparently a dependency (SerialPortStream) does not support DTR and DSR handshaking causing it to fail safely under Linux (the DTR not supported error is handled in SerialPortStream, so the application does not crash, it just logs a "DTRhandshaking not supported" message and does nothing), I was going to open an issue over at the SerialPortStream repo but figured I should get some info here first.

How would I go about porting ArduinoSketchUploader back to System.IO.Ports or is it possible to get ArduinoSketchUploader working without DTR?

I looked into SerialPortStream's source and saw that they use a helper native library (over here) in unix to work with the serial port, would it be the correct approach for me to plug another library with DTR support (such as this one) in place of their helper library to get DTR handshaking working?

How to 'postOpenResetBehavior' for Arduino UNO 3?

I am attempting to upload a sketch to a UNO R3 using a USB to TTL Serial Cable (https://www.adafruit.com/product/954). While this SketchUploader works GREAT with USB, I have to hit the reset button before running 'ArduinoSketchUploader.exe' to get the R3 into programming mode.

From 'https://arduino.stackexchange.com/questions/25/why-arduino-severino-s3v3-sometimes-needs-reseting-when-uploading-a-sketch' I believe I need to toggle the DTR, which I believe the USB cable is doing. How can I do that with 'postOpenResetBehavior'?

jtag2updi protocol

Is anybody able enough to write the bootloader protocol driver for jtag2updi so to add support for the Every boards 4809 and 4808?

Arduino Leonardo bricked

Hi, I've used your .NET library with a Leonardo board.
This is the code I used with no errors:

var uploader = new ArduinoSketchUploader(
    new ArduinoSketchUploaderOptions()
    {
        FileName = @"C:\Users\david\Desktop\Blink.ino.hex",
        PortName = "COM11",
        ArduinoModel = ArduinoModel.Leonardo
    });

uploader.UploadSketch();

Now I get my board undetectable in my Device Manager.
I've tried in another computer, another port, another cable without success.

Do you have any clue?

Best regards

Bad NuGet packaging for NLog dependency (v2.4.3)

Hello,

The NuGet NLog dependency is wrong in release 2.4.3, Nlog instead of NLog

Extract of ArduinoUploader.nuspec:
<dependency id="Nlog" version="4.0.0" />

Can you repackaging the NuGet package , please ?

Upload hex file using Visual Basic app

Hi
I'm trying to create VB application which will upload hex file using ArduinoSketchUploader NuGet.
Here is my code:

**Public Sub Sketch_Uploader(sender As Object, e As EventArgs)
        Dim folderPath As String
        folderPath = "C:\Users\Milosz\Desktop\"
        Dim fileName As String
        fileName = "blink.hex"
        Dim fullPath As String
        fullPath = My.Computer.FileSystem.CombinePath(folderPath, fileName)
        Dim uploader As ArduinoSketchUploader = Nothing
        Dim options As ArduinoSketchUploaderOptions = Nothing
        options.ArduinoModel = Hardware.ArduinoModel.UnoR3
        options.FileName = fullPath
        options.PortName = "COM3"
        uploader.UploadSketch()
End Sub**

Code is being compliled but nothig happens. Do you have some idea what can be wrong with it or maybe it is not possible to do it using VB and i have to switch to C#.
I would be very grateful for any help.

Pro Micro Leonardo

I have a slight problem trying to upload to a fresh sparkfun "pro Micro" if I set it as Lenoardo. It sees it starts programming and then gets stuck at 88%. And it bricks the pro Micro. I had to reburn the bootloader with a isp programmer. And I burnt a actual Lenoardo bootloader this time. And it uploads just fine. So I think there is a issue with the stock bootloader that's on the pro Micro from sparkfun. Is there a way to fix this?

Unable to aquire sync on UnoR3 that is writing to serial

If the loop is writing to the serial port, the upload fails with

Unable to aqcuire sync in SendWithSyncRetry for request of type ArduinoUploader.BootloaderProgrammers.Protocols.STK500v1.Messages.ReadSignatureRequest!

There is no problem if uploading to a board that has the default (empty) loop, or if uploading using the IDE (avrdude).

The following sketch illustrates the problem.

void setup() {
  Serial.begin(9600);
}

void loop() {
  Serial.println();
}

The attached project can be used to reproduce the issue.
SimpleUploader.zip

The full logged output is as follows:

INFO - Starting ArduinoSketchUploader...
INFO - Starting upload process for file '[my new firmware file.hex]'.
'Eyedrivomatic.exe' (CLR v4.0.30319: Eyedrivomatic.exe):
TRACE - Creating serial port 'COM4'...
INFO - Establishing memory block contents...
INFO - Opening serial port COM4 - baudrate 115200
INFO - Executing Post Open behavior (ArduinoUploader.BootloaderProgrammers.ResetBehavior.ResetThroughTogglingDtrBehavior)...
TRACE - Opened serial port COM4 with baud rate 115200!
TRACE - Sleeping for 250 ms after open...
INFO - Establishing sync...
TRACE - Sending 2 bytes:
TRACE - 30-20
TRACE - Receiving bytes: 0D
TRACE - Receiving bytes: 0A
TRACE - Receiving bytes: 0D
TRACE - Receiving bytes: 0A
...
TRACE - Receiving byte: 0A
TRACE - Receiving byte: 0D
TRACE - Receiving byte: 0A
TRACE - Receiving byte: 0D
TRACE - Receiving byte: 00
TRACE - Receiving byte: 14
TRACE - Receiving byte: 10
INFO - Sync established.
INFO - Checking device signature...
DEBUG - Expecting to find '1E-95-0F'...
TRACE - Sending 2 bytes:
TRACE - 75-20
TRACE - Receiving byte: 00
Exception thrown: 'ArduinoUploader.ArduinoUploaderException' in ArduinoUploader.dll
INFO - Resetting...
TRACE - Toggling DTR/RTS...
INFO - Closing serial port...
ERROR - Unable to aqcuire sync in SendWithSyncRetry for request of type ArduinoUploader.BootloaderProgrammers.Protocols.STK500v1.Messages.ReadSignatureRequest! - [ArduinoUploader.ArduinoUploaderException: Unable to aqcuire sync in SendWithSyncRetry for request of type ArduinoUploader.BootloaderProgrammers.Protocols.STK500v1.Messages.ReadSignatureRequest!
at ArduinoUploader.BootloaderProgrammers.Protocols.STK500v1.Stk500V1BootloaderProgrammer.SendWithSyncRetry(IRequest request)
at ArduinoUploader.BootloaderProgrammers.Protocols.STK500v1.Stk500V1BootloaderProgrammer.CheckDeviceSignature()
at ArduinoUploader.ArduinoSketchUploader.UploadSketch(IEnumerable`1 hexFileContents)].
Exception thrown: 'ArduinoUploader.ArduinoUploaderException' in ArduinoUploader.dll
Exception thrown: 'ArduinoUploader.ArduinoUploaderException' in mscorlib.dll

Verification exception when uploading to NANO R3 board

I am getting the exception: Difference encountered during verification! when attempting to upload to a board with NANO R3 (ATmega328P with old bootloader - compare #32).

I tried to upload different programs and also on different boards.
Sometimes upload and verification are successful but only in case of about 1 of 10 tries.

I switched back to library version 3.1.0 and now every upload is successful!
Therefore, the changes made from version 3.1.0 to version 3.2.0 must cause the problem.

If I am right, the only relevant file where changes have been made is STK500v1BootloaderProgrammer.cs.

VB.Net - Update of upload status with progress bar

How to do a update of the progressbar in % while uploading?

Private Sub UploadHex_ProgressChanged(sender As Object, e As ProgressChangedEventArgs) Handles UploadHex.ProgressChanged
    ProgressBar1.Value = e.ProgressPercentage
End Sub

will not work.

Any help?

BR
Jens

Upload second time fails

Following the code example to upload a sketch works perfectly when I first plug in the Arduino Uno into the USB port of my PC.

However if I try to upload the same or a different sketch one more time it fails. It does not even get caught in an exception but the program simply terminates.

Only workaround seems to be to unplug the USB cable and then it works again.

Sketch upload different to Arduino IDE

Hello!

In my sketch i have a serial read command "V" which returns the version number of the current SW-Version. I've compiled it with ardunio IDE and Upload to Ardunio Mega 2560. I typed "V" at Serial Monitor and received the version number. After the upload test using the Ardunio IDE i've tried to upload the same sketch (ino.hex) by using your library. I tested the Arduino-SW again by tipping "V" at serial monitor but only received a line break ("\r\n").
If upload the file with Arduino IDE agian it still works.

I also noticed a diffence at the file size:

Arduino IDE: 6416 bytes
C#: 6432 bytes

Thank you

Unable to execute write page, port refuses to close after writes on Atmega32u4s?

I was messing around with the library for a comment I saw on a forum asking for a GUI sample of this library, I've implemented a very simple example of this library in a GUI, but encountered problems uploading to Atmega32u4 boards, I've tried this on an official Leonardo and several Pro Micro clones which all had the sample problem. It is possible that I've overwritten the bootloader on the official Leonardo before so I'd really appreciate if someone else could double check for me.

The exact exception thrown by the library is Unable to execute write page! which I suspect is caused by A109BootloaderProgrammer.cs

How to replicate:

  • clone this repo
  • compile and run the exe in the IDE for best results (so that you get to see the logger outputs in the console)
  • select a *.hex file, press upload, look at the console output

detailed log of the error below:

Click to expand logs
Writing page at offset 29056.
Sending load address request: 29056.
Sending 3 bytes: 
41-38-C0
Receiving byte: 0D
Sending 132 bytes: 
42-00-80-46-80-93-AA-01-89-2B-09-F4-28-9A-E0-E0-F0-E0-85-91-94-91-8F-5F-9F-4F-49-F0-80-91-AC-01-90-91-AD-01-01-96-90-93-AD-01-80-93-AC-01-FF-91-EF-91-9F-91-8F-91-2F-91-0F-90-0F-BE-0F-90-1F-90-18-95-84-E0-80-93-E9-00-0D-C0-80-91-E8-00-8B-77-80-93-E8-00-03-C0-8E-B3-88-23-51-F0-80-91-E8-00-82-FF-F9-CF-80-91-E8-00-85-FF-EF-CF-80-91-F1-00-08-95-98-2F-83-E0-80-93-E9-00-80-91-E8-00-85-FD-0D-C0-80-91
Receiving byte: 00
The thread 0x2f6c has exited with code 0 (0x0).
i: Closing COM5...
The thread 0x296c has exited with code 0 (0x0).
The thread 0x2270 has exited with code 0 (0x0).
The thread 0x1bd8 has exited with code 0 (0x0).
The thread 0x2c70 has exited with code 0 (0x0).
i: Waiting for virtual port COM5 to disappear...
i: T+0 - Port still present...
i: T+100 - Port still present...
i: T+200 - Port still present...
i: T+300 - Port still present...
i: T+400 - Port still present...
i: T+500 - Port still present...
i: T+600 - Port still present...
i: T+700 - Port still present...
i: T+800 - Port still present...
i: T+900 - Port still present...
i: T+1000 - Port still present...
i: T+1100 - Port still present...
i: T+1200 - Port still present...
i: T+1300 - Port still present...
i: T+1400 - Port still present...
i: T+1500 - Port still present...
i: T+1600 - Port still present...
i: T+1700 - Port still present...
i: T+1800 - Port still present...
i: T+1900 - Port still present...
i: T+2000 - Port still present...
i: T+2100 - Port still present...
i: T+2200 - Port still present...
i: T+2300 - Port still present...
i: T+2400 - Port still present...
i: T+2500 - Port still present...
i: T+2600 - Port still present...
i: T+2700 - Port still present...
i: T+2800 - Port still present...
i: T+2900 - Port still present...
i: T+3000 - Port still present...
i: T+3100 - Port still present...
i: T+3200 - Port still present...
i: T+3300 - Port still present...
i: T+3400 - Port still present...
i: T+3500 - Port still present...
i: T+3600 - Port still present...
i: T+3700 - Port still present...
i: T+3800 - Port still present...
i: T+3900 - Port still present...
i: T+4000 - Port still present...
i: T+4100 - Port still present...
i: T+4200 - Port still present...
i: T+4300 - Port still present...
i: T+4400 - Port still present...
i: T+4500 - Port still present...
i: T+4600 - Port still present...
i: T+4700 - Port still present...
i: T+4800 - Port still present...
i: T+4900 - Port still present...
i: T+5000 - Port still present...
i: T+5100 - Port still present...
i: T+5200 - Port still present...
i: T+5300 - Port still present...
i: T+5400 - Port still present...
i: T+5500 - Port still present...
i: T+5600 - Port still present...
i: T+5700 - Port still present...
i: T+5800 - Port still present...
i: T+5900 - Port still present...
i: T+6000 - Port still present...
i: T+6100 - Port still present...
i: T+6200 - Port still present...
i: T+6300 - Port still present...
i: T+6400 - Port still present...
i: T+6500 - Port still present...
i: T+6600 - Port still present...
i: T+6700 - Port still present...
i: T+6800 - Port still present...
i: T+6900 - Port still present...
i: T+7000 - Port still present...
i: T+7100 - Port still present...
i: T+7200 - Port still present...
i: T+7300 - Port still present...
i: T+7400 - Port still present...
i: T+7500 - Port still present...
i: T+7600 - Port still present...
i: T+7700 - Port still present...
i: T+7800 - Port still present...
i: T+7900 - Port still present...
i: T+8000 - Port still present...
i: T+8100 - Port still present...
i: T+8200 - Port still present...
i: T+8300 - Port still present...
i: T+8400 - Port still present...
i: T+8500 - Port still present...
i: T+8600 - Port still present...
i: T+8700 - Port still present...
i: T+8800 - Port still present...
i: T+8900 - Port still present...
i: T+9000 - Port still present...
i: T+9100 - Port still present...
i: T+9200 - Port still present...
i: T+9300 - Port still present...
i: T+9400 - Port still present...
i: T+9500 - Port still present...
i: T+9600 - Port still present...
i: T+9700 - Port still present...
i: T+9800 - Port still present...
i: T+9900 - Port still present...
w: Virtual COM port COM5 was still present after {timeoutVirtualPointDisappearance} ms!
e: Unable to execute write page!
Exception thrown: 'ArduinoUploader.ArduinoUploaderException' in ArduinoUploader.dll
An exception of type 'ArduinoUploader.ArduinoUploaderException' occurred in ArduinoUploader.dll but was not handled in user code
Unable to execute write page!

'WindowsFormsArduinoUploader.exe' (CLR v4.0.30319: WindowsFormsArduinoUploader.exe): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\PrivateAssemblies\Runtime\Microsoft.VisualStudio.Debugger.Runtime.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
The program '[14404] WindowsFormsArduinoUploader.exe' has exited with code -1 (0xffffffff).

UWP Support

Do you have plans to make this run under Windows 10 IoT UWP Apps?

How to in winform

Hello
This is not an issue but i dont know how to use in winform.

this is my code. how to get some progress info text and progress value ??
when i click button1 its uploading without a problem

` public partial class Form1 : Form
{

    public Form1()
    {
        InitializeComponent();
    }

    double deneme = 0;

    private void button1_Click(object sender, EventArgs e)
    {
        var options =  new ArduinoSketchUploaderOptions
            {
                FileName = @"C:\Users\ataka\Desktop\Firmware.hex",
                PortName = "COM6",
                ArduinoModel = ArduinoModel.Mega2560
            };
        var logger = new ArduinoSketchUploaderLogger();

        var progress = new Progress<double>(
            p => logger.Info($"Upload progress: {p * 100:F1}% ..."));

        var uploader = new ArduinoUploader.ArduinoSketchUploader(options, logger, progress);
        try
        {
            
            uploader.UploadSketch();
            MessageBox.Show("Uploaded..");
            //Environment.Exit((int)StatusCodes.Success);
        }
        catch (ArduinoUploaderException)
        {
            //Environment.Exit((int)StatusCodes.ArduinoUploaderException);
            MessageBox.Show("ArduinoUploaderException");
        }
        catch (Exception ex)
        {
            logger.Error($"Unexpected exception: {ex.Message}!", ex);
            //Environment.Exit((int)StatusCodes.GeneralRuntimeException);
            MessageBox.Show($"Unexpected exception: {ex.Message}!");
        }

    }

    public class ArduinoSketchUploaderLogger : IArduinoUploaderLogger
    {
        private static readonly Logger Logger = LogManager.GetLogger("ArduinoSketchUploader");

        public void Error(string message, Exception exception)
        {
            Logger.Error(exception, message);
        }

        public void Warn(string message)
        {
            Logger.Warn(message);
        }

        public void Info(string message)
        {
            Logger.Info(message);
        }

        public void Debug(string message)
        {
            Logger.Debug(message);
        }

        public void Trace(string message)
        {
            Logger.Trace(message);
        }

    }

    private void Timer1_Tick(object sender, EventArgs e)
    {
        this.Invoke((MethodInvoker)delegate
        {
            var logger = new ArduinoSketchUploaderLogger();
            var progress = new Progress<double>(
            p => logger.Info($"Upload progress: {p * 100:F1}% ..."));
            label1.Text = progress.ToString();

            /*var logger = new ArduinoSketchUploaderLogger();
            var progress = new Progress<double>(
            p => logger.Info($"Upload progress: {p * 100:F1}% ..."));
            ProgressBar1.Value = Convert.ToInt32(progress);*/
        });
    }

    public void update_label(string value)
    {
        label2.Text = value;
    }


}`

Nullref in ArduinoUploader.dll

When trying to run a simple console app with the given .NET sample code I get a NullReferenceException in ArduinoUploader.dll.

I successfully installed the library and it's dependencies via NuGet and all the references are found. Also tried restoring NuGet packages but it says there's nothing to restore.

StackTrace:
at ArduinoUploader.BootloaderProgrammers.ResetBehavior.ResetThroughTogglingDtrRtsBehavior.Reset(SerialPortStream serialPort, SerialPortConfig config)
at ArduinoUploader.BootloaderProgrammers.ArduinoBootloaderProgrammer.Close()
at ArduinoUploader.ArduinoSketchUploader.UploadSketch(IEnumerable`1 hexFileContents)
at ArduinoUploader.ArduinoSketchUploader.UploadSketch()
at ArduinoUploadTest.Program.Main(String[] args) in C:\Users\Jelle Dekkers\source\repos\ArduinoUploadTest\ArduinoUploadTest\Program.cs:line 21

Support for ATmega4809

I was wondering if the existing release support uploading to ATMega4809, that comes with Arduino Uno Wifi Rev2.
If it not, if there is way that can be added?

Kind Regards,

Tahir

Question regarding netcore 6 support

Hello twinearthsoftware, i use your repository for one of my open source projects and honestly it works great under Windows, however we had a requirement to port the project to Mac and Linux and i had to re write some of the StechUploader code to be comparable with .net 6 and System.IO.Ports since the RJC doesn't play nice with anything but Windows.

I still have few things to fix before its fully ready, mainly refactor some of my code and turn on the command line tool, since i just commented it out as i don't use it.

So question is, should i open PR or just keep it on a different fork?

Arduino 101

it could be possible upload firmware into Arduino 101 board?

Add support for Arduino NANO R3 with new bootloader (optiboot)

The Arduino development team has replaced the bootloader for the Arduino NANO R3 boards in early 2018.

NOTE: We have updated the NANO board with a fresh bootloader. Boards sold from us from January 2018 have this new bootloader, while boards manufactured before that date have the old bootloader. First, make sure you have the Arduino AVR Core 1.16.21 or later looking at the Board Manager. Then, to program the NEW Arduino NANO boards you need to chose Processor > "ATmega328P". To program old boards you need to choose Processor > "ATmega328P (Old Bootloader)". If you get an error while uploading or you are not sure which bootloader you have, try each type of processor 328P until your board gets properly programmed.
Source

The previous bootloader ATmegaBOOT was exchanged for Optiboot and thus also doubled the data transfer rate from 57,600 Bd to 115,200 Bd. See comparison:

Arduino Nano w/ ATmega328P
nano.menu.cpu.atmega328=ATmega328P
nano.menu.cpu.atmega328.upload.maximum_size=30720
nano.menu.cpu.atmega328.upload.maximum_data_size=2048
nano.menu.cpu.atmega328.upload.speed=115200
nano.menu.cpu.atmega328.bootloader.low_fuses=0xFF
nano.menu.cpu.atmega328.bootloader.high_fuses=0xDA
nano.menu.cpu.atmega328.bootloader.extended_fuses=0xFD
nano.menu.cpu.atmega328.bootloader.file=optiboot/optiboot_atmega328.hex
nano.menu.cpu.atmega328.build.mcu=atmega328p
Arduino Nano w/ ATmega328P (old bootloader)
nano.menu.cpu.atmega328old=ATmega328P (Old Bootloader)
nano.menu.cpu.atmega328old.upload.maximum_size=30720
nano.menu.cpu.atmega328old.upload.maximum_data_size=2048
nano.menu.cpu.atmega328old.upload.speed=57600
nano.menu.cpu.atmega328old.bootloader.low_fuses=0xFF
nano.menu.cpu.atmega328old.bootloader.high_fuses=0xDA
nano.menu.cpu.atmega328old.bootloader.extended_fuses=0xFD
nano.menu.cpu.atmega328old.bootloader.file=atmega/ATmegaBOOT_168_atmega328.hex
nano.menu.cpu.atmega328old.build.mcu=atmega328p

I think the easiest way would be to implement a new variation of the Arduino NANO in ArduinoUploader.xml and add the "new" Arduino model to the list in ArduinoModel.cs as NanoR3New just like in the Arduino IDE:
image
Image source

Changing the device name

Hi, first of all thank you so much for this library. I have been using it in a small .NET program and it works great and I really like the interfaces and logging capabilities.

I was wondering if it's possible to add some configuration to this so the device name can be changed. At the moment I have several devices detected by Windows as "Arduino Micro" and I'd prefer to give them a more descriptive name.

That seems to be possible with the base Arduino libraries by changing your boards.txt as explained in this video

Do you think it would be possible to add this capability?

Close serial port , stop uploading after x seconds

Dear,

I am having the issue that sometimes I don't know if I have a new or old bootloader version of the Arduino nano.
When trying to upload a sketch with the wrong bootloader set, it sends 2 bytes and keeps being in that state.
Is there a proper way to stop the upload process if the wrong bootloader has been set, or the device is simply not responding?
In that case I could restart the uploader process with the right bootloader option being set.

When choosing the wrong bootloader version the function ; uploader.UploadSketch() seems to never break, and keeps the serial port alive.

Can only upload to Mega2560 once

I have an issue if I try to upload to a Mega2560 I can do it once but if I stay in the app and try a second time it does nothing. It just waits and I have crash out of my app. If I restart my app I can then upload again. I know its not my app as it doesn't do the same with NanoR3 or UnoR3, they work. I know its not my board as I dont have the same issue with the Arduino IDE.

unable to set the serial port state

Hi I'm using the Arduino Sketch Uploader to upload some code to my arduino. I have set everything like the com port and fiile, and it gets through that part without any exception. Only, when I connect my arduino through usb and click my upload button, the entire form freezes until I disconnect my arduino. Afterwards it gives me the error "unable to set the serial port state" below you will find my code -

private void button2_Click(object sender, EventArgs e) { button2.Text = "Uploading..."; foreach (string s in checkedListBox1.CheckedItems) { if (s == "Arduino Nano R3 (Recommended )") { model = ArduinoModel.NanoR3; }

            `else if (s == "Arduino Nano R2")
            {
                model = ArduinoModel.NanoR2;
            }

            else if (s == "Arduino Mega")
            {
                model = ArduinoModel.Mega2560;
            }

            else if (s == "Arduino Micro")
            {
                model = ArduinoModel.Micro;
            }

            else if (s == "Arduino Uno")
            {
                model = ArduinoModel.UnoR3;
            }

            else
            {
                model = ArduinoModel.NanoR3;
            }
        }

        foreach (string s in checkedListBox2.CheckedItems)
        {
            port = s;
        }

        var uploader = new ArduinoSketchUploader(
          new ArduinoSketchUploaderOptions()
          {
              FileName = @file,
              PortName = port,
              ArduinoModel = model
          });

        try
        {
            uploader.UploadSketch();
        }
        catch (Exception ex)
        {
            errs = ex.Message;
        }

        msg = (string)( "Uploading: " + file + ";" + model + ";" + port);

        if (errs.Length > 0)
        {
            label12.Text = errs;
            label12.BackColor = Color.Red;
            button2.Text = "Failed";
        }
        else
        {
            label12.Text = msg;
            label12.BackColor = Color.YellowGreen;
            button2.Text = "Uploaded";
        }
        
    }`

Native uploader

Hi Chris,

Your project is the first i found that allows for native uploading of hex files. (Most are only wrappers around avrdude). Congrats for that.

As i play around with arduino a lot i needed a way to version my projects. But also to track what version was in a arduino after i uploaded it.
I created a build server (with gitlab and gitlab-ci that will produce a hex as build files. The first lines printed on the serial port are it's project, and git hash so i can track the loaded project/version.
Second i implemented a python project that will use the API of gitlab to download the HEX files. Now i only need a good way to upload it in one click to my connected board. (i dislike the arvdude wrapper i use now, because i have to close the serial in order to use it).

Could u tell me how hard it was to implement the protocol to upload the hex file?
Or could i better implement the gitlab API in .Net ;)

Thanks for the project. I will play with it for sure.

Arduino Nano stops communicating after upload

Hi,

I'm interfacing an issue after I upload a sketch with ArduinoSketchUploader.
The sketch is upload successfully to the board, however it seems the arduino stops communicating for some reason. It keeps the power lights (green) on and do not light up the others (tx/rx) that lights when it is communicating.
image

I can only get data from the arduino if I reset manually on the button or if I open monitor serial from arduino idle. I tryed to reset arduino via code but I couldn't find out how. The option "Serial Monitor" from arduino idle somehow reset its communication and perhaps could solve my problem.

Do you have any idea what is happening in order to happen this issue to me? Or any way that I could solve that?

Thank you.

Environment.Exit on error

Hello,

When i use ArduinoSketchUploader in my C# app , I don't want Environment.Exit on error but just a log or a Exception.
It's possible to add an option for this ?

internal static void LogErrorAndQuit(string errorMessage) 
        {
            logger.Error(errorMessage);
            Environment.Exit(1);
        }

Uploader will send sketch twice

When using the code from a Visual Studio project, the uploader will send it twice, although it is only written once in the native Arduino code. For example, if I write code to light an LED in the usual manner in the Arduino IDE, export the compiled binary, then use it, the LED flashes twice.

Device Error for UnoR3 with a CH340G USB/Serial chip

My device Arduino UnoR3 CH340G
UPD: Arduino with the Mega16 controller all works.

C:\Users\cpp>\\VBOXSVR\VM_Share\ArduinoSketchUploader-2.4.0\ArduinoSketchUploade
r.exe -f \\VBOXSVR\VM_Share\keyFile -p COM3 -m UnoR3
2017-05-17 10:14:37.5776|INFO|ArduinoUploader.ArduinoSketchUploader|Starting Ard
uinoSketchUploader...
2017-05-17 10:14:37.6057|INFO|ArduinoUploader.ArduinoSketchUploader|Starting upl
oad process for file '\\VBOXSVR\VM_Share\keyFile'.
2017-05-17 10:14:37.6479|INFO|ArduinoUploader.BootloaderProgrammers.SerialPortBo
otloaderProgrammer|Opening serial port COM3 - baudrate 115200
2017-05-17 10:14:38.2948|INFO|ArduinoUploader.ArduinoSketchUploader|Establishing
 sync...

Unhandled Exception: System.IO.IOException: Device Error
   at RJCP.IO.Ports.SerialPortStream.WriteCheckDeviceError()
   at RJCP.IO.Ports.SerialPortStream.WriteCheck(Byte[] buffer, Int32 offset, Int
32 count)
   at RJCP.IO.Ports.SerialPortStream.Write(Byte[] buffer, Int32 offset, Int32 co
unt)
   at ArduinoUploader.BootloaderProgrammers.SerialPortBootloaderProgrammer.Send(
IRequest request)
   at ArduinoUploader.BootloaderProgrammers.OptibootBootloaderProgrammer.Establi
shSync()
   at ArduinoUploader.ArduinoSketchUploader.UploadSketch(IEnumerable`1 hexFileCo
ntents)
   at ArduinoUploader.ArduinoSketchUploader.UploadSketch()
   at ArduinoSketchUploader.Program.Main(String[] args)
2017-05-17 10:14:40.1791|INFO|ArduinoUploader.BootloaderProgrammers.SerialPortBo
otloaderProgrammer|Closing serial port...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.