Pages: 1 [2] 3 4 5   Go Down
Author Topic: Uploading troubles to 1284p  (Read 8865 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 0
Posts: 235
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Insert Quote
If you have a bootloader burnt in, the next important thing is to tell the IDE the right board type. Or more correctly, the one that matches the bootloader you used.

Bootloaders take serial commands from the comms port, if the bootloader is expecting 9600 baud, and the computer is sending 115200 then it ain't gonna work.

I guess i have done that also correctly because I was able to burn quite a few times before troubles started and frequency of getting uploaded correctly started reducing...

Board selected is Mighty 1284p 16MHz using Optiboot with maniacbugs bootloader
Logged

Anchorage, AK
Offline Offline
Edison Member
*
Karma: 42
Posts: 1176
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It's been a few weeks since I read the post -- I think I mis-remembered.  There's an update to the Makefile to build optiboot (regarding oscillator settings), but looks like no changes to the hex itself.  So the one (4.5) from January looks to be the latest.  I don't know if that's the same as Maniacbug's or not.

You might need to check out the various fuse combos posted in the last page.  Run those through a fuse calculator and see what the differences are.  Pick the one that looks most appropriate for your setup and see if that improves things.  I'm pretty sure that was my problem, I just haven't gotten back around to testing it yet.  (Other priorities...)
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 235
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

How and wer do I change these fuse settings?  smiley-confuse
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Can you "talk" to this board using avrdude? Just remind me what programmer you are using?

With my Uno, and with the board plugged into a USBtinyISP, I can do this:

Code:
$ avrdude -c usbtiny -p m328p -v

...

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f
avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as DE
avrdude: safemode: efuse reads as 5

There are the fuses. With your chip you would want:

Code:
avrdude -c usbtiny -p m1284p -v
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 235
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

As  I said I dont have any other programmer. I use the Serial interface in the duemilanove board or the transistor interface i have the Atmega1284p clone board for "talking " with the IC. I have only used the Arduino IDE to talk with the board till now. I have never used AVRdude software.(Till now Inever had the need to... smiley-sad ) So would I need a programmer to do what you mentioned? I mean for reading and writing fuses...
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

To read the fuses, if you have another board handy, you should be able to use this:

http://arduino.cc/forum/index.php/topic,105089.0.html

Just connect it up as advised in the linked-to page.
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 235
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@nick
Thanx. Tried it out... smiley This is what I got.

Code:
Atmega fuse calculator.
Written by Nick Gammon.
Entered programming mode OK.
Signature = 0x1E 0x97 0x05
Processor = ATmega1284P
Flash memory size = 262144
LFuse = 0xFF
HFuse = 0xDE
EFuse = 0xFD
Lock byte = 0xCF
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: [X]  SUT1: [X] (see datasheet)
Clock source: low-power crystal.
Brownout detection at: 2.7V.

Any ideas on what I should do now?
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 235
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi I more doubt if is it possible to upload to Atmega1284p via a Duminalove using 6pin cable ISP? If thats possible I think i can adjust with that...
OR if I buy a AVR ISP programmer will I be able to upload program written in Arduino (I mean the hex file) to the device.
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 518
Posts: 26359
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 to both.
The chip does not care what is driving the Reset & SPI lines (SCK, MISO, MOSI).
Depending on the AVR ISP, power may or may not be supplied to the Vcc pin of the ICSP header.

For instance, this one does supply power
http://www.mdfly.com/index.php?main_page=product_info&cPath=5&products_id=415
but is a little slower programming as the IDE seems to write the whole 128K of memory.

This one does not, it reads the Vcc pin to know what levels to control the IO pins at, so Vcc must be supplied elsewhere to the board/chip.
http://www.mouser.com/ProductDetail/Atmel/ATAVRISP2/?qs=2mdvTlUeTfBRoycsKqwYpg%3d%3d
but it does have a nice software interface if you use AVR Studio (I have 5.1) for doing things. Also lets you select the bootload speed (needs to be slower for initial bootload programming, I used 125K).
I did 50 '1284 boards recently - powered the board via the USB interface, then programmed the Fuses, lockbits, and downloaded the bootloader. Went real quick because it only loaded the bootloader, and not all 128K of memory.
« Last Edit: May 09, 2012, 11:45:38 am by CrossRoads » 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.

0
Offline Offline
Full Member
***
Karma: 0
Posts: 235
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@Crossroads
Thanx for the reply... smiley If possible can someone explain the steps involved for uploading programs(Not bootloaders) to Atmega1284p board via a Duminalove using 6pin cable ISP without any extra programmer. From my knowledge, it doesnt require a bootloader for this right? If I had already burnt the bootloader in a chip will this work?

@Crossroads
Can you please take a look at the fuse settings of my Atmega1284p and see if anything is of a problem? Because I cant seem to upload it to it consistently... smiley-sad
Logged

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

Part 1 - I don't know, I just used an inexpensive tool, then programmed using the "File:Upload using Programmer" menu choice in IDE 1.0 with this programmer
http://www.mdfly.com/index.php?main_page=product_info&cPath=5&products_id=415
You are left with no bootloader after that (if you had one, it will be gone), but your sketch starts immediately.

Part 2 - how are you programming?  The times I've had issues programming, it has always turned out to be a mismatch between the data rate the bootloader is using and the data rate the IDE is using. Did this to myself recently. Bootloaded with Optiloader, then attempted to download with Duemilanove selected as board type. Nick Gammon solved it for me - changed board type to Uno, now the bootload speed matched the boards.txt upload speed, and I could load programs.

You might also try putting a diode across the reset pullup resistor, reverse biased (cathode to +5, anode to the reset pin).

I'll check the fuse settings that my '1284 demo board uses with maniacbug's 1284 cores and the Bobuino board type.
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.

0
Offline Offline
Full Member
***
Karma: 0
Posts: 235
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanx for a fast reply... smiley-grin
Quote
Insert Quote
Part 1 - I don't know, I just used an inexpensive tool, then programmed using the "File:Upload using Programmer" menu choice in IDE 1.0 with this programmer
http://www.mdfly.com/index.php?main_page=product_info&cPath=5&products_id=415
You are left with no bootloader after that (if you had one, it will be gone), but your sketch starts immediately.

Hmmm.. So its not possible without an external programmer? smiley-sad Can someone else confirm if this possible without an ext Programmer.

Quote
Part 2 - how are you programming?  The times I've had issues programming, it has always turned out to be a mismatch between the data rate the bootloader is using and the data rate the IDE is using. Did this to myself recently. Bootloaded with Optiloader, then attempted to download with Duemilanove selected as board type. Nick Gammon solved it for me - changed board type to Uno, now the bootload speed matched the boards.txt upload speed, and I could load programs.

How can I check this? I mean how to know the date rate of the IDE and of the board?
from boards.txt I got
Code:
mighty_opt.upload.speed=115200
for the bootloader I use. Whats the IDE data rate?


Quote
You might also try putting a diode across the reset pullup resistor, reverse biased (cathode to +5, anode to the reset pin).

Thats already there in the board... Not much change with or without it. (Anyways what does that diode do?)

Logged

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

Programming sketches via ICSP is possible, I've just never done it without a bootload programmer.
For example,

https://github.com/WestfW/OptiLoader
http://arduino.cc/forum/index.php/topic,68183.0.html  see the vidoe in the thread

could likely be used, if it was modified to know where to get the file from.

"Whats the IDE data rate?" 115,200 from boards.txt.
What you need to know is the data rate the bootload code is using.

Re: diode:
From AVR042,  see first & last paragraph:

2. To enter programming mode (for some parts also the PEN line is used to enter
programming mode). Furthermore it is possible to enter high-voltage/parallel
programming mode by drawing the RESET pin “very” high, where very high means
11.5 – 12.5V (refer to the datasheet of the device for more information).

The reset line has an internal pull-up resistor, but if the environment is noisy it can be
insufficient and reset can therefore occur sporadically. Refer to datasheet for value of
pull-up resistor on specific devices.

Connecting the RESET so that it is possible to enter both high-voltage programming
and ordinary low level reset can be achieved by applying a pull-up resistor to the
RESET line. This pull-up resistor makes sure that reset does not go low unintended.
The pull-up resistor can in theory be of any size, but if the Atmel®AVR® should be
programmed from e.g. STK500/AVRISP the pull-up should not be so strong that the
programmer cannot activate RESET by draw the RESET line low. The recommended
pull-up resistor is 4.7kΩ or larger when using STK500 for programming. For
debugWIRE to function properly, the pull-up must not be smaller than 10kΩ.

To protect the RESET line further from noise, it is an advantage to connect a
capacitor from the RESET pin to ground. This is not directly required since the AVR
internally have a low-pass filter to eliminate spikes and noise that could cause reset.
Applying an extra capacitor is thus an additional protection. However, note that this
capacitor cannot be present if debugWIRE or PDI is used.

If not using High Voltage Programming it is recommended to add an ESD protecting
diode from RESET to Vcc, since this is not internally provided due to High Voltage
Programming. Alternatively, or in addition, a zener diode can be used to limit the
RESET voltage relative to GND. The zener diode is highly recommended in noisy
environments. The components should be located physically close to the RESET pin
of the AVR. Figure 3-1 shows the recommended circuit on the RESET line.
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
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

@nick
Thanx. Tried it out... smiley This is what I got.

...

Any ideas on what I should do now?

That looks OK. At least the chip looks good, and the fuses look reasonable. You might want to try this next:

http://www.gammon.com.au/forum/?id=11633

That will read in the bootloader, display it, and take a sumcheck. We can at least work out which bootloader you have.

Quote
Hmmm.. So its not possible without an external programmer? Can someone else confirm if this possible without an ext Programmer.

With a bootloader it should be possible to upload sketches.
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 235
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@CrossRoads
Quote
Programming sketches via ICSP is possible, I've just never done it without a bootload programmer.
For example,

https://github.com/WestfW/OptiLoader
http://arduino.cc/forum/index.php/topic,68183.0.html  see the vidoe in the thread

could likely be used, if it was modified to know where to get the file from.

Doesnt that video show how to bootload a Atmega chip with an Arduino? I can do that(I bootload this way only smiley ) but What I wanted to know was with the SAME setup used in the video can I upload programs as such Blink or anything else to an arduino? If so what all changes should I make?

Quote
"Whats the IDE data rate?" 115,200 from boards.txt.

So for me IDE data rate is 115200(As its written in my boards.txt)? Earlier you mentioned something like mismatch of speeds. What is the other comparing term I should check with?

Quote
What you need to know is the data rate the bootload code is using.

Any way to find this out?

@nick Thanx for that calculator smiley
This is what I got. I am using Maniacbug's optiloader.

Code:
Atmega chip detector.
Entered programming mode OK.
Signature = 1E 97 05
Processor = ATmega1284P
Flash memory size = 262144
LFuse = FF
HFuse = DE
EFuse = FD
Lock byte = CF
Bootloader in use: Yes
EEPROM preserved through erase: No
Watchdog timer always on: No
Bootloader is 1024 bytes starting at 3FC00

Bootloader:

3FC00: 0F 92 CD B7 DE B7 11 24 84 B7 14 BE 81 FF F1 D0
3FC10: 85 E0 80 93 81 00 82 E0 80 93 C0 00 88 E1 80 93
3FC20: C1 00 86 E0 80 93 C2 00 80 E1 80 93 C4 00 8E E0
3FC30: CA D0 20 9A 26 E0 80 E3 9C EF 31 E0 90 93 85 00
3FC40: 80 93 84 00 36 BB B0 9B FE CF 18 9A A8 95 21 50
3FC50: A9 F7 00 E0 10 E0 EE 24 E3 94 E1 E1 DE 2E F3 E0
3FC60: FF 2E A5 D0 81 34 71 F4 A2 D0 89 83 B2 D0 89 81
3FC70: 82 38 09 F4 8B C0 81 38 11 F4 84 E0 01 C0 83 E0
3FC80: 8F D0 8B C0 82 34 11 F4 84 E1 03 C0 85 34 19 F4
3FC90: 85 E0 A7 D0 82 C0 85 35 91 F4 89 D0 A8 2E BB 24
3FCA0: 86 D0 08 2F 10 E0 10 2F 00 27 0A 29 1B 29 81 2F
3FCB0: 88 1F 88 27 88 1F 8B BF 00 0F 11 1F 6D C0 86 35
3FCC0: 21 F4 84 E0 8E D0 80 E0 DB CF 84 36 09 F0 40 C0
3FCD0: 6E D0 6D D0 C8 2E 6B D0 80 EE 00 30 18 07 18 F4
3FCE0: F8 01 F7 BE E8 95 A1 2C 51 E0 B5 2E 60 D0 F5 01
3FCF0: 81 93 5F 01 CE 16 D1 F7 F0 EE 00 30 1F 07 18 F0
3FD00: F8 01 F7 BE E8 95 65 D0 07 B6 00 FC FD CF F8 01
3FD10: A0 E0 B1 E0 2C 91 30 E0 11 96 8C 91 11 97 90 E0
3FD20: 98 2F 88 27 82 2B 93 2B 12 96 0C 01 E7 BE E8 95
3FD30: 11 24 32 96 82 E0 A0 30 B8 07 61 F7 85 E0 F8 01
3FD40: 87 BF E8 95 07 B6 00 FC FD CF D7 BE E8 95 25 C0
3FD50: 84 37 A9 F4 2C D0 2B D0 B8 2E 29 D0 3A D0 CB 2C
3FD60: 48 01 F4 01 86 91 1C D0 08 94 81 1C 91 1C CA 94
3FD70: C1 F7 0F 5F 1F 4F BA 94 0B 0D 11 1D 0E C0 85 37
3FD80: 39 F4 27 D0 8E E1 0C D0 87 E9 0A D0 85 E0 78 CF
3FD90: 81 35 11 F4 88 E0 17 D0 1C D0 80 E1 01 D0 61 CF
3FDA0: 90 91 C0 00 95 FF FC CF 80 93 C6 00 08 95 80 91
3FDB0: C0 00 87 FF FC CF 80 91 C0 00 84 FD 01 C0 A8 95
3FDC0: 80 91 C6 00 08 95 E0 E6 F0 E0 98 E1 90 83 80 83
3FDD0: 08 95 ED DF 80 32 19 F0 88 E0 F5 DF FF CF 84 E1
3FDE0: DF CF CF 93 C8 2F E3 DF C1 50 E9 F7 F2 DF CF 91
3FDF0: 08 95 80 E0 E8 DF EE 27 FF 27 09 94 FF FF FF FF
3FE00: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
3FE10: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
3FE20: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
3FE30: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
3FE40: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
3FE50: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
3FE60: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
3FE70: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
3FE80: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
3FE90: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
3FEA0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
3FEB0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
3FEC0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
3FED0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
3FEE0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
3FEF0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
3FF00: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
3FF10: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
3FF20: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
3FF30: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
3FF40: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
3FF50: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
3FF60: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
3FF70: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
3FF80: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
3FF90: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
3FFA0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
3FFB0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
3FFC0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
3FFD0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
3FFE0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
3FFF0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF

MD5 sum of bootloader = 71 DD C2 84 64 C4 73 27 D2 33 01 1E FA E1 24 4B

First 256 bytes of program memory:

0: 0C 94 87 00 0C 94 B2 00 0C 94 B2 00 0C 94 B2 00
10: 0C 94 B2 00 0C 94 B2 00 0C 94 B2 00 0C 94 B2 00
20: 0C 94 B2 00 0C 94 B2 00 0C 94 B2 00 0C 94 B2 00
30: 0C 94 B2 00 0C 94 B2 00 0C 94 B2 00 0C 94 B2 00
40: 0C 94 B2 00 0C 94 B2 00 0C 94 7B 12 0C 94 B2 00
50: 0C 94 66 14 0C 94 FC 14 0C 94 B2 00 0C 94 B2 00
60: 0C 94 B2 00 0C 94 B2 00 0C 94 B2 00 0C 94 B2 00
70: 0C 94 9F 14 0C 94 49 15 0C 94 B2 00 0C 94 B2 00
80: 0C 94 B2 00 0C 94 B2 00 0C 94 B2 00 00 00 21 00
90: 24 00 27 00 2A 00 00 00 22 00 25 00 28 00 2B 00
A0: 00 00 20 00 23 00 26 00 29 00 02 02 02 02 02 02
B0: 02 02 04 04 04 04 04 04 04 04 03 03 03 03 03 03
C0: 03 03 01 01 01 01 01 01 01 01 01 02 04 08 10 20
D0: 40 80 01 02 04 08 10 20 40 80 01 02 04 08 10 20
E0: 40 80 01 02 04 08 10 20 40 80 00 00 00 01 02 00
F0: 08 09 00 00 00 00 04 03 07 06 00 00 00 00 00 00

Thanx Crossroads for clearing up the Reset pin doubt. smiley
« Last Edit: May 09, 2012, 10:56:51 pm by 000 » Logged

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