Page 1 of 1

Programming 9x with USBASP fails, works with Arduino

Posted: Sat Aug 22, 2015 8:12 pm
by Evils
Hi everyone,

I'm just registered here after I have been reading in these forums for a long long time.

I'm not too much of an expert in this field, but I'm a software engineer outside of this hobby so I have some basic knowledge.

Currently I have a problem programming/reading my Turnigy 9X which is why I would like to ask for some help.

My setup is as follows:
I have a Turnigy 9x that currently runs ER9x
A USBASP programmer with the lastest firmware update (as well as a Arduino Uno, Mega2560, Bus Pirate)
I'm working on a MacBook ;)

Now the thing is, I've been using my Arduino in the past to read and write the flash and eeprom from my 9x. That always went flawless after pressing the reset button on the Arduino at the right moment ;) This was a great solution for a while, but also pretty inconvenient to always flash the Arduino first and then to wire everything so I can read my 9x.

For that reason I bought a USBASP from banggood a few days back. Now I wired everything up and tried to read my 9x again, unfortunately I always get the following error message:

Code: Select all

avrdude: error: programm enable: target doesn't answer. 1 
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.
Trying to force it, gives me:

Code: Select all

avrdude: error: programm enable: target doesn't answer. 1 
avrdude: initialization failed, rc=-1
avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0x000000 (retrying)
avrdude: Device signature = 0x000000 (retrying)
avrdude: Device signature = 0x000000
avrdude: Yikes!  Invalid device signature.
avrdude: Expected signature for ATmega64 is 1E 96 02
I know I got a 9x v2 with the ATmega64A.

I tried different -B options for avrdude as well as different baud rates, but not seemed to help.
It still works with my Arduino so it's not the cableing.

I attached two pics from my USBASP to see if you guys think it's one of the resistors?!

Any help is highly appreciated!!

Re: Programming 9x with USBASP fails, works with Arduino

Posted: Sun Aug 23, 2015 8:34 am
by Bill
Depending on your operating system you will need to load drivers an example of how to do this:

http://www.protostack.com/blog/2011/05/ ... vista-x64/
For other operating systems you may need other drivers.

Re: Programming 9x with USBASP fails, works with Arduino

Posted: Sun Aug 23, 2015 2:14 pm
by Evils
Bill wrote:Depending on your operating system you will need to load drivers an example of how to do this:

http://www.protostack.com/blog/2011/05/ ... vista-x64/
For other operating systems you may need other drivers.
Like I said, I'm working on a MacBook / OS X machine, there are no drivers installed. I also may not mentioned that I've successfully used the USBASP to burn the bootloader onto a arduino, so there's that ...

Re: Programming 9x with USBASP fails, works with Arduino

Posted: Sun Aug 23, 2015 2:40 pm
by Bill
oops! :oops:
Didn't read the question properly have just got a USBasp and used it for programming an autopilot and an on screen display. I had to load the drivers for windows 7 plus another library to make it work, got carried away my apologies. :roll:
This might be more helpful:
http://stackoverflow.com/questions/2559 ... gram-to-it

Re: Programming 9x with USBASP fails, works with Arduino

Posted: Sun Aug 23, 2015 7:40 pm
by MikeB
It looks to me that RP1 is 100 ohms. These are probably resistors in line with the signals to the M64. These will probably cause the failure. Try using -B 10000 to slow right down, and also try with both THR and AIL switches either both towards you or both away from you as these are on two of the programming signals and can cause a failure when you have resistors on the programmer.

Check you don't get "unable to set SCK" when you use the -B option, and NEVER use the -F option.

You may need to short those resistors out.

Mike.

Re: Programming 9x with USBASP fails, works with Arduino

Posted: Mon Aug 24, 2015 5:17 am
by Evils
MikeB wrote:It looks to me that RP1 is 100 ohms. These are probably resistors in line with the signals to the M64. These will probably cause the failure. Try using -B 10000 to slow right down, and also try with both THR and AIL switches either both towards you or both away from you as these are on two of the programming signals and can cause a failure when you have resistors on the programmer.

Check you don't get "unable to set SCK" when you use the -B option, and NEVER use the -F option.

You may need to short those resistors out.

Mike.
Unfortunately no luck with either the -B 10000 option (btw. avrdude says that's 0 Hz) or with the shoulder switches.

What's next? Which resistor should I kill?

Re: Programming 9x with USBASP fails, works with Arduino

Posted: Mon Aug 24, 2015 8:17 am
by MikeB
If you have a test meter, check for a connection between any of the pins of RP1 and the connector signals MOSI, SCK, RST and MISO.
MOSI, SCK and RST need direct connections to the processor on the USBASP.

Mike.

Re: Programming 9x with USBASP fails, works with Arduino

Posted: Mon Aug 24, 2015 5:59 pm
by Evils
MikeB wrote:If you have a test meter, check for a connection between any of the pins of RP1 and the connector signals MOSI, SCK, RST and MISO.
MOSI, SCK and RST need direct connections to the processor on the USBASP.

Mike.
I checked it, MOSI, SCK, RST and MISO have the 100 Ohm resistor in from.

You're saying that only MOSI, SCK and RST need direct connections, right? So should I keep the resistor in place and just bridge MOSI, SCK and RST but not MISO?

Re: Programming 9x with USBASP fails, works with Arduino

Posted: Mon Aug 24, 2015 6:35 pm
by MikeB
Yes, MISO is a signal from the M64 back to the USBASP. It is OK if you do bridge it you just don't need to.

Mike.

Re: Programming 9x with USBASP fails, works with Arduino

Posted: Mon Aug 24, 2015 6:49 pm
by Evils
MikeB wrote:Yes, MISO is a signal from the M64 back to the USBASP. It is OK if you do bridge it you just don't need to.

Mike.
Sorry if I don't fully get it, but what you're saying is:
I could also rip out RP1 and bridge it completely and it'll be fine?!

Re: Programming 9x with USBASP fails, works with Arduino

Posted: Mon Aug 24, 2015 10:38 pm
by MikeB
Yes.

Mike.

Re: Programming 9x with USBASP fails, works with Arduino

Posted: Mon Aug 24, 2015 11:59 pm
by Evils
Just did the mod, still same error message :(

Re: Programming 9x with USBASP fails, works with Arduino

Posted: Tue Aug 25, 2015 3:16 am
by Evils
Really, this is ride through hell ...

After spending the last 6 hours with all kinds of 9x related stuff I almost lost my mind.
Turns out, I never had a problem with driver, pins, resistors or anything like that. Banggood simply did send me a faulty cable ...

Thanks for all your help!

Re: Programming 9x with USBASP fails, works with Arduino

Posted: Tue Aug 25, 2015 7:10 am
by jhsa
But at least you found the problem and fixed it. Congratulations ; )

João

Re: Programming 9x with USBASP fails, works with Arduino

Posted: Tue Aug 25, 2015 5:50 pm
by Evils
One thing though, when I rewrite the flash, I always get a verification error. Any idea why that happens?

Re: Programming 9x with USBASP fails, works with Arduino

Posted: Thu Nov 26, 2015 1:11 pm
by rperkins
Evils wrote:[
I checked it, MOSI, SCK, RST and MISO have the 100 Ohm resistor in from.
Just for your reference and for the next guy reading this thread. a RP1 with a value of 101 (100 ohms) is fine. It is only when RP1 has a higher value like 221(220 ohms ) or 471 ( 470 ohms ) that problems programming the 9x/9xr occur.

I have not seen any newly sold usbasp's have this problem in nearly 2 years. I guess it could happen, but I havent seen it.

On the other hand completely removing the RP1 and shorting (bridging) it out does not hurt anything. That resistor pack was a safety feature to limit the current but caused more problems than it solved with the 9x/9xr.