bootloader
-
For completeness, here are the MYSBootloader instructions for OTA updates via MYSController:
-
Load gw sketch and connect arduino either via serial or ethernet port. No special bootloader needed for that part (i.e. standard optiboot bootloader will do the job).
-
Add these lines to the boards.txt file in your Arduino IDE installation folder (located somewhere like C:/Program Files/Arduino/hardware/arduino/avr)
proMYSBL16.name=ATmega328 external 16Mhz with MYSBootloader
proMYSBL16.upload.tool=avrdude
proMYSBL16.upload.protocol=arduino
proMYSBL16.upload.maximum_size=30720
proMYSBL16.upload.maximum_data_size=2048
proMYSBL16.upload.speed=115200
proMYSBL16.bootloader.tool=avrdude
proMYSBL16.bootloader.low_fuses=0xF7
proMYSBL16.bootloader.high_fuses=0xDA
proMYSBL16.bootloader.extended_fuses=0x06
proMYSBL16.bootloader.unlock_bits=0x3F
proMYSBL16.bootloader.lock_bits=0xFF
proMYSBL16.bootloader.file=MySensors/MYSBootloader.hex
proMYSBL16.build.mcu=atmega328p
proMYSBL16.build.f_cpu=16000000L
proMYSBL16.build.board=AVR_UNO
proMYSBL16.build.core=arduino
proMYSBL16.build.variant=standard######## settings for 8Mhz internal clock
proMYSBL8.name=ATmega328 internal 8Mhz with MYSBootloader
proMYSBL8.upload.tool=avrdude
proMYSBL8.upload.protocol=arduino
proMYSBL8.upload.maximum_size=30720
proMYSBL8.upload.maximum_data_size=2048
proMYSBL8.upload.speed=57600
proMYSBL8.bootloader.tool=avrdude
proMYSBL8.bootloader.low_fuses=0xE2
proMYSBL8.bootloader.high_fuses=0xDA
proMYSBL8.bootloader.extended_fuses=0x06
proMYSBL8.bootloader.unlock_bits=0x3F
proMYSBL8.bootloader.lock_bits=0xFF
proMYSBL8.bootloader.file=MySensors/MYSBootloader.hex
proMYSBL8.build.mcu=atmega328p
proMYSBL8.build.f_cpu=8000000L
proMYSBL8.build.board=AVR_UNO
proMYSBL8.build.core=arduino
proMYSBL8.build.variant=standard -
Copy MYSBootloader.hex (from MYSController/Bootloader folder) to the Arduino IDE installation folder C:/Program Files/Arduino/hardware/arduino/avr/bootloaders/MySensors/
-
Restart Arduino IDE, choose under Tools | Board | ATmega328 external 16Mhz with MYSBootloader or Tools | Board | ATmega328 internal 8Mhz with MYSBootloader depending on your settings
-
Connect USBasp to sensor node and select Tools | Burn Bootloader
-
If everything worked well until here, you now have the MYSBootloader with the fuse settings from above burnt to your sensor node (16Mhz extXTAL or 8Mhz intRC, BOOTSZ 1024W, BOD 1V8).
-
Please use the AVR fuse calculator to retrieve the individual fuse settings. If you need to change frequency, BOD or other settings, change the fuse settings based on the fuse calculator.
Important: The MYSBootloader.hex file was compiled for 16Mhz oscillators but it should also work at 8Mhz. If you intend to go below 8Mhz, I highly recommend to compile the bootloader with adjusted frequency settings. -
Start MYSController, hit config and adjust settings (COM-Port & baud or IP address:port)
-
Hit connect: Connection to gateway should be established (gateway answers with gateway ready message), the node should appear and request an ID & FW.
-
Right-mouse click on that node, select assign FW, choose for example **TimeReporter ** (demo firmware included in the MYSController/Firmware folder). Then click reboot and wait until FW is uploaded and node boots.
-
TimeReporter firmware reports every few seconds some values such as time, millis, and voltage.
-
Custom firmware: compile your sketch and retrieve the generated .hex file (activate verbose mode in the Arduino IDE to get compiler messages and output path).
-
Copy .hex file to MYSController/Firmware folder and edit firmware_config.csv file according to the existing lines.
-
Hit Refresh Repo in MYSController and the newly copied firmware should appear in the Assign FW dropdown list, ready to be uploaded.
Have fun :)
@tekka
thanks for providing the steps to upload the MSYbootloader..
any idea why i'm getting following error in linking phase"avr-gcc" -Os -nostartfiles -Wl,-s -Wl,-static -Wl,-Map=".map" -Wl,--start-group -Wl,--end-group -Wl,--gc-sections -mrelax -Wl,-section-start=.text=0x7800 -mmcu=atmega328p -o MYSBootloader.elf MYSBootloader.o -lm
MYSBootloader.o: In functionmain': MYSBootloader.c:(.init9+0x288): undefined reference to__boot_page_erase_short'
MYSBootloader.c:(.init9+0x2b8): undefined reference to__boot_page_fill_short' MYSBootloader.c:(.init9+0x2d6): undefined reference to__boot_page_write_short'
MYSBootloader.c:(.init9+0x2e0): undefined reference to `__boot_rww_enable_short'
collect2: error: ld returned 1 exit status
make: *** [MYSBootloader.elf] Error 1not sure which library to include to resolve the issue.
-
-
@tekka
thanks for providing the steps to upload the MSYbootloader..
any idea why i'm getting following error in linking phase"avr-gcc" -Os -nostartfiles -Wl,-s -Wl,-static -Wl,-Map=".map" -Wl,--start-group -Wl,--end-group -Wl,--gc-sections -mrelax -Wl,-section-start=.text=0x7800 -mmcu=atmega328p -o MYSBootloader.elf MYSBootloader.o -lm
MYSBootloader.o: In functionmain': MYSBootloader.c:(.init9+0x288): undefined reference to__boot_page_erase_short'
MYSBootloader.c:(.init9+0x2b8): undefined reference to__boot_page_fill_short' MYSBootloader.c:(.init9+0x2d6): undefined reference to__boot_page_write_short'
MYSBootloader.c:(.init9+0x2e0): undefined reference to `__boot_rww_enable_short'
collect2: error: ld returned 1 exit status
make: *** [MYSBootloader.elf] Error 1not sure which library to include to resolve the issue.
-
For completeness, here are the MYSBootloader instructions for OTA updates via MYSController:
-
Load gw sketch and connect arduino either via serial or ethernet port. No special bootloader needed for that part (i.e. standard optiboot bootloader will do the job).
-
Add these lines to the boards.txt file in your Arduino IDE installation folder (located somewhere like C:/Program Files/Arduino/hardware/arduino/avr)
proMYSBL16.name=ATmega328 external 16Mhz with MYSBootloader
proMYSBL16.upload.tool=avrdude
proMYSBL16.upload.protocol=arduino
proMYSBL16.upload.maximum_size=30720
proMYSBL16.upload.maximum_data_size=2048
proMYSBL16.upload.speed=115200
proMYSBL16.bootloader.tool=avrdude
proMYSBL16.bootloader.low_fuses=0xF7
proMYSBL16.bootloader.high_fuses=0xDA
proMYSBL16.bootloader.extended_fuses=0x06
proMYSBL16.bootloader.unlock_bits=0x3F
proMYSBL16.bootloader.lock_bits=0xFF
proMYSBL16.bootloader.file=MySensors/MYSBootloader.hex
proMYSBL16.build.mcu=atmega328p
proMYSBL16.build.f_cpu=16000000L
proMYSBL16.build.board=AVR_UNO
proMYSBL16.build.core=arduino
proMYSBL16.build.variant=standard######## settings for 8Mhz internal clock
proMYSBL8.name=ATmega328 internal 8Mhz with MYSBootloader
proMYSBL8.upload.tool=avrdude
proMYSBL8.upload.protocol=arduino
proMYSBL8.upload.maximum_size=30720
proMYSBL8.upload.maximum_data_size=2048
proMYSBL8.upload.speed=57600
proMYSBL8.bootloader.tool=avrdude
proMYSBL8.bootloader.low_fuses=0xE2
proMYSBL8.bootloader.high_fuses=0xDA
proMYSBL8.bootloader.extended_fuses=0x06
proMYSBL8.bootloader.unlock_bits=0x3F
proMYSBL8.bootloader.lock_bits=0xFF
proMYSBL8.bootloader.file=MySensors/MYSBootloader.hex
proMYSBL8.build.mcu=atmega328p
proMYSBL8.build.f_cpu=8000000L
proMYSBL8.build.board=AVR_UNO
proMYSBL8.build.core=arduino
proMYSBL8.build.variant=standard -
Copy MYSBootloader.hex (from MYSController/Bootloader folder) to the Arduino IDE installation folder C:/Program Files/Arduino/hardware/arduino/avr/bootloaders/MySensors/
-
Restart Arduino IDE, choose under Tools | Board | ATmega328 external 16Mhz with MYSBootloader or Tools | Board | ATmega328 internal 8Mhz with MYSBootloader depending on your settings
-
Connect USBasp to sensor node and select Tools | Burn Bootloader
-
If everything worked well until here, you now have the MYSBootloader with the fuse settings from above burnt to your sensor node (16Mhz extXTAL or 8Mhz intRC, BOOTSZ 1024W, BOD 1V8).
-
Please use the AVR fuse calculator to retrieve the individual fuse settings. If you need to change frequency, BOD or other settings, change the fuse settings based on the fuse calculator.
Important: The MYSBootloader.hex file was compiled for 16Mhz oscillators but it should also work at 8Mhz. If you intend to go below 8Mhz, I highly recommend to compile the bootloader with adjusted frequency settings. -
Start MYSController, hit config and adjust settings (COM-Port & baud or IP address:port)
-
Hit connect: Connection to gateway should be established (gateway answers with gateway ready message), the node should appear and request an ID & FW.
-
Right-mouse click on that node, select assign FW, choose for example **TimeReporter ** (demo firmware included in the MYSController/Firmware folder). Then click reboot and wait until FW is uploaded and node boots.
-
TimeReporter firmware reports every few seconds some values such as time, millis, and voltage.
-
Custom firmware: compile your sketch and retrieve the generated .hex file (activate verbose mode in the Arduino IDE to get compiler messages and output path).
-
Copy .hex file to MYSController/Firmware folder and edit firmware_config.csv file according to the existing lines.
-
Hit Refresh Repo in MYSController and the newly copied firmware should appear in the Assign FW dropdown list, ready to be uploaded.
Have fun :)
@tekka
Goodmorning i've got a question:
Isn't it possible to write a Boards.txt for al boards? or does someone have this allready.
I tried to load the bootloader in a Arduino Uno (CH340 interface) but this didn't function.
It would be nice to load it in:
Arduino Mega 2560
Arduino Uno (official)
Arduino Uno (CH340) chinees clone
Arduino mini
Arduino nano
Arduino micro
etc. -
-
@tekka
Goodmorning i've got a question:
Isn't it possible to write a Boards.txt for al boards? or does someone have this allready.
I tried to load the bootloader in a Arduino Uno (CH340 interface) but this didn't function.
It would be nice to load it in:
Arduino Mega 2560
Arduino Uno (official)
Arduino Uno (CH340) chinees clone
Arduino mini
Arduino nano
Arduino micro
etc. -
@MarkV I'm not sure I understand your question - bootloaders are programmed via the ISP interface (e.g. USBasp or ArduinoISP as programmer), not via serial/usb interface.
@tekka
Thanks for the replay.
I ment i trying to load the boatloader into a arduino pro mini (clone) through a Arduino (as ISP) Mega 2560.
When i try to upload the boatloader i'm getting this error:avrdude: Yikes! Invalid device signature. Double check connections and try again, or use -F to override this check. Fout bij het branden van de bootloader.What's wrong and what should i change?
-
@MarkV I had this message two days ago as well. I was programming with usbasp. I have solved it by powering my pro mini with a separate power supply. So please check the cables.
-
@dynamite
Oh thanks, will do that. .
But why does it giveel this message.. i wouldn't link this message to a failty powernapp supply..@MarkV Dont't know, it helped in my case. Whether it was actually the power supply is the question. But if it helps in your case as well, than most probably yes. I think it has something to do with the communication and it reads a faulty or no signature.
-
@MarkV Dont't know, it helped in my case. Whether it was actually the power supply is the question. But if it helps in your case as well, than most probably yes. I think it has something to do with the communication and it reads a faulty or no signature.
@dynamite
tryed it and got a other error report:avrdude: Expected signature for ATmega328P is 1E 95 0F Double check chip, or use -F to override this check. Verkeerde microcontroller gevonden. Hebt u het correcte board geselecteerd in het menu Hulpmiddelen > Board?What now?
-
@dynamite
tryed it and got a other error report:avrdude: Expected signature for ATmega328P is 1E 95 0F Double check chip, or use -F to override this check. Verkeerde microcontroller gevonden. Hebt u het correcte board geselecteerd in het menu Hulpmiddelen > Board?What now?
@MarkV This is exactly the message I have received as well... Maybe check the other connection. Replace some cables? I the end I have been able to eliminate this message without changing anything in the software. In my case it was hardware related. (I was programming a pro mini and had it with two seperate mini's)
-
Hi,
I'm trying to burn 16Mhz version but I get the following error at the end:
avrdude: verification error, first mismatch at byte 0x0000 0x3f != 0xffProgrammer: Usbasp
-
Hi,
I'm trying to burn 16Mhz version but I get the following error at the end:
avrdude: verification error, first mismatch at byte 0x0000 0x3f != 0xffProgrammer: Usbasp
@Mayank-Raichura I had the same problem with usbasp. The fix was to remove the -D flag (disable auto erase) when running avrdude.
-
@Mayank-Raichura I had the same problem with usbasp. The fix was to remove the -D flag (disable auto erase) when running avrdude.
@Redferne Thanks. I'll check it out.