💬 Various bootloader files based on Optiboot 6.2
-
@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.
@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?
-
@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?
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?
-
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?
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.
-
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. -
@GertSanders if I load a sketch via Upload using programmer - how do I control the frequency? (1Mhz or 8Mhz internal or external crystal)
-
@GertSanders if I load a sketch via Upload using programmer - how do I control the frequency? (1Mhz or 8Mhz internal or external crystal)
@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.
-
@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.
@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?
-
@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?
-
@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?
@*alexsh1
*
Which fuses are set when loading a boot loader is defined by wich menu element in tools you have selected. Every processor or board you choose will correspond with values in a board.txt file.You can have several board.txt files: 1 file per "family" of boards.
When uploading sketches, the fusesettings are ignored, only the uploadspeed counts then. Both when uploading with Arduino as ISP as with FTDI interface.
The internal oscillator of 8 Mhz is not as accurate as a crystal, so at higher uploadspeeds the errorrate can increase or decrease depending on the mcu temperature.
Some uploadspeeds are closer to optimal then others in relation to the frequency at which the mcu works. The baudcalculator shows the errorrates. Most are non optimal. avrdude can handle an errorrate of 2% or less. So using a specific baudrate in combination with the internal 8Mhz oscillator depends on the worst case combination of transmission errorrate plus clock deviation error.
For most mcu's the rate of 9600 baud will be acceptable because at that slow rate a clockerror will be relative small. At higher speeds the small clockerror becomes more important. Then it is best to choose an upload speed close to the optimum.
The fusesettings are only burnt when loading a boot loader (within the Arduino IDE, in AVRStudio you can set fuses seperatly from loading anything).
The frequency of 8 Mhz can be obtained via a 8mhz crystal or the internal 8mhz oscillator. The low fuse value 0xE2 sets this internal oscillator. By using value 0x62 you also set the clock division bit in combination with the 8mhz internal oscillator, so your mcu will run at 8mhz / 8 = 1mhz
There are other division values possible. Calculate the low byte value using an avr fuse calculator.
You can also use an external 8 mhz crystal, and combine this with clock division by 8 to get 1mhz operation.
And you can choose an external 1mhz crystal.
All this from choose the right fuse bits.
Same for Brown out Detection which is set via the three least significant bits of the extended fuse.
-
@alexsh1 If you haven't touched the ATmega328p then it should be sitting with fuses of; L:0x62 H:0xD9 E:0xFF, which would run the uC at 1MHz
@samuel235 This is strange. The serial monitor was working only on 74880 - I do not think the AVR was running @ 1Mhz
-
@GertSanders Thanks for a detailed write-up!
@GertSanders said:
You can also use an external 8 mhz crystal, and combine this with clock division by 8 to get 1mhz operation.
And you can choose an external 1mhz crystal.
How is this influencing low power though? My understanding is that such setup (external crystal) takes more power.
-
@GertSanders Thanks for a detailed write-up!
@GertSanders said:
You can also use an external 8 mhz crystal, and combine this with clock division by 8 to get 1mhz operation.
And you can choose an external 1mhz crystal.
How is this influencing low power though? My understanding is that such setup (external crystal) takes more power.
Using a 1mhz crystal would not be the best thing for low power use, you are correct there.
But it gives a more accurate clock base for the timing functions.
-
Not sure what happened, but the following error returned:
Board atmega328p:avr:atmega328pO5M8c doesn't define a 'build.board' preference. Auto-set to: AVR_ATMEGA328PO5M8C Board atmega328p:avr:atmega328pO5M16c doesn't define a 'build.board' preference. Auto-set to: AVR_ATMEGA328PO5M16CI did not change anything so very strange why it comes up.
-
Actually, i have no proof but i've been informed from the arduino standalone microcontroller forums, that using a external 8mhz crystal is good for power consumption. ONLY if its a sleeping module though, it enables it to perform its tasks quicker and then sleep quicker, resulting in more time sleeping.
That error code is something i ran into, i'm guessing you're working inside of arduino IDE, if so its to do with your boards.txt entry. Its missing that entry that it speak about. Check that its there, if not enter it in manually.
-
Actually, i have no proof but i've been informed from the arduino standalone microcontroller forums, that using a external 8mhz crystal is good for power consumption. ONLY if its a sleeping module though, it enables it to perform its tasks quicker and then sleep quicker, resulting in more time sleeping.
That error code is something i ran into, i'm guessing you're working inside of arduino IDE, if so its to do with your boards.txt entry. Its missing that entry that it speak about. Check that its there, if not enter it in manually.
Thanks - yes you are right it is about boards.txt.
However, the problem is that I did not change anything. Two days ago I uploaded severa sketches and no errors were coming up and now two different boards are showing the same error. This is just odd... -
Thanks - yes you are right it is about boards.txt.
However, the problem is that I did not change anything. Two days ago I uploaded severa sketches and no errors were coming up and now two different boards are showing the same error. This is just odd... -
This message pops up since IDE 1.6.7
The new IDE expects this entry for all boards, just add it or ignore (it's more a warning then an error). -
And there you go, the forever informative @GertSanders has andwered your questioning ;)

