ISP not working - What should the waveforms be?

Go To Last Post
13 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi!

I'm new to the world of AVR development, but quite ok with microcontrollers, programming and electronics. [oh, btw, I'm a student hobbyist :D]

I wanted to build a simple PPPD to program an AtMega8 and an AtMega128 [I have an eval board for the atmega8 made by a friend and am still waiting for the mega128 ic's]. I decided to go with the simple wires/resistors programmer, but added an HEF4050 buffer [taking power from the target] to make sure that if I had problems and shorts on the side of the target I would fry the 4050 instead of my parallel port. Also added R-C filters after the buffer to avoid ringing and stuff.

When I try to download my first program using PonyProg I get the message "Device missing or unknown device (-24)". The same happens when I try to read the program already in flash [board was used in other projects before I got it].

Anyone has any idea what the problem can be? Anyone can help me?

Further information:

1: Target has an 11.0592MHz crystal, oscillating reliably [observed on scope].

2: Lines from buffer to RST, MOSI and SCK have a rise time around 1-2uS.

3: Line from buffer into PC [from MISO] has a rise time of about 5uS or less [maybe cable is too long,
60cm or series resistance too high].

4: Series resistors on parallel port are 4k7 on outputs from PC and 1k on input to PC [reduced resistance to decrease rise-time].

5: All lines tested with 80kHz square wave as input. Outputs are all acceptable square waves with slightly rounded edges.

6: PonyProg is running in AVR ISP I/O mode, bus speed set to SLOW. none of the lines is inverted

7: Waveforms observed during programming attempt [very approximate since I have an old analogue scope and it all happens so fast] are
-> approx 20mS on, 20mS off pulses on reset line
-> occasional narrow pulses on SCK line, approx 1-2mS
-> slightly wider pulses, indeterminate width but still much narrower than the reset pulses on MOSI and MISO

Please help me if possible! I always find the "downloading for the first time" a little problematic with microcontrollers! [just like "setting up the first project" :evil: ]

Thanks for any feedback!

nxp

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

nxp wrote:
Also added R-C filters after the buffer to avoid ringing and stuff.

Is this really necessary? What's the cut frequency of your filters?

nxp wrote:
4: Series resistors on parallel port are 4k7 on outputs from PC and 1k on input to PC [reduced resistance to decrease rise-time].

I use pure passive programming cables, and use 1K on all lines except SCK, where I use 5.6K. If I remember correctly, initially I had values higher than 1K on the other lines, but it refused to work. My cable is ~50cm.

nxp wrote:
7: Waveforms observed during programming attempt [very approximate since I have an old analogue scope and it all happens so fast] are
-> approx 20mS on, 20mS off pulses on reset line
-> occasional narrow pulses on SCK line, approx 1-2mS
-> slightly wider pulses, indeterminate width but still much narrower than the reset pulses on MOSI and MISO

You seem to have activity on all lines, which is a good indicator, specially the MISO which means that the AVR is answering "something". The RESET line should be active (low) during the entire programming cycle, meaning that activity on the other lines should only happen while RESET is low.
I've never use ponyprog, so I can't help you with that. Maybe it is just a configuration issue. Also, are you sure the input line on the LPT is working, or that you have connected it to the correct pin?
Is your GND correctly attached between the target system and the PC?
What's the voltage on your target's Vcc? Is it high enough that the PC can "read" it?

Embedded Dreams
One day, knowledge will replace money.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hmm, I thought that the filters would simply help avoid excessive ringing [which happened to me with long lines driven extremely fast in the past]. Cutoff frequency should not be a problem - 1/(2PI*R*C) R is 220ohms and C is 330pF - should give a cutoff around 2MHz.

I will try using a completely passive cable for the next step. Levels from target back to PC should not be a problem since the supply voltage measures at 5.6V [output from a 7805 regulator]. Ground is shared, with the ground pin on the ISP header connected to the ground of the buffer which in turn is conencted to the shield and ground signals of the port.

I will also try backing down the protection resistor values - it's a risk for the parallel port but if I'm careful it should not be a problem.

I doubt that the problem is with signal levels and transition speed, more inclined to suspect configuration. What programmer software do you use? I heard that avrdude is good, but I'm not really a fan of command line software. I will try it anyway.

nxp

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

nxp wrote:
Levels from target back to PC should not be a problem since the supply voltage measures at 5.6V [output from a 7805 regulator].

Without having a look at the datasheet, I would say that the output of the 7805 is too much out of the spec... you may have some problem there.

nxp wrote:
Ground is shared, with the ground pin on the ISP header connected to the ground of the buffer which in turn is conencted to the shield and ground signals of the port.

It may not be the problem, but I have read somewhere that the shield and the ground pins of parallel ports are *not* exactly the same. You should not connected them together.

nxp wrote:
I doubt that the problem is with signal levels and transition speed, more inclined to suspect configuration. What programmer software do you use?

I use a piece of software that I wrote myself. When I started with AVRs I couldn't make ponyprog nor other programs I found to work, so I ended-up developing my own... sorry, I've never used any other piece of software so I can't help you with configuration. Try to search the foruns here.

Embedded Dreams
One day, knowledge will replace money.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The M128 doesn't program with the MISO/MOSI lines, you use the uart lines instead. I think they're PE0/PE1. Yes it's annoying that Atmel did this with only a few micros.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have re-tried with a purely passive cable. results are no better than before. Low valued resistors in series with RESET, SCL, MOSI and MISO. GND not shorted to SHIELD but connected to it through a high-value resistor [to keep shield from floating].

There is activity on the RESET, SCL and MOSI lines, but nothing on the MISO. No idea what on earth is going on!

Maybe PonyProg is not configured correctly for my Mega8. Attempted to use the AvrDUDE programmer with a gui front-end, but it could not access my parallel port... Does anyone know where I can get the original AVRISP program or something similar?

dksmall wrote:

Quote:

The M128 doesn't program with the MISO/MOSI lines, you use the uart lines instead. I think they're PE0/PE1. Yes it's annoying that Atmel did this with only a few micros.

Thanks for that hint. I will check out the datasheet and make sure my PCB is correct for programming. :)

nxp

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Can you post a schematic of your setup/cable?

Embedded Dreams
One day, knowledge will replace money.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

[img]C:\Nathanael\PFIT\download_cable.png[/img]

This is the schematic of the cable. Sorry but I dont have a schematic of the board yet.

Following the tracks there is only a 5V power supply, well filtered with a 470uF+100nF before a 7805 and 100uF+100nF after it, an 11.0592MHz crystal with 6.8pF caps [oscillating ok] and headers/interface to off-board stuff with a few transistors/mosfets/max232 - certainly nothing that should interfere with programming.

I hope I explained in detail enough!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ooops! This is the schematic.

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

By the drawing you seem to have the GND pins connected to nothing.
Well, I really think you don't need to connect the shield part. 5K1 is not that low.
You need to be carefull with other devices connected to the pins used for programming. Check if the reset line can go low.
Did your friend ever tried the eval board he made, or are you testing it for the first time? If you are, then you should test at least all relevant connections with a multimeter. Measure direclty on the chip's pins to make sure they are really connected to the PC. Also, are you sure the AVR is working? Try another one.
6.8pF seems to me a bit low, but if you say it's oscillating... well, when you put a scope probe on it you are increasing the capacitance.
If you have some wires with clips in the extremes, ou could try to program a chip "out-of-the-board".
With the current info available I don't have any more ideas.

Embedded Dreams
One day, knowledge will replace money.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sorry for the mistake with the ground pins! In reality the ground on the AVR side is connected to the eight ground pins on the PC side, but in the software I used to draw I cannot give two different names to a single net, so I had it split up.

As for the board, yes it has been used before, in two separate applications, so I have no doubt that the chip was programmed before.

I will try your suggestions - if they do not work I will try to contact my friend, even though he is out of the country. Hopefully it will turn out to have been some silly mistake.

Thank you for the patience and the hints given. :)

nxp

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It works!

I have managed to download and read the flash of my Mega8 - here is the story.

I first upgraded my version of PonyProg, was running a version released in 2000, now I'm running the recent 2.05 version released in 2002.

Still nothing worked - the error messages just changed from "Device missing or unknown device" to "Unable to access port".

Got angry and "borrowed" a relative's pc running windows 98 - here it could access the parallel port but still did not program.

Managed to contact my friend via messenger and we decided I could try flipping MISO/MOSI. A little hot solder and a few minutes later I managed to read the chip and download new code.

I looked through the datasheet and page 237 confirmed that in fact the miso/mosi lines were connected wrong before. Seems I had copied the schematic wrong... :(

To work on my pc I tried re-installing the windows xp drivers for the parallel port, and then instaling PonyProg again. Worked on the THIRD time. [yes, Windows XP is the ultimate engineering development platform ever conceived. Grrr...]

Anyway, thanks for the help provided! I appreciate greatly.

nxp

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok, I'm glad you found the bug :)!

Embedded Dreams
One day, knowledge will replace money.