Use Optiboot out of own MCU-application

Hi,

following situation: I have an Arduino Nano which is not connected via USB but via UART to an other microcontroller. On this Nano I have the Optiboot bootloader installed. Now I want to write a new application from this other microcontroller to my Nano in order to let Optiboot flash this new firmware. My questions:

  • what (commands) do I have to send to Optiboot via UART exactly in order to transfer my new firmware to the Nanao?

  • how do I tell Optiboot from outside to not to start an existing Nano-application but to start the Firmware update process?

Thanks!

Pulse reset low to start the bootloader (this is done by the DTR line of the serial adapter chip and a cap, google dtr reset circuit)

It communicates via STK500 protocol - I think there's a doc from Atmel that describes it.

Running from command line, you can run avrdude in a very verbose mode (see the docs for avrdude for details on how to enable this); the maximum verbosity mode will print every character sent or received to the console. Once you get close from the above documents, you can use that to see what you're doing wrong.

See HowOptibootWorks · Optiboot/optiboot Wiki · GitHub

huh. The minimal interface to optiboot might involve sending a series of STK_LOAD_ADDRESS commands each followed by a STK_PROG_PAGE command, carefully timed so that they complete before the next one is sent (or you can wait for the responses; hard to say which is easier.) The other stk500v1 commands implemented by optiboot look like they're all to keep the host-side happy, rather than being important to optiboot itself.