Pages: 1 [2] 3 4   Go Down
Author Topic: Looking for a bootloader for the 1284p at 16mhz, anyone know of one?  (Read 3812 times)
0 Members and 1 Guest are viewing this topic.
Smithfield, Rhode Island
Offline Offline
God Member
*****
Karma: 2
Posts: 843
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have several custom boards with 1284Ps. The bootloader combination that worked best for me was the brewtroller software suite. Last time I checked, it wasn't yet up to Arduino 1.0 but you can download a customized version of the 0023 IDE that contains all the files to make these chips work.

You will, however, need the proper hardware to burn the bootloader. The Adafruit unit I have won't do the trick, the AVR MSKPII I bought later does.

What difference does the IDE make for the bootloader? Hardware to burn a boot loader is readily available, so that's not a big deal. I'll check that one out, thank you!
 
Logged

Peoples Republic of Cantabrigia
Offline Offline
God Member
*****
Karma: 6
Posts: 691
Arduino happiness
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Skyjumper, nice to hear from you. Keep in mind that you'll likely forget more about these chips, etc. in a day than I'll ever know.

What made the Brewtroller suite a compelling sell for me was the seamless integration of all the required modifications to make a 1284P work with the Arduino IDE. I did have to learn some of the pin assignments but that's not a big deal. They have a complete IDE to download on their web-site, where all the Sanguino files are in the right places, all the core files have been modified to suit the 1284P, etc. It's the package to download, IMO.

So, I'm still using the 022 IDE for now, never upgraded to 023 because everything 'just works' as is. At some point in the future, the Brewtroller folk may upgrade their software releases to version 1.0 of the IDE. Similarly, Maniacbug appears to have cracked the bootloader nut also. As for me, even though I successfully burned a Brewtroller bootloader, the pain involved in switching to and fro in terms of programmers (ISP) made me decide to use my AVR ISP exclusively as a uploader. So I don't know if the bootloader works - but presume it does since it uploaded OK.
Logged

Smithfield, Rhode Island
Offline Offline
God Member
*****
Karma: 2
Posts: 843
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So, I'm still using the 022 IDE for now, never upgraded to 023 because everything 'just works' as is. At some point in the future, the Brewtroller folk may upgrade their software releases to version 1.0 of the IDE. Similarly, Maniacbug appears to have cracked the bootloader nut also. As for me, even though I successfully burned a Brewtroller bootloader, the pain involved in switching to and fro in terms of programmers (ISP) made me decide to use my AVR ISP exclusively as a uploader. So I don't know if the bootloader works - but presume it does since it uploaded OK.

Constantin, thanks for the kind words but I'm really not that much of an expert.

Maniacbug's bootloader actually has the same issue mine does, and apparently Optiboot also has, in that they can only program half the flash space. The Brewtroller package is something I need to look at, maybe tonight if I have time. If Brewtroller is a complete dev environment based upon the Arduino 22 version, then perhaps it uses AVRDUDE to talk to its boot loader. If so, then we should be able to make it work with the 22, 23 or 1.0 IDE. I'll see what I can figure out.

Have a look a the Chip45.com bootloader. I had issues with it, but I don't know if they are related to my hardware or a problem with the boot loader. Its free and it will program all the flash. It does not work with AVRDUDE but he includes a free GUI app for uploading HEX files. If you give it a try, after you upload the HEX file, double check to make sure the HEX file really got uploaded or at least test it to make sure its running correctly.

Logged

Smithfield, Rhode Island
Offline Offline
God Member
*****
Karma: 2
Posts: 843
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Okay I looked through the Brewtroller package. They do list the 1284P in their boards.txt file and there is a reference to a boot loader, but the actual bootloader does not appear. They have source for a few boot loaders including one for the ATMega1280, which has the same amount of flash as the 1284P. And they have bootloaders for several other processors. I also poked through the make files but didn't see an option to build a 1284.

I'll take a look at the source for the 1280 and see if it can be easily adapted to the 1284.
Logged

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

I'll take a look at the source for the 1280 and see if it can be easily adapted to the 1284.
That would be very much appreciated smiley
Logged

Smithfield, Rhode Island
Offline Offline
God Member
*****
Karma: 2
Posts: 843
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Try the attached bootloader. Use an ISP to put it into your board, set the BOOTSZ fuse to 2048W_F800 (I know, its big, sorry).

It is set up for a 16MHz CPU clock, a baud rate of 38,400 and the first UART on the 1284P chip. To use it from AVRDUDE do something like this:

avrdude -Cavrdude.conf -v -v -patmega1284p -cstk500v1 -P\\.\COM13 -b38400 -D -Uflash:w:your_app_name.hex:i

If someone has a nice big app to try, bigger than 64K, that would be great.

Standard warning applies - I have no idea if this will work for you, or if it will even work at all ;-)


* ATmegaBOOT_1284P.hex (7.97 KB - downloaded 4 times.)
Logged

Smithfield, Rhode Island
Offline Offline
God Member
*****
Karma: 2
Posts: 843
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hm, all this clamoring for a 1284P bootloader, and suddenly no one wants it? LOL, oh well...
 
Logged

Peoples Republic of Cantabrigia
Offline Offline
God Member
*****
Karma: 6
Posts: 691
Arduino happiness
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hm, all this clamoring for a 1284P bootloader, and suddenly no one wants it? LOL, oh well...

