Hello,
I need a few of help, My objective is to deploy new versions of firmware on chip Atmega16 using UART port (RS485). I flashed a blinked led with bootloader (using MightyCore bootloader built with Arduino studio). I have burned it with other software on programmer board.
Now I have connected the computer to board using COM serial port (UART of chip with RS 485), but when try to flash a new version of firmware (arduino studio/avrdude), it shows the message that it can’t sync with board. Could you help me to understand what steps I’m doing incorrectly?
My final objective is be able to update the firmware of multiple boards on RS485, forcing to other board disconnect the UART port while one is updating. If there are other way to get the objective, tell me please. I thought to build my own protocol to send the new firmware but I think it is more risk and difficult to get the objective correctly or not?
Thank you
You will need a reset mechanism. On boards like Uno and Nano, opening the serial port will assert DTR which is detected by the serial-to-usb converter; the serial-to-usb converter will assert the DTR signal on its DTR pin which is connected to the reset pin of the microcontroller.
Thank you, it has logic in order not to work. The normal program of firmware has commands in order to speak with computer. If I declare with some command to make a reset by software, for example:
void(* resetFunc) (void) = 0;
And from command, call resetFunc(); should it work?
Or if I skip to bootloader position, could I send directly the new firmware?
Thank you!!
Using the multidrop abilities of rs485? In addition to handling turn-around of your rs485 transceiver, and somehow getting the desired board into the bootloader, you'll also need some way to address the specific board you want to update...
There is some rs485 code in the the latest Optiboot source, but it handles only the turn-around, and I have my doubts that it's actually useful in any real scenario.
If the rs485 port isn't being used for anything other than the update, perhaps you can have a manual "update" button on your box that puts it into the bootloader for an extended time, and then an upload could find it while the other boxes are just ignoring the serial port...
I don't think I've ever seen a fleshed-out rs485 example. And technically rs485 is just the electrical specs, so "link level" details aren't included. Most of the rs485 I've seen is just someone wanting the long-distance capabilities, the reduced wiring, or compatibility with a single connected peripheral.
Thank you by yours answers! Yes, that's my thought. Currently I already exchange messages between the different devices - PC with a homemade protocol , so I was thinking of making the rest of the boards stop listening to the port so that the other board can update.
If I want yo give the order to upgrade in this scenario, should I set something special on Avrdude command once it has jumped to the Bootloader? Or is there an example to be able to send the firmware without having to use avrdude (close port, launch avrdude, and reopen the port of the application)?
Thank you!