AVRISP mkII and ATmega8

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

Hi, I recently bought an AVRISP mkII programmer and have installed the latest version of AVRstudio, along with the USB driver, and the programmer is connected properly to my PC.

My next problem is connecting this to an ATmega8 to begin programming. I have searched for guides, but they all just say connect the 6-pin ISP connecter to the corresponding connector on the 'programming board.' Well I don't have one (and was under the impression that one wasn't needed) and instead and simply trying to build a circuit on the breadboard and program it this way.

Can someone help me out with the pin connections? I have the 6pin ISP connector with:

-GND
-VTG
-MOSI
-MISO
-SCK
-RESET

On the ATmega8 datasheet I found the SPI pins of the processor:

-PB5 (pin 19): SCK
-PB4 (pin 18): MISO
-PB3 (pin 17): MOSI
-PB2 (pin 16): nSS (slave select)
-PC6 (pin 1) : nRESET

Do I just connect the pins of the programmer directly to the corresponding pins of the ATmega8 (And the circuits 5V supply), and begin programming? Is there any intermediate circuiry needed like pull-up/pull-down resistors of buffers? Also what do I do with slave select, clamp it to ground?

Is there a guide for begginers that does not talk about using a 'programming kit/board', but connecting the programmer directly?

Thanks

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

yes that is correct. RESET-RESET, MOSI-MOSI, MISO-MISO, SCK-SCK. And then of cource VCC and GND. Note that the programmer does not provide power to your board with the AVR, your AVR board is what provides power to the AVRISP

Writing code is like having sex.... make one little mistake, and you're supporting it for life.

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

glitch wrote:
yes that is correct. RESET-RESET, MOSI-MOSI, MISO-MISO, SCK-SCK. And then of cource VCC and GND. Note that the programmer does not provide power to your board with the AVR, your AVR board is what provides power to the AVRISP

So I can connect the pins directly with no buffers or pull-up/pull-down resistors?

Also, what about the case where the AVR in my target circuit uses the SPI pins for something else? Do I need any extra circuitry in this case?

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

The Reset generally has a weak pullup (10-100k).

As for interference from other devices, it really depends on the other device.

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

in the case of having other SPI devices on those lines, it should be fine, provided that you can guarantee that they remain in the deselected state during the programming cycle. (ie pull their /CS lines with external resistors so they remain deselected)

It also does not hurt to isolate the SPI devices from the AVR, and programming header, with some series resistors.

Writing code is like having sex.... make one little mistake, and you're supporting it for life.

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

Yep. When I first started doing some little projects on a smaller breadboard I just put the wires from the ISP cable to the pins on the IC via the breadboard. I'm sure that is not completely recommended. I'd recommend soldering a 6pin isp male header to a 8pin dip socket(hard to explain but get creative).

Have fun!

David

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

I'm planning to go to the electronics shop tomorrow and buy a couple of things to make myself an adapter for the breadboard. At the moment though, I plugged the MPU into the breadboard and used individual leads to connect the ISP lead to the IC.

All my connections are correct, as you've suggested. I'm sure there are no short circuits, and my supply voltage is approx 4.6V (I have checked all my power pin voltages with a multimeter).

However the indicator LED is displaying a steady red light...according to this documentation this means the programmer is idle with no power from the target circuit.

Also when I click 'read signiture' in AVR studio, it says it couldn't be read, and gives me an error.

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

I tried to boost my supply voltage to 5V (I only have a 9V battery for power, so changed the voltage divider I'm using), and have a weird problem. When I read the voltage across the divider, with the output lead disconnected from the power rail of the breadboard, it reads 5.03V, but as soon as I connect the lead to the rail, the voltage reading on all connections to the positive rail drops to 1.43V.

I have no idea why this is happening. I tried it with and without a 10k pullup on the reset pin, and with and without grounding the /SS pin (I thought SPI only works when the chip is selected).

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

Are you trying to generate 5V power supply from a resistor voltage divider?

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

Don't confuse SPI with ISP. Although ISP is based on SPI, it does not use the /SS pin. For ISP the reset line is essentially the /SS pin.

As mentioned above, you cannot use a simple voltage divider as a power supply. This is because your voltage will drastically change with changes in load. You must use a regulator of some sort.

Writing code is like having sex.... make one little mistake, and you're supporting it for life.

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

theatrus wrote:
Are you trying to generate 5V power supply from a resistor voltage divider?

Yep

Quote:
As mentioned above, you cannot use a simple voltage divider as a power supply. This is because your voltage will drastically change with changes in load. You must use a regulator of some sort.

Ok, well I have a 7805 kicking about somewhere, I'll try that :)

Thanks

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

I tried with the regulator, and still no luck. The error message says to check whether the programmer is recieving power from the circuit, and to make sure the clock speed is 1/4 frequency of the MCU. Well both of those criteria are now met (clock is 125kHz) but I still can't connect to the chip.

What else can I try?

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

- Double check 5V is present on the Vcc pin.
- The reset pin should be pulled high (10k-100k)
- The reset pin should be at 5V due to the pullup.
- Double check that all the pinouts are right.
- Make sure you're counting from pin 1 on the connector and on the micro

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

Also make sure you have appropriate bulk capacitance on the output of the regulator. As well as bypass caps on the VCC's of the AVR.

Writing code is like having sex.... make one little mistake, and you're supporting it for life.

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

Connect the pins of the connector to the pins of the device and you must connect a pull up resistor greater than 4.7K to the RESET pin and 5V.-This MUST BE DONE.
And also remember never to set the RSTDSBL fuse that deactivates permanent the ISP programming and turns RESET pin to a normal pin.