Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
Codedawg
PostPosted: Jul 12, 2012 - 12:21 AM
Wannabe


Joined: Jun 06, 2012
Posts: 91
Location: Shelton, CT

I finally received my AVRISP MKII programmer and was eager to start programming my ATmega324PA. I had a simple program for powering an LED out of PIN0 of PORTB that I wanted to test.
Code:
#include <avr/io.h>
#include <avr/delay.h>

int main(void)
{
   DDRB = 0b00000001;
   PORTB = 0b00000001;
   while(1)
   {
      //TODO
   }
   
}

I've connected the programmer by creating a header board for the MKII as shown from this tutorial http://newbiehack.com/MicrocontrollerProgramTransferPart1ABeginnersGuidetotheAtmelAVRAtmega32.aspx

I'm also using a pull-up 22kOhm resistor for the RESET pin. Plugging in the programmer, both lights are green so I figure I should be good to go. Except when I try to program the device, I get the following error:

Code:
Failed to enter programming mode. ispEnterProgramMode: Error status received: Got 0xc0, expected 0x00

Googling around forums showed me that I have to lower my ISP Clock which I did (to 16.1 KHz). The data sheets for the device reads:

"The device is shipped with internal RC oscillator at 8.0MHz and with the fuse CKDIV8 programmed,
resulting in 1.0MHz system clock."

and since I haven't messed with any fuses up to this point, I assumed this value.

Using AVRStudio's "Device Programming" I can read the Target Voltage which is 5 V and I verified this using my multimeter. However, I still cannot read the Device Signature and it spits out this error:

Code:
Timestamp:   2012-07-11 19:14:00.171
Severity:      INFO
ComponentId:   20100
StatusCode:   0
Unable to enter programming mode. Verify device selection, interface settings, target power and connections to the target device.

Is AVRStudio 6 not stable? Maybe I should use WinAVR instead? or Maybe switching to AVRStudio 4 would be better? Or am I just doing something silly?


Last edited by Codedawg on Jul 13, 2012 - 02:49 PM; edited 1 time in total
 
 View user's profile Send private message  
Reply with quote Back to top
larryvc
PostPosted: Jul 12, 2012 - 12:39 AM
Raving lunatic


Joined: Dec 06, 2007
Posts: 2512
Location: Redmond, WA USA

I've looked at the tutorial and am amazed that the guy is teaching that solder blobs (bridges) are the way to make interconnects between the wires and header pins. Shocked Cold solder joints and/or flexed solder joints result in opens very quickly.

This sounds like a wiring problem at this point.

Did you check, with a meter or continuity checker, that you wired the adapter correctly?

Did you check that your wiring from the header to the part is correct?

_________________
Larry

Those afraid to embrace the future will quickly fade into the past. - larryvc
 
 View user's profile Send private message  
Reply with quote Back to top
Codedawg
PostPosted: Jul 12, 2012 - 01:11 AM
Wannabe


Joined: Jun 06, 2012
Posts: 91
Location: Shelton, CT

Yes, initially even I thought this was the problem at first. I thoroughly checked my connections by actually connecting to my board and applying power to each pin. It might be a hack job, but it certainly works properly!


EDIT: I meant to say the header board I made is working, not that I've solved my problem. I get an error that still says:

Code:
[ERROR] Failed to enter programming mode. ispEnterProgMode: Error status received: Got 0xc0, expected 0x00, ModuleName: TCF (TCF command: Device:startSession failed.)
 
 View user's profile Send private message  
Reply with quote Back to top
meteor
PostPosted: Jul 12, 2012 - 08:31 PM
Hangaround


Joined: Dec 11, 2010
Posts: 183


Hi Codedawg,

I initially posted (now deleted) asking if you were powering the MCU (independently of the AVRISP2). But a closer re-reading of your initial post seems to indicate that you've checked the target voltage.

Since you're confident that your adapter/wiring is working, it seems like you are now wanting to rule out the software side of things. I'd recommend trying AVRDUDE for Windows. I'm an AVRISP2/AVRDUDE user but a pure GNU/Linux guy, but it seems like this has the latest AVRDUDE Windows executable ('avrdude-5.11-Patch7610-win32.zip') (and the requisite 'avrdude.conf' file). Alternatively, AVRFreak 'Magister' has kindly provided a Windows build of AVRDUDE in this post.

