avr-studio new to this help need some help

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

Hello all, I'm new to avr-studio and writing to chips all together so please bare with me. My back ground is tech related and I have been a programmer for many years. I also have modest knowledge in electronics. I have searched the forums but cant pinpoint where to start.

My set up.

I built a simple circuit that has an ATMEGA8-16PU with a 12 mhz oscillator and the correct pinning for what is referred to as an 6 pin ISP.

I'm using a usb version of the rs232 cable and was told to use the "stk500 avrisp" connection. This connects to my device fine.

I also know that I need the fuses settings for this project are: high_byte=0xc9 low_byte=0x9f.

I'm using avr-studio win32.

my questions:

One thing thats a bit concerning are the vast options in the connect window. Is there a guide on here that shows what to use for a common atmega8?

also when I try to go to any of the other pages in the settings for the connection window I get the generic warning message " a problem accrued when executing the command" all suggests are in line, not that I can change the freq any how since it always default to 1/4th..

I hope I included enough info here. Thx in advance, sorry if I posted in the wrong area.

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

>>IF<< the programmer you are using is truly 100% compatible with the STK500, then select it as the programmer you want to use from Tools>Program avr>connect and then select ISP. Make sure the target is connected and powered up BEFORE you do anything.

If you have a successful connection go to the Board tab and set the ISP frequency to 250KHz then WRITE it.

Switch to the Advanced tab and try and read the signature bytes, if successful ie signature match, then you are ready to program.

Quote:
fuses settings for this project are: high_byte=0xc9 low_byte=0x9f.
I have no idea what that does, Studio spells out exatcly the options in words.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

thx js ,

Quote:
>>IF<< the programmer you are using is truly 100% compatible with the STK500, then select it as the programmer you want to use from Tools>Program avr>connect and then select ISP. Make sure the target is connected and powered up BEFORE you do anything.
- I'm told this is the case. I connect ok and the board is powered up.

Quote:
If you have a successful connection go to the Board tab and set the ISP frequency to 250KHz then WRITE it.
- I dont have the option for 250 but 230khz I'm guessing is ok.

Quote:
Switch to the Advanced tab and try and read the signature bytes, if successful ie signature match, then you are ready to program.
- when I do this I get isp mode error "a problem occurred when executing the command. see the command output for more info." - I have no idea where that out put it.

and below I get.

"
Entering programming mode.. FAILED!
Leaving programming mode.. OK!
"
the out put in the board tab is
"
Getting revisions.. HW: 0x0f, SW Major: 0x02, SW Minor: 0x04 .. OK
Getting oscillator parameters.. P=0x01, N=0x00, SD=0x01 .. OK
"

This oscillator freq is not specified. and it only goes up to 8.

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

edit:

Do you have the correct chip selected in the program tab?

Able to read the voltage in the board tab?

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

Quote:
...and the correct pinning for what is referred to as an 6 pin ISP.
Which is?? according to what you believe. Do you have a schematic?

230KHz is ok. What happens when you switch tabs and back to the board tab, does the isp frequecny stick?

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

Quote:
Do you have the correct chip selected in the program tab?
- Well I dont have atmega8-16p as an option so I'm assuming its just atmega8

Quote:
Able to read the voltage in the board tab?
- voltages are grayed out.

Quote:
230KHz is ok. What happens when you switch tabs and back to the board tab, does the isp frequecny stick?
- yes

Quote:

Which is?? according to what you believe. Do you have a schematic?
- yes. http://www.raphnet.net/electronique/atari_usb/schematic_db9.png
this project is all explained on his site but he does not get in to ARV-studio. And no he is of no help via email. All he works with are linux based burners.
Quote:

Examples using UISP:
First of all, please note that in the following examples, /dev/avr is a symbolic link to the serial port device where the programmer is connected. (eg: /dev/ttyS0). Also, dont forget to change the -dpart argument if you are not using an AVR Atmega8.

Programming the fuses bytes on an atmega8:

# uisp -dprog=stk500 -dpart=atmega8 -dserial=/dev/avr --wr_fuse_h=0xc9 --wr_fuses_l=0x9f

Programming an hex file into an atmega8:

# uisp -dprog=stk500 -dpart=atmega8 -dserial=/dev/avr --erase --upload --verify if=n64_to_wii.hex

Note: --erase is for erasing the flash memory BEFORE programming the new file. --verify provides a way to read back the flash content and compare it with the original file to making sure no errors occured.
Examples using AVRDUDE and an USB ISP mkII:

Programming the fuses bytes on an Atmega8:

# avrdude -p m8 -P usb -c avrispmkII -Uhfuse:w:0xc9:m -Ulfuse:w:0x9f:m

Note: The -p option is used to specify which type of AVR you are programming. To display a list of supported device, try 'avrdude -p list -P usb -c avrispmkII' (since 'list' is not a valid type, avrdude lists supported types).

Programming an hex file into an atmega8:

# avrdude -p m8 -P usb -c avrispmkII -Uflash:w:n64_to_wii.hex -B 1.0

Note: The -B argument controls the ISP bit clock period (in microseconds). This frequency must not be higher than 1/4 of the MCU clock.

Basically I'm looking to do that in windows. I would use linux but I have all of my sources on my windows box, and prefer it for coding.

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

The diagram is correct, just double check you wiring.
Unless the signature bytes can be read nothing will work. To sum up:
Go to tools>Program avr> Connect and select the STK500 (you must be up to this already if you can write the ISP frequency)

Make sure you select ISP mode from the dropdown menu and of course the Mega8. Try to read the ISP frequency, it should stay at what you set it previously. Is there 5V on pin 2 of the ISP connector?

ps I have just realised how different the new program windows is with SP2 :? Which version of Studio are you using?

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

ok ,ill double check the wring. and try again.

Yes there is 5v and a good ground, on the right pins.

I believe I have sp2.

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

It seems that in one instance it wants you to use STK500 as the connection

Quote:

Programming an hex file into an atmega8:

# uisp -dprog=stk500 -dpart=atmega8 -dserial=/dev/avr --erase --upload --verify if=n64_to_wii.hex

Then further down for avrdude it says:

Quote:

Programming an hex file into an atmega8:

# avrdude -p m8 -P usb -c avrispmkII -Uflash:w:n64_to_wii.hex -B 1.0

Have you tried to establish a connection in AvrStudio by selecting MKII as the type?

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

digitool, no I have not. I only used the stk500. But my kit that came with my avr usb adapter said to. Since I can only make a connection when the avr usb adapter us connected I assumed it was right. I may have a go at that too.

update::
Ok no it wont connect to the mkII only the stk500

js, I can write the isp freq as you instructions above and when I read them I get this out put below..

+00000000:   C065        RJMP    PC+0x0066        Relative jump

the stk500 box is grayed out. the freq I put it does save if I close and reopen the connection.

does all this graying out mean anything? I have yet to check my connections again.

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

Connections are ok, any though on the above? Also what would one expect when pluging in the usb/isp in the a usb port? Since there is no firmware written would it show unknown device or a device has malfunctioned. Currently I get the "malfunctioned" error and the usb not recognized window pops up.

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

Quote:
I can write the isp freq as you instructions above and when I read them I get this out put below..
??? What are you talking about?? You are showing a bit of listing, what has it to do with the programmer?

It may just simply be that you have wasted your money on a phony programmer and it is not really compatible wit the real STK500 :( may have to go back to where you got it from and complain to them.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

I may have pasted thw wrong text in there I meant

Getting oscillator parameters.. P=0x01, N=0x00, SD=0x01 .. OK

at any rate I just made another circuit on a bread board and all checks out ok, still no luck. Ill see if I can get help from the vendor again. Thx for your help.