Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: Zevoo on November 17, 2014, 01:24:13 PM

Title: 50 dollar robot question
Post by: Zevoo on November 17, 2014, 01:24:13 PM
Hello guys. So I have soldered all my components onto my pcb and followed the tutorial. When you plug the power into the pcb does the LED have to flash (I plugged the power in and it didnt flash) or does it flash after you program the micro-controller?  I have tried to program my robot using latest AVR  studio and I couldnt because it couldnt get the device signature... and there was electricity flowing because the programmer picked it up.
Title: Re: 50 dollar robot question
Post by: jkerns on November 17, 2014, 08:11:27 PM
Double check your wiring - all connections made and no solder bridges between adjacent pins. It wouldn't be the first time. I assume you have some kind of VOM.

What device are you using to program with? What is the clock speed for the programmer (needs to be 175 Khz or less)?

Does AVR Studio recognize your programmer?
Title: Re: 50 dollar robot question
Post by: Zevoo on November 18, 2014, 10:30:56 AM
Double check your wiring - all connections made and no solder bridges between adjacent pins. It wouldn't be the first time. I assume you have some kind of VOM.

What device are you using to program with? What is the clock speed for the programmer (needs to be 175 Khz or less)?

Does AVR Studio recognize your programmer?

I'm using the VAR ISP mkII programmer and yes AVR studio recognises it. I have chcecked and everything is soldered where it needs to be soldered; no pins have accidentally soldered together.
About the programmer speed, do I need to set it below 200 Khz for it to read the microcontroller etc? What is a VOM?
Title: Re: 50 dollar robot question
Post by: jkerns on November 18, 2014, 01:33:58 PM
I would suggest that we keep this all in one thread to minimize confusion.

The maximum frequency for the programmer needs to be less than 1/4 of the clock frequency of the chip. Most AVR chips that I have used come with a default clock speed of 1MHz so you need to be somewhat below 250KHz (allow a margin for error). There are two places that you need to set this up. One is to click on the icon with the lightning bolt (see attachment capture1) and the other is where it says "ATMega... right below. See capture2 and capture3 for how those should look. Also, you need to click save after setting the clock speed for this project for it to take effect.

EDIT: I just checked, the error message you show in the other thread is the error I get when the ISP clock speed is too high - so that is likely to be one of your problems.

A VOM is a Vold - Ohm Meter or multimeter. You really want to get one to check your pinout. Check that you have 5 Volts where you need 5 volts, check that you have ground where you need ground (including the programmer pins). Check that the pin at the programmer connector actually connects to the correct pin on the chip socket (cold solder joints may look like they are connected, but...)

Don't hook up the connector both ways. Figure out which is the correct way and connect. The red stripe goes to the end of the headers with the connection to the MISO pin.

If you get the same results both ways, I suspect that you have a problem with the wiring.

When you hook up correctly and power up, there should be a red LED that turns green on the programmer. If you reverse the connection the LED should flash red. If these are not happening, correct your wiring errors.
Title: Re: 50 dollar robot question
Post by: Zevoo on November 18, 2014, 04:33:36 PM
I have corrected some of the pins which seemed not right to me (2 in total) and indeed when I plugged in the programmer it flashed red and when I plugged it in the other it flashed green. I set the ISP to 1/4 that of the chip's frequency. (it was the default anyway). I plugged everything in and went onto device programming, checked the voltage and it output 5.4 V clicked read device and it still output the same error. After that when I clicked to read the voltage it output a voltage below the required one (btw LED still didnt flash on the pcb). After several tries the console in the background started outputting the message that the target was not found.... ; /
what's up with it now? :O
Title: Re: 50 dollar robot question
Post by: jkerns on November 19, 2014, 08:11:23 AM
Set the ISP clock to LESS than 1/4 of the microprocessor clock frequency. Equal to 1/4 the frequency only works sometimes.

Did you check for continuity between all 6 pins on the programming header and your chip using a meter?
Title: Re: 50 dollar robot question
Post by: Zevoo on November 20, 2014, 03:10:01 PM
Okay I made the schematic again (3rd attempt) there is no room for wiring errors!  I have checked and no problem everything works just fine. When I go to program the robot it comes up with this error (check message and console).
I have put the programmer on 1/4 the micro's frequency. What am I doing wrong now? I don't believe it is wiring again....
Title: Re: 50 dollar robot question
Post by: jkerns on November 20, 2014, 03:19:32 PM
1/4 clock frequency (250 kHz) is too fast.
It needs to be LESS than 1/4 and you have to consider that the clocks are not going to run EXACTLY at the rated speed.

Set your ISP clock to 125 KHz.
Title: Re: 50 dollar robot question
Post by: Zevoo on November 20, 2014, 04:20:50 PM
Set it to 125 and I still get the same error.
Title: Re: 50 dollar robot question
Post by: jkerns on November 20, 2014, 06:07:04 PM
Hmmm. I would have bet money that would have worked.

You've covered the obvious things.

Odd things that I have seen include a chip not 100% pressed into the chip socket (did you use a socket or solder directly to the ATMEGA8?) or a chip that has been damaged.
Title: Re: 50 dollar robot question
Post by: Zevoo on November 21, 2014, 09:01:36 AM
Yes I use a socket. Ill press it to the socket again to just check that this might be the case. Thats the thing. As I said thats my third attempt so maybe I might have done something to the chip so if it doesn't work ill order another chip to see if that is the case. I don't know if it will be any useful info but I'm using the picture schematic (pdf)
Title: Re: 50 dollar robot question
Post by: Zevoo on November 21, 2014, 09:54:02 AM
Okay I got the chip working! but now when i build the solution it comes up with this!
Title: Re: 50 dollar robot question
Post by: jkerns on November 23, 2014, 07:09:53 AM
1) What did you do to get it working? What you learned could help someone else with the same problem.

2) It appears that there have been some updates http://www.nongnu.org/avr-libc/user-manual/group__avr__interrupts.html (http://www.nongnu.org/avr-libc/user-manual/group__avr__interrupts.html)

try ADC_vect  in place of SIG_ADC
Title: Re: 50 dollar robot question
Post by: Zevoo on November 23, 2014, 09:07:02 AM
the micrcontroller was not pressed to the socket enough so it didnt connect to some of the pins...  I was scared that I'd wreck the microcontroller if I pressed it too hard.

Okay I shall try it.
Title: Re: 50 dollar robot question
Post by: Zevoo on November 26, 2014, 12:30:23 PM
Programmed it.  Diode still is not flashing ; /