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
s_mack
PostPosted: May 31, 2012 - 06:33 AM
Hangaround


Joined: Oct 15, 2010
Posts: 317


I was working on a project and suddenly I can't read/write/anything via ISP. I've been at this for hours and I've boiled this bloody thing down to its bare nuts and it still won't work.

  • I've confirmed the programmer is fine - I can operate with other targets just fine
  • To rule out the connections, I've re-done them about a thousand times. I now have very short wires soldered directly to the AVR's pins and it still doesn't work
  • Fine, so the Mega is toast... so I removed it and replaced it with a fresh virgin right out of the package... still nothing


What can possibly be wrong with a circuit that prevents it uC connecting when I have direct connections to the appropriate pins??? Could a faulty cap (or??) down a line somehow cause this problem? If the crystal was damaged? That shouldn't matter for a virgin chip, should it?

I'm so pissed off right now... and dead tired. I've been fighting with this all day and now I'm behind and for nothing!

I'm going to bed, but if you have any tips for me to look at in the morning... appreciated.


BTW: what's the bare minimum circuitry needed for ISP programming? I've never tried it, but can you hook an ISP directly to an AVR with zero other components? If so, I suppose I could begin cutting traces in a deductive effort.


ISP = USBasp (purchased. Confirmed working)
Target = Atmega128 fresh from the package
Circuit = Chinese r/c radio controller (schematic)
 
 View user's profile Send private message  
Reply with quote Back to top
meslomp
PostPosted: May 31, 2012 - 06:49 AM
Raving lunatic


Joined: May 02, 2007
Posts: 3007
Location: Nieuwegein, Netherlands

is there any other stuff connected to the ISP/SPI lines? I have had this problem in the past where i connected a display to the SPI lines(used as GPIO) that would sometimes keep one of the lines low making programming impossible.

As you have already soldered wires directly to the AVR pins, perhaps you can lift the pins and then connect the ISP and see what happens. If it then works, put a 1K resistor in series with the lines after the programming pads, so even when the other stuff pulls the line low the programmer sees a 1K load. (just see you have 200 Ohms with a 100nf(???) cap that will probably kill the signal.)
what happens if you remove the 200R?

_________________
1)Datasheet and application notes checked?
2)tutorial forum
3)Newbie start here
 
 View user's profile Send private message  
Reply with quote Back to top
js
PostPosted: May 31, 2012 - 06:50 AM
10k+ Postman


Joined: Mar 28, 2001
Posts: 20338
Location: Sydney, Australia (Gum trees, Koalas and Kangaroos, No Edelweiss)

I don't know who was the ixxxt (sorry Embarassed ) who designed that board but it shows ALL electrolytics REVERSED.

A HUGE 47uF (also reversed) on the reset line MUST NOT be there, 47nF to 100nF max.

Extremely small resistors on the ISP pins, so if anything drives those pins it will kill the ISP signals.

_________________
John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
s_mack
PostPosted: May 31, 2012 - 07:38 AM
Hangaround


Joined: Oct 15, 2010
Posts: 317


John, try not to get caught up on the design. Hundreds of thousands of these (literally) are on the market and work just fine, and tens of thousands of us regularly flash them the same way I've been doing with this exact unit for a couple of years. Something is damaged... has to be... its not a design flaw that's causing the problems.

Meslomp, there's nothing serial connected (UART, etc) if that's what you mean, but the MOSI, MISO, and SCK lines all pull dual-duty as GPIO (switches).

If you remove the 200R then the cap screws with the ISP (I tried that in the past for some unrelated reason - when everything was working fine). The caps are there, supposedly, for RF noise supression.


Quote:
Extremely small resistors on the ISP pins, so if anything drives those pins it will kill the ISP signals.


Thanks John... that gives me something to look for in the morning. Perhaps one of the switches sharing those pins is stuck and driving to ground. I kinda don't think so because I tested for shorts, but I wasn't looking specifically at that.
 
 View user's profile Send private message  
Reply with quote Back to top
s_mack
PostPosted: May 31, 2012 - 07:44 AM
Hangaround


Joined: Oct 15, 2010
Posts: 317


s_mack wrote:

Quote:
Extremely small resistors on the ISP pins, so if anything drives those pins it will kill the ISP signals.


Thanks John... that gives me something to look for in the morning. Perhaps one of the switches sharing those pins is stuck and driving to ground. I kinda don't think so because I tested for shorts, but I wasn't looking specifically at that.

Nevermind, that was easy to check - took me 20 seconds. Not the issue.

ps. The tant caps are correct. I'm gathering its just poor (or at least ambiguous) notation.


Last edited by s_mack on May 31, 2012 - 07:48 AM; edited 1 time in total
 
 View user's profile Send private message  
Reply with quote Back to top
david.prentice
PostPosted: May 31, 2012 - 07:47 AM
10k+ Postman


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

Are the electrolytics connected backwards ?
Or is it just the schematic?

I presume that ISP lines are shared with push buttons.
A stuck button will kill your ISP. If those series resistors were 1k or so, ISP could co-exist with stuck buttons.