I'd recommend first just reading the MCU signature, with an AVRDUDE command like this:
Code:
avrdude -p atmega324p -c avrisp2 -P usb -U signature:r:-:h
If that's not working, there's obviously little sense in trying to program the MCU. Assuming that the ATMega324PA has the same signature as the ATMega324P (I don't have the detailed datasheet for that chip), you should see the signature of 0x1e 0x95 0x08.

If that doesn't work, I'd suggest stripping 6 pieces of 22-gauge wire and temporarily abandoning your header setup and/or trying another MCU.

Please update us with whatever you find (good or bad!).

Good luck!

Regards,
Bill
 
 View user's profile Send private message  
Reply with quote Back to top
larryvc
PostPosted: Jul 12, 2012 - 09:54 PM
Raving lunatic


Joined: Dec 06, 2007
Posts: 2512
Location: Redmond, WA USA

That was going to be my next suggestion but Bill beat me to it.

meteor wrote:
...but a pure GNU/Linux guy..

We can't all be normal. Wink

Let us know Codedawg.

_________________
Larry

Those afraid to embrace the future will quickly fade into the past. - larryvc
 
 View user's profile Send private message  
Reply with quote Back to top
bobgardner
PostPosted: Jul 12, 2012 - 10:08 PM
10k+ Postman


Joined: Sep 04, 2002
Posts: 21391
Location: Orlando Florida

The mega324 is a square surface mount chip right? Did you make the board or is it a commercial product? I betcha theres an ISP header on it for programming....

I still use AS4 to talk to my AVRisp mkii for programming. I have AS6 and a JTAG3 that seem to talk to each other. If I turn on AS6 with the AVRisp mkii plugged in, it asks if I want to upgrade the firmware, so I assume it asked you this same question the first time to went into the device programming dialog?

Those 44 pin packs have a VCC on each side and an AVCC on one side. All those need to go to 5V. All gnds need to go to gnd. Need a Big Fat Cap on the board and a .1 on a couple of the VCCs.

_________________
Imagecraft compiler user


Last edited by bobgardner on Jul 12, 2012 - 10:13 PM; edited 1 time in total
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
meteor
PostPosted: Jul 12, 2012 - 10:12 PM
Hangaround


Joined: Dec 11, 2010
Posts: 183


bobgardner wrote:
The mega324 is a square surface mount chip right?
Right, but it also comes in a 40-pin PDIP version.
 
 View user's profile Send private message  
Reply with quote Back to top
Codedawg
PostPosted: Jul 13, 2012 - 02:11 PM
Wannabe


Joined: Jun 06, 2012
Posts: 91
Location: Shelton, CT

Hi everyone --- I've succeeded in connecting and getting the device ID! ATmega324PA's device sig is 0x1E9511. Smile

I had all GND pins going to ground and VCC going to 5 V source coming from a 7805 but there must be some serious noise(?) coming off my power source. I added a pair of decoupling caps (100nF) to the each of the Vcc pins. Bob led me in the right direction and I found this article/doc with an example layout ---- http://www.atmel.com/Images/doc2521.pdf

Lots of thanks to you all and meteor, sorry about that, I guess it was a circuit issue in the first place.

Also, atmega324pa comes in both DIP and SMD. I can verify this works properly with an AVRISP MKII and AVR Studio 6 with Windows 7 64-bit.

Not sure how to mark this thread as "Solved" though... Do I do this or do moderators?


bobgardner wrote:
The mega324 is a square surface mount chip right? Did you make the board or is it a commercial product? I betcha theres an ISP header on it for programming....

I still use AS4 to talk to my AVRisp mkii for programming. I have AS6 and a JTAG3 that seem to talk to each other. If I turn on AS6 with the AVRisp mkii plugged in, it asks if I want to upgrade the firmware, so I assume it asked you this same question the first time to went into the device programming dialog?

Those 44 pin packs have a VCC on each side and an AVCC on one side. All those need to go to 5V. All gnds need to go to gnd. Need a Big Fat Cap on the board and a .1 on a couple of the VCCs.
 
 View user's profile Send private message  
Reply with quote Back to top
david.prentice
PostPosted: Jul 13, 2012 - 02:46 PM
10k+ Postman


Joined: Feb 12, 2005
Posts: 16547
Location: Wormshill, England

You just need to edit your first post. You can change the Subject title from there.

With digital circuits, they all need those 100nF ceramic capacitors on the VCC pins.

David.
 
 View user's profile Send private message Send e-mail  
Reply with quote Back to top
Torby
PostPosted: Jul 13, 2012 - 03:15 PM
Raving lunatic


Joined: Nov 11, 2003
Posts: 4040
Location: Chicago Illinois USA

The POWER of a bypass cap!

_________________
Discursive design,

Torby

Some days, it's just not worth chewing through the restraints.
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
meteor
PostPosted: Jul 13, 2012 - 04:43 PM
Hangaround


Joined: Dec 11, 2010
Posts: 183


Codedawg wrote:
[...] and meteor, sorry about that, I guess it was a circuit issue in the first place.
No problem, 'dawg. Glad to hear that Bob's advice was the key and that things are working now!

I'm also glad to see that you followed up on this thread. It might help a newcomer to AVR/MCUs to avoid the same mistake and it even serves to remind others giving advice (like me) to not forget about the basics. Smile

As it turns out, the current official version (5.11.1) of AVRDUDE only supports the ATMega324P (signature 0x1e9508) but not the ATMega324PA (0x1e9511), so that would have been another hurdle (unless you used Magister's compilation, which was undoubtedly made from an SVN release that is newer than 5.11.1 and does support some of the more recently appearing variants like the '324PA).
larryvc wrote:
meteor wrote:
...but a pure GNU/Linux guy..
We can't all be normal. Wink
Hey! I resemble that remark! Wink

Off now to download the full datasheet for the ATMega324* series so I'm up-to-date for the next time....
 
 View user's profile Send private message  
Reply with quote Back to top
david.prentice
PostPosted: Jul 13, 2012 - 07:47 PM
10k+ Postman


Joined: Feb 12, 2005
Posts: 16547
Location: Wormshill, England

Quote:
As it turns out, the current official version (5.11.1) of AVRDUDE only supports the ATMega324P (signature 0x1e9508) but not the ATMega324PA (0x1e9511), so that would have been another hurdle (unless you used Magister's compilation, which was undoubtedly made from an SVN release that is newer than 5.11.1 and does support some of the more recently appearing variants like the '324PA).


Yes. Avrdude 5.10 only knows ATmega324P with Signature 0x1E9711 (correct)
Avrdude 5.11 knows ATmega324PA with Signature 0x1E9711 (correct)
and knows ATmega324P with Signature 0x1E9708 (wrong)

The correct values should be:
(ATmega324 with Signature 0x1E9708)
ATmega324A with Signature 0x1E9708
ATmega324P with Signature 0x1E9711
ATmega324PA with Signature 0x1E9711

David.
 
 View user's profile Send private message Send e-mail  
Reply with quote Back to top
meteor
PostPosted: Jul 13, 2012 - 08:41 PM
Hangaround


Joined: Dec 11, 2010
Posts: 183


david.prentice wrote:
Yes. Avrdude 5.10 only knows ATmega324P with Signature 0x1E9711 (correct)
Avrdude 5.11 knows ATmega324PA with Signature 0x1E9711 (correct)
and knows ATmega324P with Signature 0x1E9708 (wrong)

The correct values should be:
(ATmega324 with Signature 0x1E9708)
ATmega324A with Signature 0x1E9708
ATmega324P with Signature 0x1E9711
ATmega324PA with Signature 0x1E9711
David, unless my datasheets are wrong, I think you need new spectacles, my good man. Wink Or maybe I do. Smile

Here's what the various Atmel datasheets that I have show:
  • ATMega324P = 0x1e9508
  • ATMega324PA = 0x1e9511
  • ATMega324A = 0x1e9515
Note also that the middle signature byte of all the 324* variants is 0x95 not 0x97.

I don't have any information (from AVRDUDE config files or Atmel datasheets) about the bare ATMega324, but I'd expect that your value (after correcting for the 97->95 issue) is correct (i.e. 0x1e9508)

What I said in my previous post is, I believe, still correct (not that I think you were attempting to dispute it in any fashion). What I should add is this: if I understand correctly, no version of AVRDUDE (even in SVN checkout as of Feb 2012) supports the ATMega324A (i.e. signature 0x1e9515).

Regards,
Bill

Edit: Change an erroneous "328" -> "324".
 
 View user's profile Send private message  
Reply with quote Back to top
david.prentice
PostPosted: Jul 13, 2012 - 09:24 PM
10k+ Postman


Joined: Feb 12, 2005
Posts: 16547
Location: Wormshill, England

Oops. The 95 was definitely a typo. (I have just been reading a mega128 with a mega324PA !)

I had also rather assumed that the A devices had the same Signature as the non-A devices.

Which obviously does not apply to the mega324, 324A, 324P, 324PA.

I must do my homework first.

A chip like the ATtiny2313A has the same Signature as the ATtiny2313, but has extra features like USART_MSPI and RSIG.

Whereas I can understand newer models with extra features, the new non-P chips appear to be going backwards. The different features deserve a unique Signature. So there is a certain inconsistency.

David.
 
 View user's profile Send private message Send e-mail  
Reply with quote Back to top
meteor
PostPosted: Jul 13, 2012 - 09:46 PM
Hangaround


Joined: Dec 11, 2010
Posts: 183


This chip naming/features/signatures thing is a bit of a mess, isn't it?

Fortunately, I have the distinct advantage of having just enough senility to not trust my memory and/or make too many assumptions without having so much senility that I forget what "MCU" stands for. Glad to hear I don't (yet) need new spectacles! Smile
 
 View user's profile Send private message  
Reply with quote Back to top
DocJC
PostPosted: Jul 13, 2012 - 09:50 PM
Raving lunatic


Joined: Dec 11, 2007
Posts: 6980
Location: Cleveland, OH

Quote:
unless my datasheets are wrong


Well, at least on the newer Xmega data sheets a number of the Signatures appear to be listed incorrectly.

It therefore would not surprise me if some of the older Mega and Tiny data sheets also have errors in their Signatures.

JC
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
meteor
PostPosted: Jul 13, 2012 - 10:20 PM
Hangaround


Joined: Dec 11, 2010
Posts: 183


Good to know... thanks, Doc! Unfortunately, I own none of the ATMega324* variants, so I cannot confirm or deny the authenticity of the datasheets and/or AVRDUDE configuration files. But if I see any errors going forward, I'll be sure to point them out to Atmel, however useful (or fruitless!) that may prove. Wink
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits