Pages: [1]   Go Down
Author Topic: board types & bootloaders  (Read 2245 times)
0 Members and 1 Guest are viewing this topic.
Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 525
Posts: 26569
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I've been reviewing the 8-bit family and the various boards and chip types supported. I'm thinking the Open source-ness could be expanded to cover more chip types as supported replacement parts (why should an Uno be just a 328P when there are other drop-in replacements available?) and that 2 new families could be easily supported, both of which really just support a different number of ports between the 20 of the Uno/Leonardo type and the 70 of the Mega.

My review suggests the number of supported chip types could easily be expanded with just a few additions to the avrdude.conf, adding about 6 types by copying existing types and changing the signature byte & memory size. 
Then adding some new board types that will be based on the processor selected.

The family names could be cleaned up to reflect the processor selected.
For example we could have the:

Uno4,8, 88, 168, 328 and Uno4p, 8p, 88p, 168p, 328p in 3.3V/8MHz and 5V/16MHz options.
Lilypad, Diecimla, Duemilanove, Fio, Nano, BT, and Mini's would get programmed as one of these.
Things like external Serial adapters, voltage regulators/selection, are are just different board form factors for the same 20 IO pin chip which the bootloader shouldn't care about.
Expand the pins_arduino.h in each family to make all IO available - so really just use the 22 pins called out by the Fio (I think that's the one that supports A6/A7 of the '328).

Mega640, 1280, 2560, in 3.3V/8MHz and 5V/16MHz options.

Leonardo16 and 32. The Micro would get programmed as one of these. 3.3V & 5V options?

And add 2 new families:

Mighty16, 32, 162, 164a, 164p, 324a, 324p, 324pa, 644, 644p, 1284, and 1284p in 3.3V/8MHz and 5V/16MHz options. All are just memory size variations really of maniacbug's mighty 1284.

Milli64, 128, 1281, 2561 in 3.3V/8MHz and 5V/16MHz options.  These would be new with # of less than a Mega but more than the Mighty. I think the Mega could be easily modified to cut out a few pins and end up as this pretty easily.

Expand the Tools:Board selection to cover these.
Tools:Board:Speed/Voltage:Uno/Mega/Leonardo/Milli/Mighty, with the boards above listed under each family so the drop down list doesn't become unwieldy as it does now when Variants are added.
Could even add one selection level - internal/external oscillator with 1/4/8/16 MHz options for lower power situations.

The difference in any family is really just memory size, reflected in the name/signature bytes, with a voltage/speed option.
For example, a Mega168, 168A, and 168V all use the same signature bytes,
while Mega168P, 168PA, 168PV have a different signature byte. 
All 20 IO pin parts would use the same bootloader, the fuse bytes would be slightly different for 8 MHZ vs 16 MHZ, and for external/internal oscilator.

Then the number of bootloaders could be cleaned up also, I think to just 1 per family, vs the current 9 for 168s and 5 for '328s for example.

I could do some of these pretty easily:
copy/paste/modify sections of avrdude.conf is straightforward
copy/paste/modify sections of boards.txt is straightforward. New fuse choices a little more invovled, but not much.
Mucking with the menu structure to provide the speed choice/oscilator choice/family choice is beyond me. Adding to boards.txt as is just results in a really long list.

Thoughts?

* chip comparison.xls (55.5 KB - downloaded 20 times.)
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Greenville, IL
Offline Offline
Edison Member
*
Karma: 15
Posts: 1328
Warning Novice on board! 0 to 1 chance of errors!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


  Along those lines, I would like a sheet or template where you fill in the blanks and you could have your new boards text and needed files ready to go. Ideally, some sort of board file generator program.

 Example lines would include thinks like clock rate, flash size, program baud rate etc..

 One purpose would be to make it easier to add the new Arm chips to the new Arduino 1.5 IDE.
Logged


SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 124
Posts: 6654
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Making the menus more complete makes them harder to understand and use.  (an age-old problem!)
I want an easy mechanism to remove the boards I don't have from the boards menu...
Logged

Greenville, IL
Offline Offline
Edison Member
*
Karma: 15
Posts: 1328
Warning Novice on board! 0 to 1 chance of errors!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Making the menus more complete makes them harder to understand and use.  (an age-old problem!)
I want an easy mechanism to remove the boards I don't have from the boards menu...


I do understand that! I have about 5 versions of the IDE on my computer and one advantage is having a smaller board list on a couple of the versions. I added the ATTiny series and my list got huge quickly!


 In my statement earlier, I was hoping to have a way to create a board with a new chip type that is not currently in use. For instance, if I picked another Sam chip besides the one that is used on the Due, I would have to do a lot of homework to figure out how to set-up the needed files.

  It would probably take a totally separate tool, to create boards by filling out a list but, that is what a person at my level would need to create the needed files for a new chip.

 Just imagine, grab nearly any AVR chip, fill out the list with the specifications, hit a button for it to create the files, and BOOM you are ready to start programming.

 I realize this may be a lot harder than I realize.  smiley-cry
Logged


Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17263
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I realize this may be a lot harder than I realize.

Sure is. Add the need for a pins.h file to map the I/O pins and define the timers/pwm pins, etc. Then throw in the variation in bootloaders and you have a quite the challenging application to automate that into an existing IDE installation. There is a whole lot of stuff that goes into what the user sees and manipulates on the IDE and what all the 3rd party tool chain components and libraries have to have to operate correctly.

I guess the real genius of the Arduino IDE (and just like with a bumble bee) is not how well it 'flies', but the fact that it 'flies' at all.

Lefty
Logged

Greenville, IL
Offline Offline
Edison Member
*
Karma: 15
Posts: 1328
Warning Novice on board! 0 to 1 chance of errors!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I guess the real genius of the Arduino IDE (and just like with a bumble bee) is not how well it 'flies', but the fact that it 'flies' at all.

    smiley-lol

Logged


Dubuque, Iowa, USA
Offline Offline
Edison Member
*
Karma: 45
Posts: 2474
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Personally prefer if the chip name (e.g. ATMega 128) was used instead of the board name (e.g. Uno) and the menu should be nested with the chip at the first level and the speed/oscillator at the second.

Java: Write, wince, run away. smiley-wink
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 525
Posts: 26569
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Here's my first pass at adding the chip types.
Rename your current files and save these into their place.
Not sure why but 2 of them, the '328 and 16U4, fail when I try to compile a program.
Think there might be some deeper change needed as well.

Gonna work on '1284 family parts tomorrow.
Then '2561 family after that. Don't know if I know enough for those.

* boards.txt (20.65 KB - downloaded 26 times.)
* avrdude.conf (591.23 KB - downloaded 21 times.)
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 525
Posts: 26569
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I was having problems with the Uno328 and Leonardo16  board types.

I have a solution with Coding Badly's help.

http://arduino.cc/forum/index.php/topic,60649.msg437771.html#msg437771
See reply #1. Follow all the steps, ignoring the ATtiny xx stuff in the middle.

This seems to be a more direct link to WinAVR
http://sourceforge.net/projects/winavr/?source=directory

I then copied the ATMEGA328P section into a new ATMEGA328 section and changed the last signature byte from 0x0F to 0x14, thatcompiles now.
And the Leonardo16 stuff I made for Atmega16U4 compiles now too.

Will check out more of them tomorrow, and see if the stuff I made today for '1284 family of chips works.

Then, on to the '2561 family with 56 IO pins in 64 pin TQFP package.

* 1284boards to try.txt (19.18 KB - downloaded 26 times.)
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Crossroads,
It sounds like you're the person I need to talk to. I took the "Mighty 1284" boards.txt files and the associated optiboot executables,  and installed them in "Arduino1-5". When verifying a sketch, it can't find "Arduino.h".  Is that because of the extra directory level (Avr) in the cores path?

I then moved the "Mighty 1284" to "Arduino1.0.2".  Verify can now find the "Arduino.h file, no AVR directory, but it can't find the "Serial" function.  Neither could "Arduino1-5".

If I change the board type to UNO, it verifies fine, of course it wont execute correctly.

Got any ideas?

P.S. Why different boot loaders for different clock speeds, does the boot loader contain speed dependent code?

Following is my boards.txt entry.


atmega1284_8.name=ATMega1284P 8MHz using Optiboot 3.3V

atmega1284_8.upload.protocol=arduino
atmega1284_8.upload.maximum_size=130048
atmega1284_8.upload.speed=57600

