Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. OpenHardware.io
  3. 💬 Various bootloader files based on Optiboot 6.2

💬 Various bootloader files based on Optiboot 6.2

Scheduled Pinned Locked Moved OpenHardware.io
optiboot
164 Posts 18 Posters 64.2k Views 18 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • GertSandersG GertSanders

    @alexsh1

    My boards.txt file is pointing to a location you are not using.

    You have your library in a different place then I.

    You should make sure that the directory in which you put the variant matches with what you have. I can not know which directory you put the Arduino IDE, so matching this is an exercise for you ;-)

    In my case, my variants boards is here:

    \Dropbox\Arduino\hardware\atmega328p\avr\variants\BlueBoard\pins_arduino.h

    This is matched with the fact that my boards file is here:

    \Dropbox\Arduino\hardware\atmega328p\avr\boards.txt

    Within the boards.txt file, I'm referring to the following variant: "BlueBoard". This is done here:

    BlueBoard.build.core=arduino:arduino
    BlueBoard.build.mcu=atmega328p

    BlueBoard.build.board=AVR_GERTSANDERSBLUEBOARD
    BlueBoard.build.variant=BlueBoard

    You seem to have a different path:

    C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino

    I'm not sure where you added my files or boards.txt, but do not just copy it. You need to adapt your boards.txt file.

    My "hardware" directory is within the Arduino sketch directory and contains this:

    0_1457376393781_Screen Shot 2016-03-07 at 19.46.19.png

    All my boot loaders are in directory "bootloaders\myoptiboot":

    0_1457376449884_Screen Shot 2016-03-07 at 19.46.48.png

    the file pins_arduino.h is a pins layout file for a standard atmega328p (copied from the "standard" variant directory.

    If you have a pro micro with the flat atmega328p, you need to use the "eightanaloginputs" variant.

    This is what it looks like in my Arduino IDE installation directory:

    0_1457377256653_Screen Shot 2016-03-07 at 20.00.43.png

    alexsh1A Offline
    alexsh1A Offline
    alexsh1
    wrote on last edited by
    #19

    @GertSanders said:

    I'm not sure where you added my files or boards.txt, but do not just copy it. You need to adapt your boards.txt file.

    That's what I did - I adopted your boards.txt
    All my bootloaders are in the hardware directory (C:\Users\Alex\Documents\Arduino\hardware). The hardware directory is located together with all my sketches in the Arduino directory. Now, for whatever reason, the error is point out to the completely different location:

    C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino

    C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino

    1 Reply Last reply
    0
    • alexsh1A Offline
      alexsh1A Offline
      alexsh1
      wrote on last edited by alexsh1
      #20

      @GertSanders OK, I sorted it out.
      I had to create "BlueBoard" and "standard" under "variants" and copy two corresponding files pins_arduino.h
      At least I can compile now.

      Will try to upload a sketch later on and see if it works.

      1 Reply Last reply
      1
      • alexsh1A Offline
        alexsh1A Offline
        alexsh1
        wrote on last edited by alexsh1
        #21

        @GertSanders Unfortunately, I was able to upload the bootloader, but was not able to upload any sketches on the breadboard:

        avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x78
        avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0xc0
        avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x78
        

        Not sure why - I can upload a sketch via the programmer though. Will upload Nick Gammon sketch to test the bootloader.

        UPDATE1: Nick Gammon's sketch cannot detect the bootloader (tried 1MHz internal). Once again, I uploaded the bootloader (1Mhz internal) and the sketch via the programmer and it works, but....the serial monitor works only on 74880, despite for "1Mhz internal" boards.txt clearly says "9600":

        BlueBoard.menu.mhz.1Mi= 1Mhz - internal - 9K6 upload speed
        BlueBoard.menu.mhz.1Mi.bootloader.low_fuses=0xE2
        BlueBoard.menu.mhz.1Mi.bootloader.high_fuses=0xDE
        BlueBoard.menu.mhz.1Mi.build.f_cpu=1000000L
        BlueBoard.menu.mhz.1Mi.upload.speed=9600
        BlueBoard.menu.mhz.1Mi.bootloader.file=myoptiboot/optiboot_atmega328_01M_009600_B0.hex
        

        Additionally, I loaded the ASCIITable example sketch and it states " Serial.begin(9600);"
        I do not understand why it works only on 74880...

        GertSandersG 1 Reply Last reply
        0
        • alexsh1A alexsh1

          @GertSanders Unfortunately, I was able to upload the bootloader, but was not able to upload any sketches on the breadboard:

          avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x78
          avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0xc0
          avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x78
          

          Not sure why - I can upload a sketch via the programmer though. Will upload Nick Gammon sketch to test the bootloader.

          UPDATE1: Nick Gammon's sketch cannot detect the bootloader (tried 1MHz internal). Once again, I uploaded the bootloader (1Mhz internal) and the sketch via the programmer and it works, but....the serial monitor works only on 74880, despite for "1Mhz internal" boards.txt clearly says "9600":

          BlueBoard.menu.mhz.1Mi= 1Mhz - internal - 9K6 upload speed
          BlueBoard.menu.mhz.1Mi.bootloader.low_fuses=0xE2
          BlueBoard.menu.mhz.1Mi.bootloader.high_fuses=0xDE
          BlueBoard.menu.mhz.1Mi.build.f_cpu=1000000L
          BlueBoard.menu.mhz.1Mi.upload.speed=9600
          BlueBoard.menu.mhz.1Mi.bootloader.file=myoptiboot/optiboot_atmega328_01M_009600_B0.hex
          

          Additionally, I loaded the ASCIITable example sketch and it states " Serial.begin(9600);"
          I do not understand why it works only on 74880...

          GertSandersG Offline
          GertSandersG Offline
          GertSanders
          Hardware Contributor
          wrote on last edited by GertSanders
          #22

          @alexsh1

          I will do some testing tonight, I have not used the 1MHz bootloader yet.

          The instruction Serial.begin(9600) is independant of the upload.speed mentioned in the boards file. But I would expect that at 1MHz the higher serial comms speeds also give errors.

          A possible reason for the problem, is that the fuse E2 actually means that you run the processor at 8Mhz internally, but without any clock division, while the bootloader was compiled for 1MHz. Without clock division by 8 the processor actually runs at 8Mhz (the speed of the internal oscillator), while all timing code is set for a cpu working frequency of 1Mhz. This would also explain why you can communicate at 74880 (which is close to 76800, which in turn is 8 times 9600).

          I think the fuse should be set to both internal 8MHz oscillator AND clock division by 8. I do not know that correct value by hart, need to check that with a fuse calculator.

          UPDATE: I think the lower fuse should be set to 0x62 instead of 0xE2.

          1 Reply Last reply
          0
          • alexsh1A Offline
            alexsh1A Offline
            alexsh1
            wrote on last edited by
            #23

            @GertSanders

            OK, I have come to the following fuse settings for 1Mhz internal:

            BlueBoard.menu.mhz.1Mi.bootloader.low_fuses=0x62
            BlueBoard.menu.mhz.1Mi.bootloader.high_fuses=0xDE
            

            For Optiboot, the high fuse is always 0xDE.
            Now, a standard example sketch runs at 9600 - I have not checked if atmega328p is running at 1Mhz.

            Still have a problem uploading a sketch on the breadboard via FTDI

            GertSandersG 2 Replies Last reply
            0
            • alexsh1A alexsh1

              @GertSanders

              OK, I have come to the following fuse settings for 1Mhz internal:

              BlueBoard.menu.mhz.1Mi.bootloader.low_fuses=0x62
              BlueBoard.menu.mhz.1Mi.bootloader.high_fuses=0xDE
              

              For Optiboot, the high fuse is always 0xDE.
              Now, a standard example sketch runs at 9600 - I have not checked if atmega328p is running at 1Mhz.

              Still have a problem uploading a sketch on the breadboard via FTDI

              GertSandersG Offline
              GertSandersG Offline
              GertSanders
              Hardware Contributor
              wrote on last edited by
              #24

              @alexsh1

              I will do some tests later tonight.

              1 Reply Last reply
              1
              • alexsh1A alexsh1

                @GertSanders

                OK, I have come to the following fuse settings for 1Mhz internal:

                BlueBoard.menu.mhz.1Mi.bootloader.low_fuses=0x62
                BlueBoard.menu.mhz.1Mi.bootloader.high_fuses=0xDE
                

                For Optiboot, the high fuse is always 0xDE.
                Now, a standard example sketch runs at 9600 - I have not checked if atmega328p is running at 1Mhz.

                Still have a problem uploading a sketch on the breadboard via FTDI

                GertSandersG Offline
                GertSandersG Offline
                GertSanders
                Hardware Contributor
                wrote on last edited by GertSanders
                #25

                @alexsh1

                I just loaded a blink sketch at 4800 baud using FTDI and that works with the following combination:

                Boot loader:
                0_1457554985438_optiboot_atmega328_08M1_004800_B0.hex

                Fuses:
                BlueBoard.menu.mhz.1Mi48= 1Mhz - internal 8MHz DIV 8 - 4K8 upload speed
                BlueBoard.menu.mhz.1Mi48.bootloader.low_fuses=0x62
                BlueBoard.menu.mhz.1Mi48.bootloader.high_fuses=0xDE
                BlueBoard.menu.mhz.1Mi48.build.f_cpu=1000000L
                BlueBoard.menu.mhz.1Mi48.upload.speed=4800
                BlueBoard.menu.mhz.1Mi48.bootloader.file=myoptiboot/optiboot_atmega328_08M1_004800_B0.hex

                You will have to strip the "0_1457554985438_" part from the uploaded filename.

                Loading the sketch is VERY slow, but it works perfectly. The Blink sketch blinks the led at 500ms on and 500ms off, and that is checked on the breadboard.

                Whether the processor actually runs at 1MHz I do not know for sure, since I have no frequency meter (still missing from my toolbox).

                I used an arduino as ISP to load the boot loader, and then used an FTDI interface (from Adafruit) to load the sketch while the atmega328 was plugged in a breadboard (Gammon style).

                Next I will try with the 9600 baud version at 1Mhz.

                alexsh1A 1 Reply Last reply
                1
                • GertSandersG GertSanders

                  @alexsh1

                  I just loaded a blink sketch at 4800 baud using FTDI and that works with the following combination:

                  Boot loader:
                  0_1457554985438_optiboot_atmega328_08M1_004800_B0.hex

                  Fuses:
                  BlueBoard.menu.mhz.1Mi48= 1Mhz - internal 8MHz DIV 8 - 4K8 upload speed
                  BlueBoard.menu.mhz.1Mi48.bootloader.low_fuses=0x62
                  BlueBoard.menu.mhz.1Mi48.bootloader.high_fuses=0xDE
                  BlueBoard.menu.mhz.1Mi48.build.f_cpu=1000000L
                  BlueBoard.menu.mhz.1Mi48.upload.speed=4800
                  BlueBoard.menu.mhz.1Mi48.bootloader.file=myoptiboot/optiboot_atmega328_08M1_004800_B0.hex

                  You will have to strip the "0_1457554985438_" part from the uploaded filename.

                  Loading the sketch is VERY slow, but it works perfectly. The Blink sketch blinks the led at 500ms on and 500ms off, and that is checked on the breadboard.

                  Whether the processor actually runs at 1MHz I do not know for sure, since I have no frequency meter (still missing from my toolbox).

                  I used an arduino as ISP to load the boot loader, and then used an FTDI interface (from Adafruit) to load the sketch while the atmega328 was plugged in a breadboard (Gammon style).

                  Next I will try with the 9600 baud version at 1Mhz.

                  alexsh1A Offline
                  alexsh1A Offline
                  alexsh1
                  wrote on last edited by
                  #26

                  @GertSanders said:

                  Next I will try with the 9600 baud version at 1Mhz.

                  THanks
                  I'm looking forward to this - 4800 is way too slow.
                  I think the way to check the frequency is to time delay(1000); in the blink sketch...

                  GertSandersG 1 Reply Last reply
                  0
                  • alexsh1A alexsh1

                    @GertSanders said:

                    Next I will try with the 9600 baud version at 1Mhz.

                    THanks
                    I'm looking forward to this - 4800 is way too slow.
                    I think the way to check the frequency is to time delay(1000); in the blink sketch...

                    GertSandersG Offline
                    GertSandersG Offline
                    GertSanders
                    Hardware Contributor
                    wrote on last edited by GertSanders
                    #27

                    @alexsh1

                    I just tested with the 9600 baud version at 1MHz, and the blink sketch at 250ms, 500ms and 1000ms per on/off cycle. All rock solid and as expected.

                    Here is the setup I tested the transfer with FTDI:

                    0_1457556540048_IMG_7815.jpg

                    0_1457556805834_IMG_7816.jpg

                    I used the following combination:

                    Boot loader:

                    0_1457556618255_optiboot_atmega328_01M_009600_B0.hex

                    Fuses:
                    BlueBoard.menu.mhz.1Mi= 1Mhz - internal 8MHz DIV 8 - 9K6 upload speed
                    BlueBoard.menu.mhz.1Mi.bootloader.low_fuses=0x62
                    BlueBoard.menu.mhz.1Mi.bootloader.high_fuses=0xDE
                    BlueBoard.menu.mhz.1Mi.build.f_cpu=1000000L
                    BlueBoard.menu.mhz.1Mi.upload.speed=9600
                    BlueBoard.menu.mhz.1Mi.bootloader.file=myoptiboot/optiboot_atmega328_01M_009600_B0.hex

                    Also here the "0_1457556618255_" is added by uploading on this forum, strip when downloaded.

                    Uploads were at twice the speed then before. Still slow, but acceptable.

                    1 Reply Last reply
                    2
                    • alexsh1A Offline
                      alexsh1A Offline
                      alexsh1
                      wrote on last edited by
                      #28

                      @GertSanders I have the same breadboard setup, but can only read serial and cannot upload a sketch (out of sync). My settings are the same as yours as per my post earlier on today so I reckon it must be something wrong with the wiring on the breadboard since "Uploading using Programmer" works fine. Not sure what it is as I checked it a few times today.

                      GertSandersG 1 Reply Last reply
                      0
                      • alexsh1A alexsh1

                        @GertSanders I have the same breadboard setup, but can only read serial and cannot upload a sketch (out of sync). My settings are the same as yours as per my post earlier on today so I reckon it must be something wrong with the wiring on the breadboard since "Uploading using Programmer" works fine. Not sure what it is as I checked it a few times today.

                        GertSandersG Offline
                        GertSandersG Offline
                        GertSanders
                        Hardware Contributor
                        wrote on last edited by GertSanders
                        #29

                        @alexsh1
                        Maybe make a picture of your setup?
                        Upload using programmer means you use another Arduino to load the sketch on the atmega328, which at the same time deletes any bootloader.
                        I load bootloaders with an Arduino and the sketch ArduinoISP loaded on that one. Then I issue a "burn bootloader" command.
                        To load sketches I switch to my FTDI interface and upload sketches with the same processor setting. But as said with a different interface. And I do not use "upload using programmer", but the upload button next to the compile button.

                        Maybe I should try to make a video like Mr Pete.

                        alexsh1A 1 Reply Last reply
                        0
                        • GertSandersG GertSanders

                          @alexsh1
                          Maybe make a picture of your setup?
                          Upload using programmer means you use another Arduino to load the sketch on the atmega328, which at the same time deletes any bootloader.
                          I load bootloaders with an Arduino and the sketch ArduinoISP loaded on that one. Then I issue a "burn bootloader" command.
                          To load sketches I switch to my FTDI interface and upload sketches with the same processor setting. But as said with a different interface. And I do not use "upload using programmer", but the upload button next to the compile button.

                          Maybe I should try to make a video like Mr Pete.

                          alexsh1A Offline
                          alexsh1A Offline
                          alexsh1
                          wrote on last edited by alexsh1
                          #30

                          @GertSanders Yes, this is normally the way I do (burn bootloader and then upload a sketch via FTDI on the breadboard). Will post photos shortly.

                          Are you sure "Upload using programmer" deleting the bootloader?

                          alexsh1A 1 Reply Last reply
                          0
                          • alexsh1A alexsh1

                            @GertSanders Yes, this is normally the way I do (burn bootloader and then upload a sketch via FTDI on the breadboard). Will post photos shortly.

                            Are you sure "Upload using programmer" deleting the bootloader?

                            alexsh1A Offline
                            alexsh1A Offline
                            alexsh1
                            wrote on last edited by
                            #31

                            @GertSanders

                            Are you sure "Upload using programmer" deleting the bootloader?

                            Yes, looks like you are right - it kills the bootloader. So what's happening? I do not have any bootloader when I use this method to load up sketches?

                            GertSandersG 1 Reply Last reply
                            0
                            • alexsh1A alexsh1

                              @GertSanders

                              Are you sure "Upload using programmer" deleting the bootloader?

                              Yes, looks like you are right - it kills the bootloader. So what's happening? I do not have any bootloader when I use this method to load up sketches?

                              GertSandersG Offline
                              GertSandersG Offline
                              GertSanders
                              Hardware Contributor
                              wrote on last edited by
                              #32

                              @alexsh1

                              If you load a sketch with "Upload using programmer" you replace anything in flash with the sketch. Just the sketch will run on the mcu.

                              In the very narrow node, there is no FTDI connector, so for those nodes it does not make sense to have a boot loader in flash (it does not hurt either). You couldvjust as well just load the sketch and skip the boot loader altogether.

                              If you need the extra 512 that optiboot occupies, then "Upload using programmer" allows you to recuperate that space.

                              So this shoudl explain why you can reed data from the Node via Serial (because the sketch is running and taking care of the serial connection), but why uploading a sketch fails, because for that you need a boot loader in flash.

                              1 Reply Last reply
                              0
                              • alexsh1A Offline
                                alexsh1A Offline
                                alexsh1
                                wrote on last edited by
                                #33

                                @GertSanders

                                I did a short video how I upload optiboot

                                Finally, success!
                                I think I had to reassemble the breadboard set-up three times before finally being able to upload the sketch. I think the problem was no connection at RTS, but I am not sure. I need to assemble a more permanent board to upload sketches via FTDI.

                                1 Reply Last reply
                                0
                                • alexsh1A Offline
                                  alexsh1A Offline
                                  alexsh1
                                  wrote on last edited by alexsh1
                                  #34

                                  FTDI Adapter

                                  1 Reply Last reply
                                  0
                                  • alexsh1A Offline
                                    alexsh1A Offline
                                    alexsh1
                                    wrote on last edited by
                                    #35

                                    My Set-up

                                    1 Reply Last reply
                                    0
                                    • alexsh1A Offline
                                      alexsh1A Offline
                                      alexsh1
                                      wrote on last edited by alexsh1
                                      #36

                                      @GertSanders if I load a sketch via Upload using programmer - how do I control the frequency? (1Mhz or 8Mhz internal or external crystal)

                                      S 1 Reply Last reply
                                      0
                                      • alexsh1A alexsh1

                                        @GertSanders if I load a sketch via Upload using programmer - how do I control the frequency? (1Mhz or 8Mhz internal or external crystal)

                                        S Offline
                                        S Offline
                                        Samuel235
                                        Hardware Contributor
                                        wrote on last edited by Samuel235
                                        #37

                                        @alexsh1 - You would do this by setting the correct fuses. Can you just confirm my information @GertSanders :)

                                        I would also like to state that Atmel does not support or even recommend using FTDI with the internal crystal, my current board just will not upload via FTDI and no external crystal however yet a arduino pro mini does and that uses an external crystal with no other circuitry compared to my board apart from the physical reset switch.

                                        MySensors 2.1.1
                                        Controller - OpenHAB (Virtual Machine)
                                        Gateway - Arduino Mega MQTT Gateway W5100

                                        alexsh1A 1 Reply Last reply
                                        0
                                        • S Samuel235

                                          @alexsh1 - You would do this by setting the correct fuses. Can you just confirm my information @GertSanders :)

                                          I would also like to state that Atmel does not support or even recommend using FTDI with the internal crystal, my current board just will not upload via FTDI and no external crystal however yet a arduino pro mini does and that uses an external crystal with no other circuitry compared to my board apart from the physical reset switch.

                                          alexsh1A Offline
                                          alexsh1A Offline
                                          alexsh1
                                          wrote on last edited by
                                          #38

                                          @samuel235 said:

                                          @alexsh1 - You would do this by setting the correct fuses. Can you just confirm my information @GertSanders :)

                                          I think you have a point, but if I do not change anything, just use "Upload using programmer", what are the default frequency and fuses?

                                          S GertSandersG 2 Replies Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          27

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.1k

                                          Posts


                                          Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular