Hi,
I have bought a power supplu that avr studio is reading as 5.0 volts, an avrisp mkII programmer, and the mega8 robot controller.
Everything is great, connected, example program compiled corectly etc etc, excep when i try to read the signature…
I get the error message popping up “Reverse target connection detected. Reverse ISP connector”.
The 6 pin cable is the right way round (red cable on pin 1) the board is powered and the default program is running on the screen, the programmer has the flashing orange light on…
Any ideas. Google doesnt come up with anythig for this error message.
The ATMega8 version of the Orangutan robot controller actually predates the AVRISP MKII programmer. I had some compatibility issues trying to pair the two, but they’re easily resolved. You might want to read through this thread (especially the pictures).
Yeah read that thread, sounds good. It must be one of the new ones though, i only bought it a couple of days ago. On the programmer, one of the lights is flashing orange. Its supposed to be green???
If your Orangutan is powered on and you plug in the programming header the status led on the AVRISP MKII should turn green. Flashing orange is a general error indicator, which can mean you have the cable plugged in backwards, or that your reset pull-up resistor is too weak (especially if this occurs immediately when you plug it in, before you even try to download a program). It’s basically a general error indicator.
Where did you buy an ATMega8 Orangutan so recently?
Regardless of when you bought it, if it is one of the ATMega8 Orangutans then I bet you do need one, if not both resistor fixes discussed in the other thread. Aside from the number on the chip, the ATMega8 Orangutans can be identified by the silver (not black) LCD case, and the non-keyed programming header. I’m pretty sure (can anyone from Pololu confirm this?) that none of the ATMega8 Orangutan’s had the extra LCD pull-down resistor. It wasn’t necessary for the AVRISP MKI programmers available at the time of the original design, but is necessary (in 2 out of 2 test cases at least) to work with the AVRISP MKII programmer.
Take a look at the back of your Orangutan and compare it to this picture (ignoring the exact model of the ATMega):
Check if your Orangutan is missing the resistor labeled “4.7 K pulldown” in the picture. Also, see if the resistor labeled “10K reset” is numbered 102 (=1Kohm) on your board, instead of 103 (=10Kohm), as in the picture. If either is case, you will need to install (or have installed) resistors in the 4.7Kohm to 10Kohm range before you will be able to use an AVRISP MKII to program it.
Then again, if they’re both there and both right, then I’m stumped!
If this works someone is a genius. God how would answers be solved without the internet. They are both incorrect. Should i change them both?. the lcd pull down resistor isnt there at all, so i can just solder that one across the two points, but the other one is a 102. do i need to remove it or can i solder the new resistor over the top???
Yes, you will need to fix both resistors, and yes, you will need to remove the reset pull-up resistor (the 102). You need to increase the resistance between VCC and the reset line, and unfortunately adding resistors in parallel (i.e. soldering another one on top) always decreases the net resistance, no matter what the values of the two resistors are.
If you want to do this yourself you can do it with common size carbon film resistors, anything between 4.7Kohm and 10Kohm should be fine. Take a look at this artist’s rendition:
When you remove the 102 reset resistor (under the red X), make sure there is no solder left connecting the pads where it was (you might want want to check this with a continuity meter before powering anything up). Any solder left there will short VCC to reset and will almost certainly damage your ATMega8.
Good luck! And let us know how it turns out!
-Adam
P.S. As mentioned in the other thread about this problem, Pololu will make this fix for you if you would rather send your Orangutan in to them.
Green lights all on, microcontroller powered, avrisp all good, signature read correctly, device selected: ATmega8, board isp frequency 250khz written to programmer, Vtarger voltage - 5.v, avrstudio 4.13 sp1 being used.
When i click program in flash the message at the bottom says everything is OK except programming flash… and that generic troubleshoot window pops up with the normal mesage of check frequency and someting about fuses…
Please can you give me one last inch of help???
Thanks
The problem might just be that your ISP frequency is exactly 1/4 of your Orangutan frequency. My suggestion is to lower your ISP frequency so that it’s clearly less than 1/4 of your target device’s clock. If that works, I suggest you unprogram your Orangutan’s divide-by-8 clock fuse so that it runs at 8 MHz instead of 1 MHz. Make sure to take great caution when programming fuses as it’s possible to permanently disable your Orangutan if you set them incorrectly.
Amazing. All works, and i have fiddled with a couple of things, found a flashing led example, changed things to see how it works, thank you for your help.
Do you know a link, or somewhere where i can learn the C for programming this microcontroller. I can program standard software C but never have i done microcontroller, and thats really where i am wanting to take this.
How can i find what is on each port, for instance the LED’s, buttons, the LCD and the sensor and motor inputs so that i can learn all the features of the mega8, and moving on to greater things!.
Oh and last question: in avrstudio on the right is a list of “tools” (i cant think of a better word) that are todo with microcontrollers like. The window has a title I/O view and it has things like PORTB, PORTC, PORTD TIMER_COUNTER_0. are these telling me what the microcontroller has onboard or what, how do i use this window to my advantage.
If you already know C, you’re off to a very good start. The main way I learned about AVR microcontrollers was via their datasheets. It can be a little intimidating at first trying to wade through 300+ pages of technical information, but all the information you want to know is probably in there somewhere.
You can find all of the mega8’s hardware pin assignments by looking at the datasheet. To find out the Orangutan hardware pin assignments you need to look at the Orangutan schematic.
I don’t know of any tutorial websites for programming AVRs, but avrfreaks.net is a community of, well, AVR freaks. You should be able to ask questions there and find some sample source code. You can also take a look at Orangutan-lib, an open-source library for the Orangutan family of robot controllers. Lastly, I’ve written a series of demo projects for the Orangutan LV-168. If you change the code so the pins used match those of the Orangutan instead of the Orangutan LV-168 (you might also have to make a few other changes so that code intended for the mega168 works on the mega8), you should be able to get most of it to work on your Orangutan.
I believe this window comes into play when you are simulating your AVR code, or if you have a device that is capable of in-circuit emulation of your AVR via debugWire. If you have an in-circuit emulator, the feedback you get shows you the actual states of the registers/ports of your AVR as your code runs. If instead you just have a standard programmer, you can have AVR studio run your code in debug mode, which lets you step through it line by line (or set up break-points) and watch the effects on a simulator.
As Ben said, the datasheet is the go-to document for all the information about a given AVR, and they can be a pain, but you learn to find and extract the information you need (it’s really like speaking another language).
AVRFreaks is a good place to go for general info, projects, and support. If you’re looking to really sit down and “learn the C for programming this microcontroller,” I would recommend the book “C Programming for Microcontrollers” by Joe Pardue (not just because it matches the phrasing of your question, I really like it). It’s aimed at people with a working understanding of the C language (with a lot of review), but who are applying it to microcontrollers for the first time. It uses the AVR Butterfly board as the testbed, but everything in it applies to AVRs in general, and it’s a very nicely written and easy read (not very textbook-like at all). It’s also serves as a good primer for how to “winnow the wheat from the chaff in the data book and pull out what you need for your C based control applications”. Wow, I love the way this guy writes, and yes, it is more of a data book than a data sheet.
Anyway, you can download the first two chapters of the book, AKA the “quick start guide” here, which should give you a feel for the book overall, and some more information on your third question. The I/O view window on the right side of AVR Studio is (as Ben says) a built-in simulator that can show you, to some extent, how your code will run on a particular AVR, and how it will respond to various inputs (seriously, you can toggle register and I/O bits just by clicking on them). It’s also really useful as a quick reference for register and control bit names. Check out the section “Simulation with AVRStudio” starting on page 27 of the quick start guide.