ATtiny2313A, AVR Studio4/5, AVRISP MkII

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

Good morning all

Ok, so I bought myself an AVRISP MkII, did the board layout, purchased all the components and build the board. Installed AVR Studio5 and tried to connect to the target board.

When trying to read the device ID, I get this message:

Unable to enter programming mode. Please verify that the programmer is correctly attached to the target and that target power has been switched on. Also verify that the correct device and interface settings have been specified.

Timestamp:	2011-08-13 08:46:47.059
Severity:		ERROR
ComponentId:	20100
StatusCode:	0

Programming session setup failed: TCF command: Device:startSession failed:  Code:1 ,Service: ,Message from peer:Failed to enter programming mode. ispEnterProgMode: Error status received: Got 0xc0, expected 0x00

I've searched the forum and internet for this error and as far as I could understand, there might be problems win Studio5 and the suggestion is to roll back to Studio4. So I did, install Studio4 with all the SP I have.

Tried to connect and still does not work. I can read the target voltage, change the freq but whenever I try to read the fuse/lock bits I get a message

Setting mode and device parameters.. OK!
Entering programming mode.. FAILED!
Leaving programming mode.. OK!

The freq is set to 6.478 kHz, I've even tried lower freq with no different results.

I've updated the firmware of the MkII, the target voltage is 5.1V (this is what I read back into AVR Studio).

Here is the circuit diagram. DL2, DL5, R9, R8, SW1 and SW2 is not fitted.

http://i261.photobucket.com/albu...

The AVR ISP MkII lights lit up, the LED next to the USB connector is green as well as the LED next to the ISP cable.

What may be the reason why the ISP fails to connect to the target device?

This is my first attempt with an AVR ISP MkII, previously I've used a RS232 programmer with Atmega8's loaded with boot loaders.

[/img][/code]

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

You have a novel approach to circuit design.

Every component has an unusual value. Switches are connected in an inconvenient way. Your /RESET circuit has an inappropriate capacitor. You have no current limit on your LEDs. I could go on.

There are many commercial dev boards. Do not be proud. Copy their schematics. Use a similar pcb layout.

Adapt the trusted design for your needs. Ask here if you are unsure of something.

David.

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

First thing that comes to mind is that the pull-up resistors used on the ISP data and reset lines are a bit agressive. I would be more comfortable with 47K or 100K for these.

HTH.

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

Hi guys

Thank you for the feedback. A few questions and remarks.

david.prentice wrote:
You have a novel approach to circuit design.

Thank you..........I guess.

david.prentice wrote:
Every component has an unusual value. Switches are connected in an inconvenient way. Your /RESET circuit has an inappropriate capacitor. You have no current limit on your LEDs. I could go on.

Is it really that bad? :(

david.prentice wrote:
Switches are connected in an inconvenient way.

Switches are currently not fitted as mentioned in my post. How would you suggest the switches are connected? Any alternative methods?

david.prentice wrote:

Your /RESET circuit has an inappropriate capacitor.

What value would you suggest?

david.prentice wrote:

You have no current limit on your LEDs.

Sorry, forgot to mention that R7 and R10 has been fitted and the value used is 330R. The idea is not to have two LEDs on a port but rather to have the option to sink or source current to the LED, thus the reason for one resistor.

GZijlstra wrote:
I would be more comfortable with 47K or 100K for these.

Will 10k do? I don't have anything bigger at the moment. Still building up stock of SMD components.

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

Find an existing proven schematic.
Does it suit your needs?

Do you have the correct components?

To be honest, you can often get away with some different component values. Just post a link to the schematic, and say "R123 is supposed to be 456k. I only have 567k resistors, would they be ok?"

Likewise, you could ask about unusual switches or LEDs. Active-high switches are occasionally relevant. Active-low is a lot more convenient. Bi-colour LEDs can be useful.

David.

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

I see that some people don't add pull up resistors on the MOSI, MISO and SCLK lines.

What are the benefits from adding them and leaving them from the circuit?

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

There are NO benefits for using pull-up resistors on those lines.
You MUST always have a real external pull-up resistor on any /CS lines. In the case of ISP, /RESET is effectively the /CS line.

Since the AVR already has a weak internal pull-up on it's /RESET line, you could manage without. I recommend 10k .. 47k. I recommend no capacitor, but you could have say 1nF.

As I suggested earlier, copy an existing proven schematic. Ask questions about the specific numbered components e.g. R99 or C87.

David.

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

Ok, I found my problem. The MOSI and SCK pins on my PCB was swapped. Modded the PCB and I can read the device info.

Quote:

There are NO benefits for using pull-up resistors on those lines.

So it is ok to leave out the pull up resistors on MOSI, MISO an SCK. Thank you. Will remember that in the future.

I've also removed the cap on the reset pin, the diode and resistor is still fitted though.

Thank you for the feedback.

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

If the diagram is as the one currently showing I don't see any problems with component value.

HOWEVER the LEDs are likely to FRY (edit the ones going to LS1 and LS2). Put a series resistor in series with each LED (different values as the Red and Green have different voltage drop).

You DON'T need any resictors on the SPI lines, what the datasheet is saying is that IF you are using a load on those lines it should NOT BE lower than 1K otherwise ISP is likely not too work.

I have a DIP switch connected to those line in some boards (same with the JTAG pins), each switch has a 1K resistor in series so the position of the switch does't stop ISP but I can still read the switches during normal operation.

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

js wrote:
If the diagram is as the one currently showing I don't see any problems with component value.

HOWEVER the LEDs are likely to FRY (edit the ones going to LS1 and LS2). Put a series resistor in series with each LED (different values as the Red and Green have different voltage drop).

You DON'T need any resictors on the SPI lines, what the datasheet is saying is that IF you are using a load on those lines it should NOT BE lower than 1K otherwise ISP is likely not too work.

I have a DIP switch connected to those line in some boards (same with the JTAG pins), each switch has a 1K resistor in series so the position of the switch does't stop ISP but I can still read the switches during normal operation.


Thank you for the reply John. I'll keep the dip switch idea in mind for the next design.

I appreciate the feedback.

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

AVR042: AVR Hardware Design Considerations Application Note by Atmel notes that the Cap on the Reset\ pin is optional, as the micros already contain an internal LPF on this pin.

It does state, however, that adding the Cap can be helpful when operating the micro in a high noise environment.

The App Note does specifically state NOT to use any cap on the Reset\ pin if one is using the Debug Wire interface.

I have several boards with 10K & 0.1 uF caps and I have no problems programming them with any of several different programmers. David's suggestion of no Cap or 1 nF would certainly be another option.

JC