Programming 9x with USBASP fails, works with Arduino

Post Reply
Evils
Posts: 17
Joined: Sat Aug 22, 2015 7:55 pm
Country: -

Programming 9x with USBASP fails, works with Arduino

Post 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!!
Attachments
IMG_1183.JPG
IMG_1182.JPG

User avatar
Bill
Posts: 195
Joined: Thu Jul 04, 2013 5:54 pm
Country: -

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

Post 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.
“A good politician is quite as unthinkable as an honest banker”
They used to say "if you don’t want to work at McDonald’s, go to college." Now they say "if you want to work at McDonald’s, go to college.”
Evils
Posts: 17
Joined: Sat Aug 22, 2015 7:55 pm
Country: -

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

Post 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 ...
User avatar
Bill
Posts: 195
Joined: Thu Jul 04, 2013 5:54 pm
Country: -

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

Post 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
“A good politician is quite as unthinkable as an honest banker”
They used to say "if you don’t want to work at McDonald’s, go to college." Now they say "if you want to work at McDonald’s, go to college.”
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

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

Post 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.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

Evils
Posts: 17
Joined: Sat Aug 22, 2015 7:55 pm
Country: -

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

Post 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?
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

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

Post 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.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
Evils
Posts: 17
Joined: Sat Aug 22, 2015 7:55 pm
Country: -

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

Post 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?
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

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

Post 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.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
Evils
Posts: 17
Joined: Sat Aug 22, 2015 7:55 pm
Country: -

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

Post 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?!
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

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

Post by MikeB »

Yes.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
Evils
Posts: 17
Joined: Sat Aug 22, 2015 7:55 pm
Country: -

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

Post by Evils »

Just did the mod, still same error message :(
Evils
Posts: 17
Joined: Sat Aug 22, 2015 7:55 pm
Country: -

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

Post 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!
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

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

Post by jhsa »

But at least you found the problem and fixed it. Congratulations ; )

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
Evils
Posts: 17
Joined: Sat Aug 22, 2015 7:55 pm
Country: -

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

Post by Evils »

One thing though, when I rewrite the flash, I always get a verification error. Any idea why that happens?
User avatar
rperkins
Posts: 1422
Joined: Sun Jan 08, 2012 12:51 pm
Country: -

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

Post 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.

Post Reply

Return to “PROGRAMMERS”