| View previous topic :: View next topic |
| Author |
Message |
florianfreitag
Joined: 07 Apr 2010 Posts: 4 Location: Germany, Karlsruhe
|
Posted: Wed Apr 07, 2010 4:07 pm Post subject: How to program OpenServo with AVR Studio and AVRISP MKII |
|
|
Hi at all,
I am a german student and I try to program the OpenServo Board with AVR Studio and AVRISP MKII via ISP. This should work because some guys before me done that. But they never wrote a documentation. . So I have the hardware and all cables and the pins are wired correctly. But when I want to program with AVR Studio I always become an error message:
| Quote: | ISP Mode Error
A problem occurred when executing the command. Make sure that you are using the correct programming method. Current mode is ISP. See the command output for more info. ... |
The LED of the avrisp mkII is green so it seems all perfect.
Does anybody know why it doesn't work? Or does anybody also uses this configuration?
Sorry for my bad english!!!
Greetings
Florian |
|
| Back to top |
|
 |
Kampower
Joined: 31 May 2010 Posts: 7 Location: Hamburg
|
Posted: Tue Jun 15, 2010 4:07 pm Post subject: reply |
|
|
Sorry I did like to help but also a novice. But I will like to know how you finally get this to work.
Hoping you get helpful response for this post. |
|
| Back to top |
|
 |
florianfreitag
Joined: 07 Apr 2010 Posts: 4 Location: Germany, Karlsruhe
|
Posted: Tue Jun 15, 2010 9:39 pm Post subject: |
|
|
The solution was not to use the AVRISP MKII. Instead of that I'm now using a JTAG ICE II via SPI. But that only works if you disable your Debugwire via cmd:
| Code: | | jtagiceii.exe -c USB -d atmega168 -W |
But may be there is an solution with the avr mkII. |
|
| Back to top |
|
 |
kbb
Joined: 01 Jun 2007 Posts: 180
|
Posted: Fri Jul 30, 2010 11:46 pm Post subject: |
|
|
| florianfreitag wrote: | The solution was not to use the AVRISP MKII. Instead of that I'm now using a JTAG ICE II via SPI. But that only works if you disable your Debugwire via cmd:
| Code: | | jtagiceii.exe -c USB -d atmega168 -W |
But may be there is an solution with the avr mkII. |
As a test I just successfully programmed an OpenServo V3 via the ISP interface on an AVRISP mkII using AVR Studio 4.18 SP2 on Windows, so it can work. The wiring is pretty obvious. Assuming that nothing is broken, the only other things I can think of that might produce a message like that with out providing any other clues are:
Firmware: I do not know if it matters, but AVR Studio 4.18 SP2 has the latest firmware for the AVRISP mkII.
VCC: needs to be supplied with the same voltage that the target is running at. I hook this up to a 5V supply on my “servo patch panel” as I know mine have 5V regulators.
DWEN fuse: debugWIRE has to be disabled (the factory default condition); otherwise the ATmega168 will not respond to the ISP control signals. |
|
| Back to top |
|
 |
SalDawod
Joined: 03 Jul 2011 Posts: 1
|
Posted: Sun Jul 03, 2011 5:58 pm Post subject: |
|
|
Programming the AVR Chip with our Compiled Code
The next step in the development process is that of getting the compiled .hex file onto the actual AVR chip so it can run in the real world, not just in the simulator. This is done with the AVRISP mkII through AVR Studio.
In the real world, the two available Port B pins have LEDs on them, so once they are set to HIGH (logical 1s) the LEDs will light up.
Make sure the programmer hardware is connected and powered:
1. Ensure your AVRISP mkII is plugged in via USB to your workstation. You should have a green light on the AVRISP nearest the USB connector.
2. Connect the ISP cable from the programmer to our 6-pin header that we breadboarded up as per earlier directions. The light by the ISP cable will be RED (indicating no power on target circuit).
3. Turn on power to your breadboard, the AVRISP mkII's light beside the ISP cable should turn GREEN. (This is because the chip must have power before it can be programmed. The AVRISP mkII itself is powered from USB but it doesn't power the your circuit.)
Note: If this doesn't work for you, consult the documentation for the AVRISP to troubleshoot the connection. (The colors of the LEDs on the programmer should tell you what is wrong.)
Configure AVR Studio to use the programmer hardware:
AVR Studio integrates with the AVRISP mkII programmer, so there is no need to run a separate programming program to burn our .hex file into the chip. So now we select the AVRISP mkII as the programmer and inform it of where our .hex file is in the context of this project.
1. Click the [CON] button on the menu bar (it looks like a little chip with 'CON' in it) to connect to the programmer. A selection dialog will appear. Select "AVRISP mkII" as the Platform, and "USB" as the choice for the Port (it should be the only option for the mkII.) This allows us to set up the programmer. Once we do this once, we can skip the setup step by clicking the [AVR] button next to [CON] instead.
2. Click "CONNECT..." You will see a window with things like LockBits, Fuses, etc. You will someday want to mess with these settings, but for now just ignore them and go to the PROGRAM tab. All we're going to do here is tell it where to find our .hex file.
Fill out the "Input HEX File" by clicking the browse button and selecting the MyFirstProject.hex file - it should be in the project folder.
3. Change the ISP Frequency. By default, the ATTINY45 is set use to internal oscillator for its clock. This is what we want, but since the default ISP speed generates an error as a result, go to "MAIN" tab and change the speed to 6.48kHz, then click WRITE and exit. (The error message you'll get if the ISP frequency is wrong is pretty clear.)
4. Program the part!
Now you can go back to the PROGRAM tab and click PROGRAM.
The light nearest the ISP cable on the AVRISP mkII should go orange while programming is in progress.
Look at the output window near the bottom - the programming should be successful.
5. The program auto-runs once the programming is done.Look over at the ATTINY45 and you will see the two LEDs are lit!
If all you needed your microcontroller to do was make those two pins go HIGH after a RESET, you could take that ATTINY45 off the breadboard and put it into your project right now.
But let's change the program a little to demonstrate a delay. Instead of the LEDs turning on immediately after a RESET (i.e. after the part is programmed) we will have it wait a short time first - giving us time to look over and see the LEDs turn on. _________________ 247 Rx |
|
| Back to top |
|
 |
jorjastandish
Joined: 22 Jul 2011 Posts: 1
|
|
| Back to top |
|
 |
|