Give me time... I have a couple of distractions clamoring for my attention first here at the moment. Plus, my 1284P program is only consuming 23k so far... I needed the 1284P mostly for RAM since even short data strings made the 328P blow up mysteriously while the 1280 or 2560 chugged along just fine with the same program in place. But, given that my main board can accomodate another 32+ daughterboards on the RS485 daisy-chain...

Again, thank you, Skyjumper for the work you do. I hope to take advantage of it soon. Cheers!
Logged

Smithfield, Rhode Island
Offline Offline
God Member
*****
Karma: 2
Posts: 843
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Mysteriously blowing up? Are you doing dynamic memory allocation and if so, are you checking the result of every call to malloc() or new?
Logged

Peoples Republic of Cantabrigia
Offline Offline
God Member
*****
Karma: 6
Posts: 691
Arduino happiness
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Remember that comment about forgetting certain things I made above? Dynamic Memory allocation? I'll have to google that. I might be able to help you with a manufacturing or financial issue but microprocessor programming is something I learn for fun...
Logged

Smithfield, Rhode Island
Offline Offline
God Member
*****
Karma: 2
Posts: 843
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Okay don't worry about that. Are you making large arrays or something? You said your program "blows up" on chips with small ram but is okay on chips with big ram. I was just trying to figure out why that might be.
Logged

Peoples Republic of Cantabrigia
Offline Offline
God Member
*****
Karma: 6
Posts: 691
Arduino happiness
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Skyjumper, no the arrays weren't large... the biggest was a int[5] size, not the worlds biggest! But I was adding data strings together of various variables being transmitted by the other CPU and for some reason (this data transfer string had less than 30 characters altogether in it at the end of all those operations), the program would compile fine... then the chip would cycle through setup() and shortly thereafter lock up. The exact same program on the 1280 or 2560-based Megas ran just fine, making suspect that I was somehow exceeding the allowable RAM allotments.

Many moons ago I had the pleasure/torture of having to program in Fortran 77 (or whatever version it was) and the best kinds of errors were the kind where a variable was not cast or defined properly and henceforth abused inside the program... the compiler would then report an error in a line that the program didn't even have (because, presumably, variable storage happened somewhere 'below' the last line). I had to listen to a lot of Dire Straits not to cry in dispair.

Coming back to the original topic, is there a way to test for the remaining RAM by variety (SRAM, etc.)? It would be great to understand what limits I may or may not be reaching...
Logged

Smithfield, Rhode Island
Offline Offline
God Member
*****
Karma: 2
Posts: 843
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Coming back to the original topic, is there a way to test for the remaining RAM by variety (SRAM, etc.)? It would be great to understand what limits I may or may not be reaching...

Yes there is. See:

http://andybrown.me.uk/ws/2011/01/01/debugging-avr-dynamic-memory-allocation/

But, you may not have to go that far. How are you doing the string concatenation? There are a few strategies to accomplish this, and my guess is that you're using some library to do it for you. It may be making several copies of the data in memory at a time, which is inefficient. Worse, there may be a "pointer error" in there somewhere. You said that you're using 30 byte strings, which is not big. A 644P still has a lot of sram. Given it seems you have plenty of RAM, a pointer error seems a more likely place to look. Rather than get into a long dissertation about pointers, let me first ask how you're doing your string concatenation. If you want to post a small sample of this part o your code I'll take a look.
 
Logged

Peoples Republic of Cantabrigia
Offline Offline
God Member
*****
Karma: 6
Posts: 691
Arduino happiness
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Here is one example, showing the portion of the code where I add the Power, Voltage, Current Variables to the global Data_Package string.

Code:
void AddToDataString_Power(){
  char buffer[10]; // buffer that is used to write floats into the Data string
  Watt_Hours_Recalc(); //recalculate watt seconds, hours, kwh

  //now add remaining data to string
  Data_Package+=",";
  Data_Package+=kWatt_Hours;
  Data_Package+=".";
  if(Watt_Hours<100) Data_Package+="0"; //add zeros behind decimal if Wh is less than 100
  if(Watt_Hours<10) Data_Package+="0";  // see above
  Data_Package+=Watt_Hours; //now print the Watt-hours
  Data_Package+=",";
  Data_Package+=dtostrf(Real_Power,1,2,buffer);
  Data_Package+=",";
  Data_Package+=dtostrf(Vrms,1,1,buffer);
  Data_Package+=",";
  Data_Package+=dtostrf(Irms,1,2,buffer);
  //The power part of the data string has been assembled for transmission.
}

(One issue clearly is that I could do a better job of avoiding global variables and push/return the variables between functions instead.) Give me time...

The preceding part of the string contains the time in excel format, i.e. several digits of for the days since 1/1/1900, a dot, and then another six digits describing the time of day down to the current second. Following this operation, the program may also add environmental data, another 8-10 bytes worth (temp in C, humidity in RH, two commas).
Logged

Smithfield, Rhode Island
Offline Offline
God Member
*****
Karma: 2
Posts: 843
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I assume Data_Package is of type String? Also, what are the largest possible values of the flots that you are converting to a string? Is it possible that they contain more than 9 characters, including the decimal point, leading sign or zeros and so on?

Logged

Pages: 1 [2] 3 4   Go Up
Jump to: