Pages: 1 [2]   Go Down
Author Topic: Arduino ATmega1284p bootloader  (Read 7966 times)
0 Members and 1 Guest are viewing this topic.
Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 547
Posts: 27363
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

The programmer is set for 5V?

You didn't say how you were able to install the bootloader.
I install it via the the IDE, Tools:Burn Bootloader.
This ensures that the fuses are all set correctly for 16 MHz crytsal operation.
I download sketches after that.
If the fuses are not set correctly, the data rate for serial downloads will be mismatched and the download will not work.
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.

the land of sun+snow
Offline Offline
Faraday Member
**
Karma: 159
Posts: 2916
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I selected the Mighty 1284p, 16MHz using Optiboot as board and Arduino as ISP as programmer.
This is wrong for downloading general sketches, it's only used to download the ISP sketch into
the 1284P to use it to program other chips.

Secondly, as Bob asked, how did you burn the bootloader into the 1284P chip in the first place?
Are you sure that went correctly?

Thirdly, your FTDI cable looks like a knockoff of the FTDI friend. It may or may not "in
fact" be using DTR, rather than RTS. If it's actually using RTS you need to go to the
Control Panel device manager for the COMPORT and select "set RTS on close".

Fourthly, it looks like in your 2.8MB picture you have TX and RX wired wrong. The TX
and RX labels on the FTDI Friend and regular FTDI cables specify the signal flow with
respect to the cable, not the Arduino. So, the wires have to be swapped between the
2 devices. BTW, I always insert 1K series-Rs in the RX,TX lines in case I hook them
up backwards.

The other thing is I use the FTDI Friend and FTDI cables most of the time, and have
never tied CTS to anything.

« Last Edit: January 10, 2013, 02:43:04 pm by oric_dan(333) » Logged

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

Thanks for the great answers!

I changed the setting in the device manager, just in case to test it. I used this tutorial: http://www.gammon.com.au/forum/?id=11637 and the Serial Monitor said that it was successful. That do I have to choose to download a general sketch?

Yes it is a cheap FTDI version, on the ebay page they said it uses DTR. Thanks for the information that I have to swap TX and RX. Is connection via the cap to the reset pin right for DTR?

Logged

the land of sun+snow
Offline Offline
Faraday Member
**
Karma: 159
Posts: 2916
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

For a general sketch, you just go to your sketchbook or the IDE "File > Examples",
and choose something other than ArduinoISP.

I think your reset pin wiring is ok. All you need is a 0.1 uF cap from FTDI DTR to the
1284P reset pin, plus a 10K pullup to 5V on the reset pin. Simple.

I am still curious [Bob too], as to how you burned the bootloader into the 1284P in the
first place. ???
« Last Edit: January 10, 2013, 03:00:53 pm by oric_dan(333) » Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 547
Posts: 27363
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

Yes I am, how was the bootloader set up?

I use an Atmel AVR ISP MKii.  I use the IDE to burn the bootloader first to make the fuses are set correctly.
The times I forgot to that, I spend a frustrating 1/2 figuring what is going on, eventually figuring out the clock is really slow, and then finally remembering to do the bootloader for the fuses.  Getting better about that.

I then use File: Upload Using Programmer with the MKii if I don't need the bootloader, or I connect up an FTDI Basic for downloading sketch via serial interface.

I don't use the Optiboot 16 MHz tho, I always use Bobuino so Serial is at D0/D1, SPI is D10-11-12-13, and I2C is A4/A5 of D18/D19, just like on a '328 board.  I like a little consistency.
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: 17303
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I don't use the Optiboot 16 MHz tho, I always use Bobuino so Serial is at D0/D1, SPI is D10-11-12-13, and I2C is A4/A5 of D18/D19, just like on a '328 board.  I like a little consistency.

The version of bootloader you use shouldn't be effected by the unique pins_arduino.h file you set up to support your Bobuino board. However the entries for the Bobuino entry in the boards.txt file do have to reflect which  1284 bootloader you use, the normal one, or the Optiboot one, as that is where the fuse definitions and top of memory size values are, and they have to match the bootloader you are going to use. It's all pretty interdependent and lots of room to get it wrong. I struggled getting my 644P chip setup correctly and even had to revert to using the bootloader and boards.txt entry for a 644P from my old version 11 Sanguino files, but it all worked out in the end. Still waiting for the 1284P chip to arrive.

Lefty
Logged

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

For a general sketch, you just go to your sketchbook or the IDE "File > Examples",
and choose something other than ArduinoISP.

I have an simple test sketch with serial data to check that it is working so i dont use a special one I just choose the Optiboot 16MHz as board. I set up the µC how it was mention in the tutorial, upload the optiboot code to the arduino and finally use the serial console to send the command to the arduino uno to burn the bootloader. it returns that this was successful.
Logged

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

I had some time today and built a bootloader shield. To test it I take a brand new 1284P and burn a bootloader on it. This is the log:

Quote
Atmega chip programmer.
Written by Nick Gammon.
Entered programming mode OK.
Signature = 0x1E 0x97 0x05
Processor = ATmega1284P
Flash memory size = 131072 bytes.
LFuse = 0x62
HFuse = 0x99
EFuse = 0xFF
Lock byte = 0xFF
Clock calibration = 0x8D
Bootloader address = 0x1FC00
Bootloader length = 508 bytes.
Type 'V' to verify, or 'G' to program the chip with the bootloader ...
Erasing chip ...
Writing bootloader ...
Committing page starting at 0x1FC00
Committing page starting at 0x1FD00
Written.
Verifying ...
No errors found.
Writing fuses ...
LFuse = 0xFF
HFuse = 0xDE
EFuse = 0xFD
Lock byte = 0xEF
Clock calibration = 0x8D
Done.
Type 'C' when ready to continue with another chip ...

I will post a log with the fuses of the other chip which I am trying to programm later.

By the way this is my bootloader shield: View Image (3,3MB)

I show this because I haven't seen anything similar.

EDIT:

This is the log of the µC we are talking about. Again, thanks for your help.
Quote
Atmega fuse calculator.
Written by Nick Gammon.
Entered programming mode OK.
Signature = 0x1E 0x97 0x05
Processor = ATmega1284P
Flash memory size = 131072
LFuse = 0xFF
HFuse = 0xDE
EFuse = 0xFD
Lock byte = 0xEF
Clock calibration = 0x4F
OCD Enable.............................. [ ]
JTAG Enable............................. [ ]
Enable Serial (ICSP) Programming........ [X]
Watchdog Timer Always On................ [ ]
Preserve EEPROM through chip erase...... [ ]
Boot into bootloader.................... [X]
Divide clock by 8....................... [ ]
Clock output............................ [ ]
Bootloader size: 1024 bytes.
Start-up time: SUT0: [ ]  SUT1: [ ] (see datasheet)
Clock source: low-power crystal.
Brownout detection at: 2.7V.
« Last Edit: January 11, 2013, 05:53:17 pm by php-freak » Logged

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

Hello,

is there anybody who has another idea whats wrong with my setup?

I appreciate your support!
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 547
Posts: 27363
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

So what happens after you burn the bootloader - you are still not able to download sketches via an FTDI module connected to Rx, Tx, DTR, +5, Gnd?

Might have to wait for NickGammon to get back from his vacation.  You can try to PM him, he has some internet access.
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.

the land of sun+snow
Offline Offline
Faraday Member
**
Karma: 159
Posts: 2916
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

What is the problem now? I thought you had the bootloader burned correctly.
All the fuses/etc stuff should be taken care of automatically so you shouldn't
need to worry about it.

In my case, I just loaded the ArduinoISP sketch into a UNO and told it to burn
the Bobuino bootloader into the 1284, and didn't worry about fuses or anything.
Logged

Global Moderator
Italy
Offline Offline
Brattain Member
*****
Karma: 333
Posts: 22973
Logic is my way
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Could this problem related to the one mentioned from this post and the following ones?
http://arduino.cc/forum/index.php/topic,80483.msg957901.html#msg957901

I had a lot of problems, then I solved using a non-scientific method: an RC filter, suggested here on AvrFreaks' forum.
Logged


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

Sorry for my late reply I was busy the last week :-(

Do you have a like for a suitable rc filter? My problem at the moment is, that the FTDI programmer blinks but I get still error messages :-(
Logged

California
Offline Offline
God Member
*****
Karma: 14
Posts: 629
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

As pito figured out, set that low fuse to full-swing (0xF7) in the programmer sketch:

Code:
// ATmega1284P family
  { { 0x1E, 0x97, 0x05 }, "ATmega1284P", 128 * kb,   1 * kb,
        optiboot_atmega1284p_hex,
        0x1FC00,      // start address
        sizeof optiboot_atmega1284p_hex,       
        256,          // page size (for committing)
        0xD7,         // fuse low byte: external clock, 0xD7 = FULL SWING
        0xDE,         // fuse high byte: SPI enable, boot into bootloader, 1024 byte bootloader
        0xFD,         // fuse extended byte: brown-out detection at 2.7V
        0x2F },       // lock bits: SPM is not allowed to write to the Boot Loader section.

Logged


Pages: 1 [2]   Go Up
Jump to: