[PROBLEM] Flashing Turnigy 9x strange behaviour

openTx has introduced a range of new features, ideas and bling. It is fast becoming the firmware of choice for many users. openTx will run on ALL current hardware platforms, including the gruvin9x and sky9x boards. Work has already started to support the new FrSky X9D radio!
Post Reply
Hertz
Posts: 72
Joined: Wed Sep 30, 2015 2:14 pm
Country: -

[PROBLEM] Flashing Turnigy 9x strange behaviour

Post by Hertz »

Hello everyone!

I have a Turnigy 9x TX and yesterday I've decided to do some modding: add a backlight, perform antenna mod so that turnigy module becomes removable (soldered coax cable on my first try ever! :-), solder some wires for firmware programming support.
I didn't have any header wire nor header connectors at hand, so I've decided to salvage some rigid copper wire from a UTP-5e and use it both as a wire and connector due to it's rigidity.
Here's what the result looked like (the strange glue-like stains on the bottom traces running to ATMEGA64A were here at the moment of purchase):
Image

I have stripped the wires a bit (like 5 mm) and inserted them into USBasp 6-pin plug, adding a bit of hot glue to form a "connector" and hold the wires in place.
Then I've navigated to open-tx.org and installed version 2.1.3 on my macbook, tried to backup the stock firmware and flash the opentx-9x-en.hex downloaded by the companion.
Flashing has failed at the verification step with first mismatch at 0x0100 (0xff in hardware against some other value in the firmware, indicating that this address hasn't been touched by the programmer; a common error according to google, allegedly related to a bug in avrdude 6.0, but I've experience it in version 5.11!). I was slightly disappointed and tried to turn my TX on, LCD displayed something blurry in the top half barely recognizable as EEPROM. No luck, the radio wasn't working. The obvious step was to flash stock firmware from the backup, that's when I had discovered that backup file is empty, 0 bytes.
By some experiments I've discovered that during backup/read firmware from radio the companion app invokes avrdude with ':a' as firmware format (a for auto), which can only be used on input files where the format can be deduced, and during reading firmware there is no file to deduce anything, hence ':i' (Intel) format specification is required. Invoking avrdude with correct format solved the problem, but it was too late for the stock firmware.
Then I've tried different version of avrdude (6.0, 5.11 from another binary package), still the same problem.

Today I have given it a try on Windows, same result as OS X, then Ubuntu 14.04 with avrdude 5.11 and 6.1 under sudo.
Here it was even weirder, during "Write firmware to radio" the Companion started by reading something from the radio to a file in /tmp called NNNN-flash-check.bin, but stat showed that there's no such file. After reaching 100% on app reported "avrdude Ok" and did not try to write anything (maybe because file "-check" creation has failed?).
Frustrated, I've tried invoking avrdude 6.1 directly:
sudo avrdude -c usbasp -p m64 -U flash:w:opentx-9x-en.hex:i
After writing, reading and verifying avrdude reported success. After turning on the firmware invited me to perform stick/pot calibration. I've decided to try it once again and encountered another mismatch during verification in the first byte.
Although the verification failed, radio still works, but now I'm expecting some undefined behavior which may catch me off guard and cause some damage.

Does it seem like the connection between ATmega chip and USBasp programmer is unstable, or, the USBasp is faulty? Maybe it is due to my "invented" programming connector?
Why does the Companion try to create temporary/backup files and fails at doing so?
Last edited by Hertz on Mon Oct 05, 2015 10:40 am, edited 1 time in total.

tedbmoss
Posts: 121
Joined: Sun Jul 15, 2012 10:42 pm
Country: -
Location: Peoria, AZ

Re: [PROBLEM] Flashing Turnigy 9x strange behaviour

Post by tedbmoss »

your picture is not visible. It is now visible. :D
Last edited by tedbmoss on Sat Nov 14, 2015 6:25 am, edited 1 time in total.
tedbmoss
Posts: 121
Joined: Sun Jul 15, 2012 10:42 pm
Country: -
Location: Peoria, AZ

Re: [PROBLEM] Flashing Turnigy 9x strange behaviour

Post by tedbmoss »

Just as a general rule; utp cat-5e is 24 AWG about .51mm and the pins in a 6 pin plug are usually .64mm. This makes a possibly loose fit. If this is so, fix it first.
Hertz
Posts: 72
Joined: Wed Sep 30, 2015 2:14 pm
Country: -

Re: [PROBLEM] Flashing Turnigy 9x strange behaviour

Post by Hertz »

tedbmoss wrote:your picture is not visible.
Apologies, did not realize it was somehow relying on a cookie.
tedbmoss wrote:Just as a general rule; utp cat-5e is 24 AWG about .51mm and the pins in a 6 pin plug are usually .64mm. This makes a possibly loose fit. If this is so, fix it first.
I have finally received my double-row header connections and am going to fix the problem :-) Thanks.
Hertz
Posts: 72
Joined: Wed Sep 30, 2015 2:14 pm
Country: -

Re: [PROBLEM] Flashing Turnigy 9x strange behaviour

Post by Hertz »

Soldering a 6 pin header connector partially fixed the problem, looks like there is still some software-related issue.
I can now successfully use companion/eepe to read/write models, settings and firmware on Windows (bundled avrdude), Ubuntu (avrdude 6.1x compiled from sources), but not on OSX (avrdude from kkMulticopter flash tool, v5.11svn). On OSX flashing still spontaneously fails, but even after successful flashing I get garbage output on LCD screen.
Still, having a neat-looking programming header is nice :-)

tedbmoss
Posts: 121
Joined: Sun Jul 15, 2012 10:42 pm
Country: -
Location: Peoria, AZ

Re: [PROBLEM] Flashing Turnigy 9x strange behaviour

Post by tedbmoss »

All I could see was you did not need the telemetering mod that I did. It is easy to short out the wires to the connection plug, I hope you checked that. (I just noticed you used a six pin plug so this does not apply to you.)If you used a ten pin plug, sometimes the usbasp does not like having all the unused pins tied to ground because it uses one of them for other purposes but not to connect to the TX.(In this case). Check to see if you are not grounding a connection on the usbasp that is causing your problem. Some usbasp devices will only work on some but not all computer systems. Check with other users that your brand will work on the system that you want to use.

Post Reply

Return to “openTx”