Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: ankshah13 on July 12, 2013, 10:41:32 AM

Title: HELP for usbasp programming for 50$ robot
Post by: ankshah13 on July 12, 2013, 10:41:32 AM
Please help me on this one.. I have bought a usbasp programmer to program my 50 buck robot. The programmer works and I have already installed the driver software. The connections on my microcontroller are fine because the voltages are ok. The multimeter shows exacly 4.96 volts everytime I test the mcu.
I am programming the atmega8 via avrdude.. Avrdude works fine on my laptop. Now, when i write the commads for programming, an error appears. It is exactly as shown below:

" avrdude: warning cannot set sck period. please check for usbasp firmware update
  avrdude error: program enable target doesn't answer.1
 avrdude intialization failed
Please double check your connections and try again or use F- to override this check."


Please tell me how to proceed further.. How do i install the firmware and make the usbasp burn the hex file into the atmega8..


Title: Re: HELP for usbasp programming for 50$ robot
Post by: jwatte on July 15, 2013, 10:03:22 AM
Assuming the ASP uses virtual serial ports, one possibility would be that the avrdude program is talking to the wrong thing -- not actually talking to the usbasp. Which port are you telling avrdude to use? Is that the port that the ASP is on?
Title: Re: HELP for usbasp programming for 50$ robot
Post by: ankshah13 on July 15, 2013, 11:14:58 PM
Thanks for the reply.. But now I have successfully programmed the armega8 using a software called extreme burner.. But I still have a small photoresistor problem. I had programmed the chip without connecting the sensors and servos on the 50 $ robot chip. Now, when I connect the photoresistors to the chip, the resistance between the ground and AVCC drops to 2-4 kilo ohms. Without the sensors, the resistance between ground and AVCC is 10-12 kilo ohms. Please tell me how to solve this one...  Btw, when I switch the robot on, only one of the servos work and it's kinda slow.   Please tell me how to solve this problem..
Title: Re: HELP for usbasp programming for 50$ robot
Post by: johnwarfin on July 16, 2013, 10:52:31 AM
Assuming the ASP uses virtual serial ports,

usbasp has no ports. it is not a serial device. usblib is used which talks directy over usb.

i dont think measuring resistance of input ports to vcc is useful. input voltage relative to ground will tell if sensor is working. if op has trouble with sensor software what needs to be done is first run the led blink demo. then write a small 2 or 3 line program that transfers state of an input to the led.
Title: Re: HELP for usbasp programming for 50$ robot
Post by: ankshah13 on July 16, 2013, 12:16:58 PM
I have programmed the atmega8 properly.. the robot kinda works except one servo is slower than the other so it keeps going in circles. when i switch the wires of the servo headers, the other motor is slow.. This means that there is no problem with the motors. the bottom connections on the pcb seem to be messy. Besides the sensors and this problem, my robot seems to work... When i put my hand in front of the sensor, the robot tries to turn away but dude to one motor being slower, it cant..
Title: Re: HELP for usbasp programming for 50$ robot
Post by: johnwarfin on July 16, 2013, 03:37:16 PM
like you say slow operation staying with the pin when switching servos shows that they are ok. and there is some reaction to the sensor so at least one is working. its not clear if the sensor input is on/off or continuous analog range. at this point i would write a small test program to display sensor readings on a monitor or lcd to eliminate that.
Title: Re: HELP for usbasp programming for 50$ robot
Post by: ankshah13 on July 16, 2013, 09:46:17 PM
Oh, ok I understand what you meant to say. Thanks..
But i dont really know how to write a program.. Until know I was just getting readymade source codes and converting them into hex.. What should the test program contain?
thanks anyways for suggesting the usbasp programmer. That helped me a LOT..
Title: Re: HELP for usbasp programming for 50$ robot
Post by: johnwarfin on July 17, 2013, 08:06:06 AM
you might get lucky and debug w/o writing or modifying any programs. so one step would be to look at the sensor pins with a voltmeter and see if they both respond correctly to input. if you describe what happens it might give a hint to your problem.

learning to program is a big benefit in this hobby. winavr is a very popular version of the c  language and atmel studio makes it easy. the $50 tutorial is a great way to learn these. however arduino, which uses winavr internally, is considered even easier for those starting out. i highly recommend installing the arduino system too. then taking a look at the led blink demo. learn by example and making small changes.