What Drives Optiboot? (M4809)

Go To Last Post
25 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've searched through Optiboot threads here at Freaks and I've looked through the GitHub repository, without success.

 

Here is the situation. Suppose that I actually sell some products and belatedly discover that a firmware update is needed. Its no real problem to distribute hex or similar files. But, I would hate to have to ask a biologist or a forester to install and run the Arduino IDE in order to have a way to pump stuff into Optiboot. 

 

Will AVRdude do it? Or is there some other distributable tool? I would probably put a cross-platform wrapper around around it so that all the user has to do is hook up a USB cable, run the wrapper and point it to the new file, the wrapper taking care of all the command line details. 

 

So, what do folks use with Optiboot at the host end of things?

 

As an aside, can an Optiboot target bootload system be run from within AS7?

 

Thanks

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

Last Edited: Tue. Dec 28, 2021 - 06:41 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Why Optiboot? 

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Because it is supposed to have a port to M4809.

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Here's a few things to perhaps take a look at:

http://ww1.microchip.com/downloa...

 

http://ww1.microchip.com/downloa...

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I had a similar problem a while ago and asked a similar question. Lots of answers here BUT they all assumed a higher level of technical competence in the end-user than existed in reality. As engineers we often drastically overestimate the skill set of other fields. The typical end-user, no matter how many degrees they have, can just about manage copying a single file onto the desktop and running an installer, as long as no error messages pop up.

 

How did I solve it? I went to a commercial bootloader. The 100 GBP/$ I spent more than paid for itself in reduced support emails/calls.

 

www.chip45.com

 

 

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

At my previous employer I/we always built the firmware update process into the Customer's application software. (Windows Application or Website and USB connection or Radio; according to product). There was one standalone product (no companion software) with a separate update tool but that was for internal service & repair use only.

 

In practise this went really well, the only downside being the magnetic draw for our customers to always be running the latest firmware whether they needed it or not.  The worst of this being: we fix a bug that presents only during PCB test and it gets pushed out to all the devices in the field.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Will AVRdude do it? Or is there some other distributable tool?

avrdude will do it.  It might require a version of avrdude that's been patched to know about the ATmega4809  ( https://github.com/MCUdude/MegaC... )

 

Note that the bootloader and avrdude speak exactly the same communications protocol (stk500v1) as the older megaAVRs.  A bootloader is much more insulated from the actual chip specifics than a hardware programmer.  All the PC-side driver has to do is send blocks of data, and the bootloader receives them and programs the flash "as appropriate."  Aside from providing suitable signature info and such to keep it happy, the only part that is really chip-dependent to the bootloader is the page size.  And ATmega4809 has the same flash page size as ... many ATmega chips (128 bytes.)

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ka7ehk wrote:
Will AVRdude do it? Or is there some other distributable tool? I would probably put a cross-platform wrapper around around it so that all the user has to do is hook up a USB cable, run the wrapper and point it to the new file, the wrapper taking care of all the command line details. 

 

I suppose, by wrapper, you mean both a software and hardware solution.

The hardware part would probably be a USB to serial adapter. Remember you need a way to send a reset pulse to the mega4809 to put it into bootloader mode. Normally this is done via the DTR line, so you need an adapter that exposes this signal.

If you search for "DTR arduino optiboot" you will find endless discussions on this topic.

 

The software part would need to detect which serial port is attributed to the USB/serial adapter. At least on Windows, a random COMx port will be designated the first time you plug in the USB adapter (in my experience, from then on, it stays the same for a given adapter).

There is a fork of avrdude that can select USB devices directly, it should make this step much easier:  https://github.com/mariusgreuel/avrdude

The author of the fork is involved in the ongoing transition of avrdude to GitHub, so I expect this feature to find its way into a future official avrdude version.

Don't know about Linux.

Then you need to wrap avrdude, that's the easy part.

Last Edited: Tue. Dec 28, 2021 - 11:39 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

El Tangas wrote:

Then you need to wrap avrdude, that's the easy part.

 

westfw wrote:

Note that the bootloader and avrdude speak exactly the same communications protocol (stk500v1) as the older megaAVRs.

 

Why Avrdude at all? If all you need is stk500v1 then why not write a windows program that allows you to select a hex file, a COM port, and talks stk500v1 natively?

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Brian Fairchild wrote:
Why Avrdude at all?

 

Regarding the OP, IDK, but if it were me, the answer is simple - because avrdude already implements  stk500v1, and I'm rather lazy. Why would I go to the trouble of reading stk500v1 documentation and reimplement it?

It's much easier to write a program that inputs the COM port and hex file from the user (or autodetects both), then calls avrdude with the appropriate options.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What about Alank's little programmer that you simply plug into the target, power up and wait for the happy.led?  Does not get any easier.  Unless in your case sending that is an issue that an email attachment does not have.

 

Right Side Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ka7ehk wrote:
can an Optiboot target bootload system be run from within AS7?
Yes (external tool)

Arduino to Atmel Studio 7 external programmers, ISP and serial programming | AVR Freaks

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

But if this is about letting customers update code you send them you surely aren't expecting them to install gigabytes of AS7 just to do reprogramming? One of the things that makes avrdude so attractive for doing field updates is the customer only has to unzip 3 files to have a working copy of avrdude (exe, dll, conf files) 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

re SerialBootloader (first link), some customers require FOTAU due to cellular service providers' requirement for modems.

 


Host Application | Bootloader for tinyAVR® 0- and 1-series, and megaAVR® 0-series

[last paragraph]

Over-the-air (OTA) programming is also possible if the device has wireless connectivity. This makes it easier to add software upgrade features from a smartphone application, or other ways of upgrading a large amount of devices without having to physically connect each device to a computer or progammer.

re smartphone (Android, iOS)

  • "Transparent UART" mode in some Microchip Technology Bluetooth Low Energy (BLE) modules; similar for competitors' BLE modules.
  • WebUSB

If a feature phone (KaiOS) then USB OTG is lacking (USB host bridge to MCU)

 

BM70/71 Bluetooth® Low Energy Module User’s Guide | Microchip Technology

[page 17]

1.1.2.1 AUTO OPERATION

[1/3 page]

Once connected, a private GATT service called “Transparent UART” is used to exchange data with the peer device. This simplifies the tasks a host has to do when trying to communicate data over Bluetooth Low Energy. Auto Operation works well for hosts who do not care about the Bluetooth Low Energy protocols, but want the BM70/71 module to act as a virtual UART pipe between the host and the Bluetooth Low Energy central/master. When Auto Operation is active, any data sent over the UART interface is transmitted to the connected device. Any data received by the BM70/71 module from the connected device is sent over the UART interface to the host.

Microchip Transparent UART Service for BM70/RN4870 - Developer Help

Android™ Bluetooth® Low Energy (BLE) App Development For BM70 / RN4870 - Developer Help

BM71 | Microchip Technology

USB - Web APIs | MDN

Browser compatibility | USB - Web APIs | MDN

Examples | Building a device for WebUSB

Compatible Hardware | GitHub - webusb/arduino: WebUSB demos running on Arduino (and compatible) hardware.

Bluetooth | KaiOS, Enable tomorrow

