Software > Software

$50 Robot Problem... programmed but inactive?

(1/4) > >>

mr_kobayashi:
Alright, so I managed to connect the microcontroller to the PC using AVR ISP kit and AVR Studio 4, I've attached a screenshot. I click on 'Program' under Flash and it writes and verifies.... then I plug in my servos, turn on the battery pack (I'm using 4xAAs for the servos and 9V battery for the circuit and sensors).... but then nothing happens.... the robot doesn't "go". I used a multimeter to verify voltages, and the servos/sensors are definitely getting power.

I notice that when I click on the "Connect to AVR programmer" button in AVR Studio 4, connect always fails despite the COM port selection being correct... which makes me suspect that perhaps the program isn't properly written?



Additionally, I tried to use PonyProg2000 and that doesn't detect the microcontroller either, although I suspect that might have something to do with the fact that PonyProg2000 isn't compatible with AVR ISP kit.

Can anyone help me out? (maybe Admin?)  ;D ;D

JonHylands:
The very first thing you need to do is verify that the AVR is working. The easiest way to do that is to hook an LED to one of the I/O pins of the AVR, and make it flash. That's basically the "Hello World" of the embedded world.

I suspect it would be a good idea (hint Admin) to add a flasher program to the tutorial, so people can verify that their build/program/power cycle is working with the least amount of extra complications thrown in there.

Once you get the flasher program working, then you can try and program and run with the full blown robot code, at least knowing that one variable is out of the way.

I've been doing embedded microcontrollers for almost 10 years, and I still invariably screw up something every time I build a new board, and end up using an LED flasher as the first application to help debug.

- Jon

Admin:
Hmmm this is a tought one . . .

So when you click on 'Connect to AVR programmer' (Display the 'Connect' Dialog), make sure you select:
Platform: STK500 or AVRISP
Port: Auto

When you click Connect it should then figure it out . . .

But Im assuming you tried that and it didnt work.

Are you using the com port with another program simultaneously? For example, if hypterminal or ponyprog is already using that port, then AVR studio will not be able to use it. I make this dumb mistake all the time . . .

So when you program it, it programs and verifies correctly? The attached image is what it should look like if it was successful.

To test with a blinky LED, put this in your while loop and delete the other stuff:

--- Code: ---while(1)
{
//blink LED every second
LED_on();
delay_cycles(23200);
LED_off();
delay_cycles(23200);
}

--- End code ---

JonHylands:
I think I see what the problem might be - he's using the wrong thing to program it.

When you bring up AVR Studio, you need to go to the Tools menu, and select "Program AVR" -> "Connect..." or "Auto Connect" (not sure what Admin uses, I use the first one).

You need to have the window up that Admin shows in his post. Then you can program the chip...

- Jon

mr_kobayashi:
OK I understand that you need to program it using the other screen by clicking on "Connect to Selected AVR Programmer" the thing is that it always says "Connect Failed", I attached a screenshot. I checked the microcontroller is getting 5V at Pin 7 and Pin 20/21 and that's not the problem.

The weird thing is I *think* the connection to the PC is working because that other dialog box comes up (the first screenshot I posted), but it can't connect to the AVR Programmer using that other option....

Any other ideas? Thanks in advance.

Navigation

[0] Message Index

[#] Next page

Go to full version