Can I upload to arduino without using Avrdude?

Hello. I have a project that requires uploading to arduino from preferably a browser like chrome, utilising the WebSerial API. Is this even possible? I've heard that arduino bootloader uses a protocol called stk500 or something like that for uploading code. Would I need to re-implement that functionality from WebSerial?

Basically, can I upload code from a pure Serial interface without using helpers like avrdude and custom bootloaders? If you know the answer to this question, I think I'll be able to figure out whether I can implement that using WebSerial.

Thanks in advance!

Welcome to the forum

Which Arduino board are yo using ?

can I upload code from a pure Serial interface without using helpers like avrdude and custom bootloaders?

Sure, if you write code that does stk500v1 (for Uno/etc. Other boards run other protocols.)
I don't know if that's possible from WebSerial or not; I would think it ought to be - it's a pretty trivial "protocol."
See here: HowOptibootWorks · Optiboot/optiboot Wiki · GitHub
and here: https://ww1.microchip.com/downloads/aemDocuments/documents/OTH/ApplicationNotes/ApplicationNotes/doc2525.pdf

Well I'd like to support as many boards as possible. But as a proof of concept maybe most widely used Arduino boards can be supported. Uno, Nano, etc..

I think this is what Arduino uses in the Web Editor

Oh thanks. I'll surely take a look and update

I came across this when I was having trouble getting my UNO R3 to communicate with my browser. Serial communication to and fro btw. Does this mean that stk500v1 is not used? Is there a way I can find out what protocol is used? Thanks in advance!

First of all, that information is specific to using an "Arduino as ISP" programmer to flash a binary to the microcontroller. You are interested in flashing via the bootloader so information specific to an ISP programmer is irrelevant.

Another thing you should understand is that the "protocol" mentioned there is actually the ID used by the AVRDUDE uploader tool to identify the "programmer" it uses:

https://avrdudes.github.io/avrdude/7.3/avrdude_4.html#index-Option-_002dc-programmer_002did

Some of these programmers use the standard lower level protocol such as STK500 v1, but maybe with some slightly different behavior, such as whether to assert DTR or RTS serial control signals when opening the serial port (which will cause the bootloader to be activated on boards that have an auto-reset circuit).

There is some information on that subject here in the AVRDUDE documentation:

https://avrdudes.github.io/avrdude/7.3/avrdude_4.html#index-Option-_002dc-programmer_002did

When you are using Arduino Cloud Editor on a Linux, macOS, or Windows machine, the sketch is compiled on the Arduino Cloud server, then the binary downloaded to your PC by Arduino Cloud Agent. Cloud Agent then runs the appropriate upload tool (e.g., avrdude for AVR boards, bossac for SAMD boards, etc.) on your local machine to flash that binary file to the board, just the same as Arduino IDE does.

The behavior is different when using Cloud Editor on a ChromeOS machine. In this case, Cloud Agent is not used and the browser application flashes the board directly. Unfortunately I am not very knowledgeable on this subject, and don't even have access to a ChromeOS machine so I can't provide any information about the specifics of how that system works. It is worth noting that the list of boards for which uploading is supported via Cloud Editor on a ChromeOS machine is significantly smaller than the list of boards that are supported on Linux, macOS, and Windows machines. Compare the list here:

https://support.arduino.cc/hc/en-us/articles/360014779899-Boards-compatible-with-the-Cloud-Editor#cloud-editor-on-chromebook

to the one here:

https://support.arduino.cc/hc/en-us/articles/360014779899-Boards-compatible-with-the-Cloud-Editor#cloud-editor-on-windows%2C-macos%2C-and-linux

I believe the technical limitations of the browser app-based upload system are the explanation for the lack of upload support for many of the boards on ChromeOS machines.

I know that, at least in the past, the tool used to upload from Cloud Editor on ChromeOS machines was "avrgirl-arduino", as you can see in the output from this post of 2023-07-27:

The avrgirl project is here:

I see Arduino has a fork of the "avrgirl-arduino" project here, which might be the origin of the "avrgirl-arduino-patched " executable you see used in the upload command in the output I quoted above:

but I don't see much unique work in that arduino/avrgirl-arduino fork compared to the noopkat/avrgirl-arduino parent repository so it might just be some detritus rather than something Arduino is actually using.

There was a major rewrite of Cloud Editor earlier this year, so it is possible the ChromeOS upload system has changed completely since 2023.

1 Like

Very grateful for you descriptive answer. This helped me a lot and the links were very informative. I got it working with avrgirl. Thanks

You are welcome. Great job of getting things working with avrgirl!