USB Host Series IC`s - FTDI

 

edit :

ATtiny1614 OTA bootloader | AVR Freaks (nRF24)

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Tue. Dec 28, 2021 - 05:06 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

AVR ATmega Xmega chip45boot3 Bootloader Sourcecode

 

edit :

Brian Fairchild wrote:
I went to a commercial bootloader.
Advantage license (not GPL); AVR are single program space so GPL can be an issue.

 

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Tue. Dec 28, 2021 - 05:18 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


It's nicer if you can make you own PC app tailored to your device; this greatly improves the user experience & allows other adjustments to be made, in addition to bootloading.

Also, the file can be checked against a websource & downloaded automatically for "burn in"

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

N.Winterbottom wrote:
At my previous employer I/we always built the firmware update process into the Customer's application software. (Windows Application or Website and USB connection or Radio; according to product).
.NET can have an AVR loader; alternatives are

  • WebSocket (UART/USB bridge to WAN)
  • WebUSB

N.Winterbottom wrote:
The worst of this being: we fix a bug that presents only during PCB test and it gets pushed out to all the devices in the field.
The CD part of CI/CD aids the ones who do configuration management.

 


NuGet Gallery | ArduinoUploader 3.2.0 (.NET)

Programming Your Arduino from SPJS | GitHub - chilipeppr/serial-port-json-server: Serial Port JSON Server is a websocket server for your serial devices. ...

ChiliPeppr - Hardware Fiddle

USB - Web APIs | MDN

 

CI : Continuous Improvement

CD : Continuous Deployment

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Thanks, everyone, for the great suggestions and insights.

 

Yes, there will be a simple (simple as demonstrated by avrcandy's GUI) interface that will call the bootload "driver" (AVRdude, in this case, it seems). Will have to do a little more file management because the user will have to be able to download and archive the new firmware image before doing the update because many will do it in the field where there is no internet. I can do that without much problem. The real question for this part was: Is it AVRdude? That got answered (THANKS) with the caveat that a version that knows about M4809 has to be used.

 

Though previously discussed in another thread, I had, indeed, almost forgotten about Optiboot's use of reset to put it into bootload mode. As discussed in that other thread, I will need to call the bootloader from the device's serial command system. I don't want to use DTR signaling because sometimes the serial link will NOT emulate RS232 (e.g. will use RS485 or similar). So, there will be a dedicated bootload command that requires confirmation (Thank you for that idea, Cliff). This will all be handled by the target's command system so that the only modification to Optiboot MIGHT be whatever is needed, inside Optiboot, to allow invoking from something other than reset.

 

This has really helped to clarify my thinking and I want to thank everyone who has contributed. Hopefully some one else will also benefit from finally getting these issues discussed in a single thread. 

 

THANKS!

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

El Tangas wrote:
Remember you need a way to send a reset pulse to the mega4809 to put it into bootloader mode.
AVRxt also has software reset and UPDI reset (reset via your UPDI programmer)

If the AVR is in latch-up then reset likely will be nonfunctional (POR via an external watchdog)

El Tangas wrote:
At least on Windows, a random COMx ...
Less random by WCID.

El Tangas wrote:
... port will be designated the first time you plug in the USB adapter (in my experience, from then on, it stays the same for a given adapter).
COM is linked to the serial number in the USB device's descriptor.

El Tangas wrote:
Don't know about Linux.
LVFS at least for USB DFU.

 


Reset Sources | ATmega4808/4809 Data Sheet

 

What is WCID? | WCID Devices · pbatard/libwdi Wiki · GitHub

 

Overview | How to Find Hidden COM Ports | Adafruit Learning System

 

LVFS: Home, Linux Vendor Firmware Service

due to

jumping to dfu bootloader and stay there | AVR Freaks

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


avrcandies wrote:
It's nicer if you can make you own PC app tailored to your device;
Web apps are replacing some PC apps; Windows 11 can run web apps.

A Single-Page Application (SPA) is enough for a loader with an operator interface.

 

Get started building a Progressive Web App! - #ifdef Windows (Microsoft)

[last sentence]

With PWAs gaining new features almost every day in modern browsers such as Edge (upcoming new APIs in Edge) or Google Chrome and with operating systems such as Windows 11 and Android offering first class support for PWAs, the time to considering building your next app as a Progressive Web App is now! Grab the PWABuilder pwa-starter and get started building a great PWA!

Progressive web apps - App Center | MDN

Minnow Server Reference Platform | GitHub - RealTimeLogic/MinnowServer: A super small and fast embedded HTTP(S) WebSocket server

Figure 1: The Single Page HTML5 Based Web Application

via

Efficient web server technology for resource-constrained microcontrollers - Embedded.com

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This will all have to run where there is no internet access! Yes, such places do exist. Amazon rain forest, forests of Japan, U.S., and Canada, plus many other places. Those are places where my products are used.

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

Last Edited: Tue. Dec 28, 2021 - 07:18 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This will all have to run where there is no internet access! Yes, such places do exist. Amazon rain forest, ...... plus many other places.

Like a couple of km down the road from me....or traveling around just out of the CBD.

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

or traveling around just out of the CBD.

Corona Beer District? 

 

 

A Single-Page Application (SPA) is enough for a loader with an operator interface.

I was wondering if that was possible---a "webpage app", if you will. 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Tue. Dec 28, 2021 - 07:42 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, it (Single Page Application) is possible, if you have internet access!  Almost none of the North American Boreal Forest has internet except for satellite. That means most of Canada and Alaska and good parts of Maine, Vermont, New Hampshire, upper New York state, upper Wisconsin, upper Minnesota, upper Michigan, etc. And, those are the places my instruments go.

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

Last Edited: Tue. Dec 28, 2021 - 08:28 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

SPA via LAN or USB iff operator brings a web browser and an ELF.

Lack of WAN is now a stated requirement.

Lack of embedded Wi-Fi and/or Ethernet may be another requirement (may excessively drain a small battery during load)

 

edit :

Current Consumption in Various Device States | ATWINC15x0-MR210xB IEEE® 802.11 b/g/n SmartConnect IoT Module

 

edit2 : WFI32 is 216 mA typical receive

PIC32MZ1025W104 MCU and WFI32E01 Module with Wi-Fi® and Hardware-based Security Accelerator Data Sheet (page 665)

 

edit3 : 10BASE-T1S PHY is 86 mW typical

LAN8670/1/2 Standard Datasheet (page 82)

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Tue. Dec 28, 2021 - 09:40 PM