atmega1284_8.bootloader.low_fuses=0xff
atmega1284_8.bootloader.high_fuses=0xde
atmega1284_8.bootloader.extended_fuses=0xfd
atmega1284_8.bootloader.path=optiboot
atmega1284_8.bootloader.file=optiboot_atmega1284p_8MHz.hex
atmega1284_8.bootloader.unlock_bits=0x3F
atmega1284_8.bootloader.lock_bits=0x0F

atmega1284_8.build.mcu=atmega1284p
atmega1284_8.build.f_cpu=8000000L
atmega1284_8.build.core=standard
atmega1284_8.build.variant=standard

This is the sketch I'm working with.  As you can see it's extremely complicated.

//#include "Wiz820.h"
#include <Arduino.h>
void setup(){
  Serial.begin(9600);
}

void loop(){
}

Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 525
Posts: 26569
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I'd be concerned about these notes:

•'Original Mighty 1284p 16MHz'. The very first bootloader I ever got working. Not recommended for use, but here as historical record.
 •'Original Mighty 1284p 8MHz'. Ditto, but runs at 8MHz.

Did you follow the installation steps here?
https://github.com/maniacbug/mighty-1284p

I've only been running the 16 MHz  version
optiboot_atmega1284p.hex
with this boards.txt entry:

Code:
bobuino.name=Bobuino
bobuino.upload.protocol=arduino
bobuino.upload.maximum_size=130048
bobuino.upload.speed=115200
bobuino.bootloader.low_fuses=0xff
bobuino.bootloader.high_fuses=0xde
bobuino.bootloader.extended_fuses=0xfd
bobuino.bootloader.path=optiboot
bobuino.bootloader.file=optiboot_atmega1284p.hex
bobuino.bootloader.unlock_bits=0x3F
bobuino.bootloader.lock_bits=0x0F
bobuino.build.mcu=atmega1284p
bobuino.build.f_cpu=16000000L
#bobuino.build.core=arduino:arduino
bobuino.build.core=standard
bobuino.build.variant=bobuino
I would try that with this line changed to 8 MHz
bobuino.build.f_cpu=16000000L
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17263
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
P.S. Why different boot loaders for different clock speeds, does the boot loader contain speed dependent code?
Yes the bootloader has to properly setup the chips internal baud rate generator to be able to work with the Arduino IDE via USB serial communications for the upload process to work. That is why a bootloader has to be specifically compiled knowing what clock speed and baudrate are going to be used with the chip and why the associated entry in the IDE's board.txt has to have a matching clock speed and baud rate to use to upload to that specific board selection.

Lefty

Logged

vermont
Offline Offline
Sr. Member
****
Karma: 8
Posts: 308
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

interestingly i found the same optiboot works for 8mhz and 16mhz. requires 57kbaud and 115kbaud respectively but a great time saver because no need to burn new bootloader when changing clock speeds which i do often. in fact i just change the fuse from xtl to rc so no need to modify the hardware at all either. this trick works for all my m8, m328, and m1284 projects.
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17263
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
interestingly i found the same optiboot works for 8mhz and 16mhz. requires 57kbaud and 115kbaud respectively

Not surprising if you look into how the baud rate divider works in a AVR chip as it uses the chips clock speed as it's input frequency and in software you provide the 'correct' divider value to work at the baud rate you want the serial UART to run at. So it's true that the same baud rate divider value will run at exactly half the baud rate if you run the chip clock speed at exactly half the value, it's math.  smiley-grin

Lefty
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi dear colleagues!

Could you help me with right me with correct bootloader for Atmega1280 with 8 Mhz because all my attempts to create it from standard files from arduino-1.0.1\hardware\arduino\bootloaders\atmega (I mean -ATmegaBOOT_168_atmega1280.hex) or files from arduino-1.0.1\hardware\arduino\bootloaders\stk500v2 after corresponding settings, like:
1. MCU = atmega1280
2. F_CPU = 8000000
3. BOOTLOADER_ADDRESS = 1E000
and setting communication speed didn't give me expected result - my mega board still don't work unfortunately.

So, I would like to ask you help me with right bootloder for Atmega1280_8Mhz for Arduino IDE (if you have it only in *.hex that will be ok too) and what is the communication speed for downloading I have to set then to download sketches after when bootloader will be in a right place.


Any help will be very welcomed, pls!

Best wishes.
Logged

Pages: [1]   Go Up
Jump to: