Go Down

Topic: [Solved by setting a fuse] 1284P cannot be programmed (Read 3154 times) previous topic - next topic

Elektrix

Dec 14, 2013, 01:33 am Last Edit: Dec 14, 2013, 08:30 pm by Elektrix Reason: 1
Hello all,

I bought a fresh ATmega1284P. I burned the optiboot bootloader from maniacbug with Uno R3 as ISP. Now I can read out the right signature and the fuse settings with Nick Gammon's board detector. I also see that data is in the flash ROM. So far, everything is fine. When I want to upload a sketch using the Uno board without controller as USB to serial interface (and connected correctly) I can't upload a sketch. When I want to communicate with avrdude having the setting "arduino" as programmer I see the right signature but don't see the fuses:
Code: [Select]
avrdude -P /dev/ttyACM0 -b 28800 -c arduino -p m1284p -v

avrdude gives no error. When I select "avrisp" neither signature nor fuses are displayed (erverything 00).

When trying to upload a sketch via arduino IDE (1.0.5) I get the error:
Code: [Select]
avrdude: Expected signature for ATMEGA1284P is 1E 97 05
        Double check chip, or use -F to override this check.


So it's a avrdude communication problem but I have no idea how to get it running.

Can anyone give me info?

Elektrix
My blog about arduino and Linux themes:
http://heliosoph.mit-links.info/

Coding Badly

Code: [Select]
avrdude -P /dev/ttyACM0 -b 28800 -c arduino -p m1284p -v

Wrong baud rate.  It should be 115200 if the processor is clocked at 16 MHz.

Elektrix

Thanks for the reply.

The ATmega1284 runs on a breadboard with a 16MHz crystal. With 115200 baud I get the same result. The last lines of the avrdude output are:
Code: [Select]
         Programmer Type : Arduino
         Description     : Arduino
         Hardware Version: 3
         Firmware Version: 4.5
         Vtarget         : 0.3 V
         Varef           : 0.3 V
         Oscillator      : 28.800 kHz
         SCK period      : 3.3 us

avrdude: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e9705
avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0

avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: safemode: Fuses OK

avrdude done.  Thank you.


I did the same some time ago with a ATmega328P (standalone with internal 8MHz) with the line:
Code: [Select]
avrdude -P /dev/ttyACM0 -b 19200 -c avrisp -p m328p -v
and everything worked well.

What confuses me is that I get the same result with two different baudrates. On some other speeds it doesn't work at all (=expected). Also why does it read only the signature but not the fuses?

Elektrix
My blog about arduino and Linux themes:
http://heliosoph.mit-links.info/

tack

So, are you using the Uno as an ICSP programmer or have you removed the 328P chip to just use as a serial programmer?

If a serial programmer then I doubt you'd be able to read fuses anyway so that doesn't sound wrong.

You would defintely neeed the right baud rate to communicate with the 1284P bootloader.

You've shown another avrdude output but not showed us the command kine you used. Then you have shown a command line for 328P but no output. Please post the command line and corresponding output so it's clear exactly what you are doing.

Also a diagram of how you are connecting and how you have your 1284P wired up. We don't even know if the 1284P is wired up correctly, especially the reset circuit. Is it on a breadboard?

Elektrix

@tack: Thanks for your reply!!!

What you want is a full description of what I did. As I began writing the answer I looked into the blog post I wrote about reading and setting fuses on the ATmega328P. Now I saw the mistake I did: When reading and writing fuses the Uno board acts as the programmer, has the controller on it and is connected as when burning the bootloader. My fault was that I removed the controller on the Uno board, connected Tx, Rx and RESET to the ATmega1284 as when uploading a sketch. This cannot work!! Typical late-in-the-evening-problem  :~

So, here is the correct version for reading the signature and fuses of the ATmega1284P (running with 16MHz crystal):
- Burn the ArduinoISP sketch to the Uno board
- Connect D10 (Uno) to Pin 9 (ATmega1284) Reset
- Connect D11 (Uno) to Pin 6 (ATmega1284) MOSI
- Connect D12 (Uno) to Pin 7 (ATmega1284) MISO
- Connect D13 (Uno) to Pin 8 (ATmega1284) SCK
- Connect Vcc and GND

With the following command (on a Linux machine):
Code: [Select]
avrdude -P /dev/ttyACM0 -b 19200 -c avrisp -p m1284p -v

You will get the following output:
Code: [Select]
         Programmer Type : STK500
         Description     : Atmel AVR ISP
         Hardware Version: 2
         Firmware Version: 1.18
         Topcard         : Unknown
         Vtarget         : 0.0 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.06s

avrdude: Device signature = 0x1e9705
avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as DE
avrdude: safemode: efuse reads as FD

avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as DE
avrdude: safemode: efuse reads as FD
avrdude: safemode: Fuses OK

avrdude done.  Thank you.


Now this is all up and running! Thank you, tack!!

But what I wanted to do is uploading a sketch to the 1284P. So I tried this:

In the next step I removed the controller from the Uno board and connected it to the ATmega1284P in the following way:
- RESET (Uno Board) to pin 9 (ATmega1284P) RESET
- D0 (Uno Board) to pin 14 (ATmega1284P) Rx
- D1 (Uno Board) to pin 15 (ATmega1284P) Tx
- GND to GND
- Vcc for the ATmega1284P comes from a lab power supply (so I can see the supply current)

In the arduino IDE I selected the board type: "Mighty 1284p 16MHz using Optiboot"

When I try to upload a sketch I get the error message:
Code: [Select]
avrdude: stk500_recv(): programmer is not responding

And here I'm stuck  :smiley-eek:

Elektrix
My blog about arduino and Linux themes:
http://heliosoph.mit-links.info/

tack

#5
Dec 14, 2013, 01:57 pm Last Edit: Dec 14, 2013, 02:01 pm by tack Reason: 1
How have you burnt the bootloader? Nick Gammons sketch, through IDE with Arduino as ISP, or manually using the Arduino as an ISP and command line avrdude?

I'm suspecting you have burnt the bootloader manually, rather than through IDE or Nick's sketch, and not explicitly programmed the fuses.

Have you installed the 1284 cores?

Your fuses don't look right at all.

I use

Lfuse 0xf7
Hfuse 0xd6
Efuse 0xfd

The standard Mighty1284 boards.txt is slightly different but I changed these for a reason:-

Lfuse 0xf7 for full swing oscillator - solves a problem that you can get with serial uploads due rxt/tx coupling with adjacent crystal pin. Full Swing gives a 'stronger' oscillator signal. Mainly encountered on breadboard builds and can be helped by pcb with proper crystal surrounding ground plane for isolation.

Hfuse 0xd6 to preserve EEPROM through Chip Erase. Needed if you program via ICSP, use Eeprom and don't want saved Eeprom data lost every time you load a new versiom of your sketch. I don't think it's required if only programming via serial and boot loadloader OR you don't use the Eeprom.

Hope this helps.

Elektrix


How have you burnt the bootloader?


I loaded the zip file from https://github.com/maniacbug/mighty-1284p, copied the contents to the hardware folder and restarted the IDE. Then I uploaded the ArduinoISP sketch of the IDE to my Uno R3 board and then burned the bootloader with the IDE. Didn't check the fuses before. My 1284P was brandnew. First I had it running without external clock as it is shipped running on internal 8MHz (divided by 8, according to datasheet). I got a error message after burning the bootloader (optiboot). Then I added the 16MHz crystal and burned the bootloader again. This time it worked without errors.

Quote
Have you installed the 1284 cores?


Do you mean anything other than what is in the mighty-1284p file from maniacbug?

Quote
Your fuses don't look right at all.

I use

Lfuse 0xf7
Hfuse 0xd6
Efuse 0xfd


I will check this as soon as possible and give you further information. Thanks for the additional hints about the fuses!

Elektrix
My blog about arduino and Linux themes:
http://heliosoph.mit-links.info/

tack

The core files are the maniacbug ones.

Something still looks wrong as you should have a boards.txt entry that has the fuse setting. When you burn via IDE with Arduino as ISP it should burn the bootloader AND set the fuses based on what is in boards.txt.

The fuses you report are definitely NOT what should be in boards.txt for a 1284P

CrossRoads

Here's what I use for fuses on my 1284 PCBs:

bobuino.bootloader.low_fuses=0xff
bobuino.bootloader.high_fuses=0xde
bobuino.bootloader.extended_fuses=0xfd
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.

Elektrix

:) :) :)

@tack:

I changed the fuses to the values you proposed. Now I can upload a sketch to the 1284P and it is running!

I looked into the boards.txt of the maniacbug's files and the fuses are given there as they were programmed onto my chip:
Code: [Select]
mighty_opt.bootloader.low_fuses=0xff
mighty_opt.bootloader.high_fuses=0xde
mighty_opt.bootloader.extended_fuses=0xfd


So, when looking at the fuses the difference is to take 'full swing oscillator' instead of 'ext. crystal osc.' The EEPROM thing isn't important to me. It looks like you are right with what you wrote about running the chip on a breadboard instead of a well-done PCB. From where do you know this? Your own experience or where can one find these infos?

Thanks a lot for your support. I probably wouldn't have found this.

Have a nice weekend

Elektrix
My blog about arduino and Linux themes:
http://heliosoph.mit-links.info/

tack

#10
Dec 15, 2013, 02:41 am Last Edit: Dec 16, 2013, 02:22 am by tack Reason: 1
The issue was originally discussed and investigated at length in the following (long) thread.

http://forum.arduino.cc/index.php?topic=139671.0

larryd

Quote
The issue was originally discussed and investigated at length in the following (long) thread.

Where?
No technical PMs.
The last thing you did is where you should start looking.

tack


Quote
The issue was originally discussed and investigated at length in the following (long) thread.

Where?

Sorry, I swear I copied and pasted that link! I musgt be going mad!

I've just amended the previous post. :-)

larryd

@tack,   thanks for pointing this one out, I missed reading it.
No technical PMs.
The last thing you did is where you should start looking.

Go Up