Observing the ISP signals with a logic analyser or scope would help.

Likewise checking that you actually have a 16MHz clock. Does any existing firmware run ?

David.
 
 View user's profile Send private message Send e-mail  
Reply with quote Back to top
s_mack
PostPosted: May 31, 2012 - 07:51 AM
Hangaround


Joined: Oct 15, 2010
Posts: 317


Hi David. See (cross?) post above for answers to some Q's.

I wish I had a scope - I don't.

I am curious if the problem is the crystal... but as I asked originally... should it matter with a virgin chip? The fuses aren't even set yet.

No, there's no firmware at all... its a fresh chip. Before I placed the fresh chip in, the answer would still be "no" because it crapped out on me after an erase. I thought I just fuse bricked it, but I couldn't get it working again so I resorted to swapping for a fresh uC. Here we are.
 
 View user's profile Send private message  
Reply with quote Back to top
david.prentice
PostPosted: May 31, 2012 - 08:05 AM
10k+ Postman


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

If it is a virgin chip, it starts in M103C compatibility mode. i.e. guaranteed to fail all mega128 programs.

And the virgin starts off with 1MHz RC, so you have to ISP very slowly. e.g. avrdude -B5

If you post the actual avrdude command and response, it would be helpful.

All the same, my money is on poor soldering.

David.
 
 View user's profile Send private message Send e-mail  
Reply with quote Back to top
danni
PostPosted: May 31, 2012 - 09:51 AM
Raving lunatic


Joined: Sep 05, 2001
Posts: 2496


s_mack wrote:

Target = Atmega128 fresh from the package


Are you sure, that you have it connected right Question

The ISP connection differs on the 64 pin case from all other AVRs Exclamation

64 pinners are:
ATmega64, ATmega128, ATmega1281, ATmega2561, AT90CAN128


Peter
 
 View user's profile Send private message  
Reply with quote Back to top
s_mack
PostPosted: May 31, 2012 - 02:40 PM
Hangaround


Joined: Oct 15, 2010
Posts: 317


Yes, I know I have to program it slowly... I used B300 and it still failed. Poor soldering? Possibly, but that statement is hardly helpful without some tips on what else to look for. I've confirmed good continuity and no cross-continuity (shorts/bridges) on all ISP lines and all vcc/gnd pins on the mega.

Peter... Yes, I know the 64 uses odd-ball ISP. Again, I've successfully flashed this exact device hundreds of times. It *suddenly* stopped working and I've ruled out (I believe) the programmer, my connections, and the chip. It has to be something else in-circuit that is fine by design, but has failed.


usbasp output is useless... target doesn't respond. But I'll -vvv it and post it later today.
 
 View user's profile Send private message  
Reply with quote Back to top
danni
PostPosted: May 31, 2012 - 03:18 PM
Raving lunatic


Joined: Sep 05, 2001
Posts: 2496


Then I would wire a small DIP-AVR (e.g. ATtiny25, ATmega8) on a breadboard and check,
if the programmer was still alive.


Peter
 
 View user's profile Send private message  
Reply with quote Back to top
danni
PostPosted: May 31, 2012 - 03:29 PM
Raving lunatic


Joined: Sep 05, 2001
Posts: 2496


I see on the schematic some faults:
On reset you should use 0.1µF, but never 47µF.
On MISO, MOSI and SCK I see 0.1µF, that's too big.
No wonder, that nothing works.

Remove all caps on the switches and debounce in software. Exclamation

It make programming easier and cost no noticeable resources (CPU-load, Flash).

http://www.avrfreaks.net/index.php?modu ... em_id=1801


Peter


Last edited by danni on May 31, 2012 - 03:35 PM; edited 1 time in total
 
 View user's profile Send private message  
Reply with quote Back to top
s_mack
PostPosted: May 31, 2012 - 03:35 PM
Hangaround


Joined: Oct 15, 2010
Posts: 317


Come on Peter! You obviously didn't read what I wrote.

1) its not the programmer. As I *already said*, I confirmed it works.

2) As I *already said* this problem has nothing to do with the design. This is a commercial product with hundreds of thousands of units on the market AND I've been using this exact unit for years.
 
 View user's profile Send private message  
Reply with quote Back to top
danni
PostPosted: May 31, 2012 - 03:47 PM
Raving lunatic


Joined: Sep 05, 2001
Posts: 2496


s_mack wrote:

2) As I *already said* this problem has nothing to do with the design. This is a commercial product with hundreds of thousands of units on the market AND I've been using this exact unit for years.


A design fault must not cause malfunction immediately.
And these caps on the 4 lines are design faults.

It should be very easy to remove them and look, if it works.

Instead removing the caps on the switches, you can increase the 200R e.g. to 4.7k,
so the caps no longer short circuit the signals on the SPI lines.


Peter
 
 View user's profile Send private message  
Reply with quote Back to top
kk6gm
PostPosted: May 31, 2012 - 03:54 PM
Raving lunatic


Joined: Sep 12, 2009
Posts: 2398
Location: Sacramento, CA

I usually program a newly-soldered board with just AVR, power bypass caps and reset R/C installed, to pre-test it before continuing. Given what you seem to have ruled out so far, I'd look for problems with power or ground.
 
 View user's profile Send private message  
Reply with quote Back to top
s_mack
PostPosted: May 31, 2012 - 04:20 PM
Hangaround


Joined: Oct 15, 2010
Posts: 317


thoughts on what to look for? I've confirmed 5v across each a/vcc pin and GND, and continuity of GND points between ISP and target board.
 
 View user's profile Send private message  
Reply with quote Back to top
kk6gm
PostPosted: May 31, 2012 - 04:32 PM
Raving lunatic


Joined: Sep 12, 2009
Posts: 2398
Location: Sacramento, CA

Hmmm, you need to buy a scope. And a cheap stereo microscope (you'd be amazed what some "good" solder joints look like up close!).

If you have power to all power pins
and ground to all ground pins
and power bypass caps
and proper reset R/C values
and programmer ground connected to AVR ground
and programmer signals connected to AVR ISP pins
and AVR ISP pins are not interfered with
and programmer works
and AVR is not trashed
and programmer speed is slow enough

then it should work.
 
 View user's profile Send private message  
Reply with quote Back to top
s_mack
PostPosted: May 31, 2012 - 05:06 PM
Hangaround


Joined: Oct 15, 2010
Posts: 317


kk6gm wrote:
Hmmm, you need to buy a scope.
agreed.
kk6gm wrote:
And a cheap stereo microscope (you'd be amazed what some "good" solder joints look like up close!).
Have one. And the solder joints are fine. Not perfect... too much solder on some so I'm not going to enter it in a "how to solder" photo contest... but that's not the issue

kk6gm wrote:
If you have power to all power pins
Check.
kk6gm wrote:
and ground to all ground pins
check.
kk6gm wrote:
and power bypass caps
You mean that they're there? Or that they're getting power.
kk6gm wrote:
and proper reset R/C values
again, the design works
kk6gm wrote:
and programmer ground connected to AVR ground
check
kk6gm wrote:
and programmer signals connected to AVR ISP pins
check
kk6gm wrote:
and AVR ISP pins are not interfered with
still to confirm
kk6gm wrote:
and programmer works
check
kk6gm wrote:
and AVR is not trashed
what are the odds? I guess I can take it out of circuit and program in a simple breakout board.
kk6gm wrote:
and programmer speed is slow enough
can't get any slower... check.

kk6gm wrote:
then it should work.
hence the "SO FRUSTRATED" portion of the post title.




Someone asked for avrdude command and output:

Code:
avrdude -p m128 -c usbasp -U flash:r:test.bin:r -vvv
yields
Code:

avrdude: Version 5.10, compiled on Jan 19 2010 at 10:45:23
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "e:\WinAVR-20100110\bin\avrdude.conf"

         Using Port                    : lpt1
         Using Programmer              : usbasp
avrdude: seen device from vendor ->www.fischl.de<-
avrdude: seen product ->USBasp<-
         AVR Part                      : ATMEGA128
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom         4    12    64    0 no       4096    8      0  9000  9000 0xff 0xff
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           flash         33     6   128    0 yes    131072  256    512  4500  4500 0xff 0xff
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           calibration    0     0     0    0 no          4    0      0     0     0 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : usbasp
         Description     : USBasp, http://www.fischl.de/usbasp/

avrdude: auto set sck period (because given equals null)
avrdude: error: programm enable: target doesn't answer. 1
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.
Note above example I forgot the -B switch, but same result.
 
 View user's profile Send private message  
Reply with quote Back to top
s_mack
PostPosted: May 31, 2012 - 05:35 PM
Hangaround


Joined: Oct 15, 2010
Posts: 317


Well, I got lucky. I decided to go at it one pin at a time. I started with the most obvious culprit - RST - and I cut the trace at the pin and added my own 10k resistor and .1uF cap... and it worked.

So then I remove the 47uF cap they used and put it in place of my .1uF cap... and it still worked.

So then I figure it must be their 10k res... but it measures 10k pretty well on the dot so I doubt it. I remove it from the board and replace my 10k with that one. Still worked.

So then I temporarily conceed that everything was fine and I must have screwed up somewhere, so I bridge the knifed trace and put the components back the way they were...

AND IT DOESN'T WORK!

What in the world is going on???

If I had a scope, would that really help here? What would I even take readings of?

Looking at the schematic again, could it somehow be that inductor @ L1? Its marked 10u... 10uH I suppose? I don't have anything here that low to replace it with. 220uH is the smallest I have on hand. Any chance that's causing my grief? Should I bother ordering up a 10uH?
 
 View user's profile Send private message  
Reply with quote Back to top
chartman
PostPosted: May 31, 2012 - 06:38 PM
Resident


Joined: May 01, 2003
Posts: 577


Just short out the L1. It won't hurt. It just adds a bit of 'quality' to the Avcc pin.
In my avr designs, I don't use a resistor or a cap on /RST .....and I program with AVRISP MkII no problem.
Just my 2p in this frustrating saga.
Are you in the UK ? Where ?
 
 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