Go Down

Topic: ATmega2560 bootloader to use more i/o pins (Read 9227 times) previous topic - next topic

CrossRoads

Hmm, that loses a lot in formatting!
Would help to include the D# or A# assigments currently used.
Odd about PB6/7, shown on the schematic as D12/13.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

tzif

Hello CrossRoad
Its been a while since this post came up
It looks like I need your help

I went through the post and tried to understand what to do
I have built a PCB using AT2560 (blank) ion my board
I am burning the board using ISP MKII which works fine (I only take th HEX file from the Arduino compiler and burn the file using AVR studio) this is the only way I can do it.

Any way ...
I found out that some ot the pins doesnt work
For example pin A4 on the Arduino board(93 on the Mega chip)  , when I burn my Sketch on the Arduino Board it works fine but when i try to burn it on my cosume board it doesnt do anything!!!

Now the questions...
Assuming that I have a bootloader (which I found in the Arduino_pin.h)
What do I need to do with it
Should I burn it every time I load a new sketch ?
Or should I burn it on the EEPROM

I will try to ask it in a different way ...
Assuming I have a sketch that al it does is toggling that pin I was talking about,
The sketch is very small and contains of a very small amount of lines.
Do I need to add aline that calls the H file ?

Please advise (if possible with an example)

Thank you so much for your help

CrossRoads

With a new chip, you only need to burn the bootloader one time, you do that to set the fuses for  correct operation.
You can set the fuses with Atmel Studio also, I used to do that for 1284 chips. Eventually I got tired of the really long time it took for Atmel Studio to start and now I use the Arduino IDE & load the bootloader to set the fuses. It takes a little longer to run, but not  nearly as long as Atmel Studio took to start up.
Once the fuses are set, they're set.
The pins being used and their mapping are set from within pins_arduino.h. When the sketch compiles, it uses the information from that file, so it should be included in the .hex file you are downloading.
If the pin isn't working, check the soldering of the board. Perhaps the pin is not soldered and not making contact. You can use a small wooden stick and try pushing it down gently while the sketch runs, see if the output starts changing.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

tzif

CrossRoad you are great
Thank you for you quick replay
But as you probobbly thought.....I have few more questions  :smiley-roll:

Iused to work with AVR (i.e. Atmega32 )and burned them with the ISP MKII.
Never used a Bootloader but every time Iplayed with the fuses something went wrong and I had to burn them in High votage using the STK500 or some thing like that !
So I am very scared when I hear the word Fuses!!

1. If I would brn the Bootloader would I be able to run it over if something went wrog?
2. Can I try to burn Bootloader on my ATmega2560 arduino Board- would it damage the USB port (I wont        be able to load program via the USB?)
3. Should I burn the Bootloader that is in the arduino compiler
4. How can I burn the Bootloader - is it aregular Hexfile that I can load using the studio ?
5. If I burn the Bootloader, and then burn a sketch (lets say the blink one) wouldnt it run over the bootloader?
6. why am I asking too much questions.....because I built aPCB and put about 3000$ on assmbley and design and I am so scared to damadge it and I have a very rough dead line

Thank you again for your help


CrossRoads

1. Yes indeed.  The MKii is pretty versatile. I have never locked up a chip using it and the Arduino standard fuse settings.
2. If the bootload failed, just load it again.
3. Yes, use the Ardiuno bootloader.
4. Yes, you tell Atmel Studio what file you want to load into the boot flash space.
5. Yes, uploading a sketch via ISCP wipes out the bootloader - but the fuses do not change. Using the bootloader to load via the Serial interface does not affect the bootloader.
6. As long as you have an ICSP header and a serial header, you should have a lot of flexibility program loading wise.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

tzif

Again Thank you so much

One more if I may...

i dont recall in the Studio that there is a place to locate the Bootloader- did you mean the EERPOM area (please see attached link to a picture I ve took)
http://www.weebly.com/uploads/3/1/7/7/3177895/4465105_orig.jpg
Or should I do some thing else?

Please advise

tzif

oh..
and if i loaded the Bootloader then how do I load the Sketch via serial port
Should I use 232 or USB ?

Just to let you know I didnt put on my board USB (only ISP)
So is there a way to use an arduino UNO as the USB port and connect it to the At2560
Or should I use the RX TX port (with what SW should I do that)

Thats it for today
Sorry


CrossRoads

No,bootloader does not go into EEPROM.
Sketch via bootloader - get an FTDI module accept USB from PC and output Rx, Tx, and DTR to your card. DTR will connect thru a 0.1uF cap to the uC's reset pin.
You can do the same an Uno - connect Uno's reset pin to Gnd. Connect D0 and D1 to D0 and D1 on the 2560.
Start a download in the IDE. When the IDE shows "compiled xxx of 130xxx bytes", something like that, press reset on your 2560 board. May take a few tries to get the timing right.
I am downloading Atmel Studio 6 to look at the bootloader placement question.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

tzif

Dear CrossRoad
Thank you
But I am confused
Waht did you mean by saying sketch from the bootloader
If I understood..
I should write a sketch and when I want to load it to the board I would press the Tools>BurnBootloader ?
Would it make the Hex file ? (let me remind you that I am burnning using the studio which uses the Hex files)

As for th DTR- ok I dont really know what is a DTR (I feel stupid) but I am a very good HW but not SW guy :smiley-red:)

If I understood...
After loading the Bootloader (assuming that it worked for me), I need to get an FTDI module (Do have any link that i can see what it is?)
How should I connect it to my board ?

If I would use the UNO(or Due which I have) I I connect the reset to the GND it wont work !
What do you mean by Start downloading in the IDE please explain what does it mean

Thank you for your time
I appritiate that very much

Go Up