[DIS] ATMega16 ISP Question

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

First off I’m sorry if I have posted, in the wrong place. I’ve looked for a couple of days now with no luck.

I'm very new to the Micro controller world, i thought i would go out and buy a ready available IC Atmega16, which I have done, and now slightly regret it. all I’m looking for is a point in the right direction.

I have an The AVRISP mkII Programmer

Does anyone know of or have a wiring diagram including the connection of the ISP and sample code
just a simple flashing led would be a good start.

I hope that makes sense.

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

First off, your question is in the wrong forum. Rather post these questions in the avr forum. Maybe get a moderator to move it.

You first need to setup your atmega16 so that you can communicate with it. Which software are you planning on using?

Get the atmega16 datasheet so that you can get the pin layout of the atmega16. Then just connect the pins to your isp programmer. A quick google search shows that this site :http://www.grifo.com/PROG/HBI/uk_AVRISP.htm has the isp pinouts on your device. Then match those pins with pins on your atmega16 (ie. miso, mosi, sck reset, gnd and vtarget). If you get so far that you can communicate with your atmega via the isp then start looking at example code.

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

Here is a nice tutorial about starting with avr's. http://www.sparkfun.com/commerce/present.php?p=BEE-1-PowerSupply

and the second lecture will explain how to connect the avr to an isp programmer : http://www.sparkfun.com/commerce/present.php?p=BEE-2-Code

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

Thank you for the quick response, Just so I’m clear,

if i connect the power VCC(Pin10) & Gnd (Pin31) and

MOSI (Pin 6)
MISO (Pin 7) connect to AVR ISP
SCK (Pin 8)
RESET (Pin 9)

No further connections are need to communicate to Atmega16?

Answer to the first question, hopefully use Winavr.

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

Quote:
if i connect the power VCC(Pin10) & Gnd (Pin31) and
Nope. You need more:

pin 11 and 31: connect to ground
pin 10 and 30: connect to Vcc (5V)

Nard

PS : I notified the moderator of this forum.

A GIF is worth a thousend words   They are called Rosa, Sylvia, Tessa and Tina, You can find them https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

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

Thanks Guys Works a treat, never thought i would be excited to see a flashing LED!

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

Quote:
... never thought i would be excited to see a flashing LED!
Welcome in the club :)

Nard

A GIF is worth a thousend words   They are called Rosa, Sylvia, Tessa and Tina, You can find them https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

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

I thought I would step it up a gear by adding a 16Mhz crystal to my Atmega16.

I followed this example http://www.sparkfun.com/commerce/present.php?p=BEE-3-Oscillators

as soon as I updated the external fuse bit for the
16MHz external osc:

avrdude -p m16 -P com6 -c stk500v2 -U lfuse:w:0xE6:m

now i’m unable to access the atmega, is there any way to reset it to factory defaults or change it back to the internal 1Mhz? my ISP no longer detect the atmega?

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

It appears as you have programmed it to use an external rc oscillator. connect one of those and you should be good. I have never that done with an AVR so consult the datasheet.

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

Are you sure you really2 follow the instruction in the link you've provided above? I've seen the article and if you follow it perfectly then it should be no problem arise.

Quote:
as soon as I updated the external fuse bit for the
16MHz external osc:

Fuses bits are different for each AVR but generally has same function.
Looking at this:

avrdude -p m16 -P com6 -c stk500v2 -U lfuse:w:0xE6:m 

then I assume you're completely spoil up your AVR clock. 0xE6 sets ATMega16 to run using external RC oscillator at 0.9-3MHz.
This is a good link to check your fuse http://palmavr.sourceforge.net/cgi-bin/fc.cgi
It still could be saved by creating a simple RC oscillator. Refer to ATMega16's datasheet page 28. With resistor value around 5K and C 22pF should fix that. :mrgreen:
If you want to use crystal running at 16MHz then it should be 0xFF.

KISS - Keep It Simple Stupid!

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

Thank you for the link http://palmavr.sourceforge.net/cgi-bin/fc.cgi very useful!

and the 5k resister and C 22pF worked a treat!

for any one wanting to interface 16MHz external OSC with a Atmega16 and like me a little confused with the datasheet and fuse bits..

this will setup the required fuse bits.

avrdude -p m16 -P com6 -c stk500v2 -U lfuse:w:0xFF:m 

Rightup.