My favorites | Sign in
Project Home Wiki Issues Source
Search
for
FlashGuide  
Connecting a Flash programmer to your '9X
Phase-Implementation, Featured
Updated Mar 17, 2012 by gru...@gmail.com

Getting Wired

UPDATE 2011-11-24: Current versions of AVRDUDE do not seem to work well with the Sparkfun USB Pocket Programmer. I have switched to a USBasp based USB programmer and it is now working flawlessly. Original article (to be updated) continues ...

The first thing you will need is one of the many available AVR programmer kits. Perhaps you already have an AVR programmer? I purchased a USB Pocket Programmer from Spark Fun. It works really well and is not at all expensive. (SparkFun have a some really cool stuff by the way. Stop by for a while and check them out!)

You'll need to connect your programmer's ICP (In-Circuit Programming) cable to your '9X. There are a few options available.

An excellent "solder-less" example, using pogo pins, can be found in the offering from SmartieParts.com (Steven / s_mack on RCGroups forum). With this option, all you need is a screw-driver! The board includes a USB programming interface and an EL back-light driver for your LCD screen. I believe it even comes with an EL back-light sheet. See here for detailed information with images, in the form of a mini-review, by Erazz (of ER9X).

Here, I will discuss the, "soldering wires straight to PCB" method.

There is an excellent PDF guide for Windows users http://gruvin9x.googlecode.com/svn/trunk/doc/Flashing%20the%209x.pdf, which also shows how to connect an AVR programmer ribbon cable to the '9X. That guide though seems to rely on a colour coded cable to determine what wire goes where. So I've included a photo below of my 'classic all-grey' ribbon cable installation, with numbered wires, for your convenience.

When I ordered my SparkFun Pocket Programmer, I had them add a spare programming cable. I cut the two 'remote' connectors off the end of that and used what remained to wire up my radio. Here's a photo of my installation, using a stock SparkFun cable as described ...

IMPORTANT: The picture below shows a typical ‘V2′ transmitter, as has been shipping for a few months as at time of this writing. The V1 unit had an error on the PCB where the ‘SCK’ programming pad (wire 7 below) was connected one pin too far left on the ATmega64 chip. So watch out for that! If you have a V1 unit, you can still get things going. You just have to careful to get a wire soldered to the right place.
  • NOTE: The two little hot-glued resistors to the left, with their respective fine wires comprise the re-wiring necessary to free up the ATmega serial comms port (RXD/TXD) for telemetry data. Those pins are otherwise connected to the Throttle-Hold and Aileron-DR switches. For telemetry support, the switches get moved to two spare pins (PC6/7). This mod is only necessary if you intend using a Fr-Sky enabled binary image -- or specifying the EXT=JETI or EXT=FRSKY make attributes, when building from source. See here details of what to connect where and how.

Programmers with 6-pin ISP Connectors

If you have a more modern AVR programmer with a 6-pin ISP connector, you can find more appropriate wiring information on the gProg wiki page.

Flashing the Firmware

Software

Whilst I'm no stranger to Windows, I strongly prefer using my Mac for all development work. Fortunately, so do many others who work with Atmel AVR chips, so there’s a nice packaged installer named CrossPack that has everything you need for cross-compiling C/C++ AVR code on your Mac.

CrossPack also comes bundled with AVRDUDE, which is used to operate the programmer hardware. Even more conveniently, the 'usbtiny' programmer protocol driver that the SparkFun USB Pocket Programmer I randomly chose is also included and installed, ready-to-run as part of the CrossPack bundle. Very cool! Best of all, you don't have to do any configuring of this software. Just install it and then move on to the steps below.

And yes, the above software is all free! Aint it great? Be sure to say thanks or drop a donation!

Ready-to-Run "binary" firmware

There are (at the time of this writing) four pre-compiled hex file versions of gruvin9x available and kept up to date. The versions apply to the various different hardware mods/re-wiring you may or may not have chosen to do. You can download the version that is right for you from the TrunkBinaries page, using same to flash your '9X without having to compile from source.

See here to for the binaries download page.

Flashing Ready-to-Run Firmware

You can now burn your gruvin9x[-version].hex file using AVRDUDE as follows ...

avrdude -c usbtiny -p atmega64 -B 1 -U flash:w:gruin9x[-version].hex

AVRDUDE should find the USB programmer, whatever port it's connected to. If not, try unplugging the programmer and plugging it back in. (You'll probably need to do this at least once after installing CrossPack. No reboots are required! This is NOT Windows :p )

The flash procedure will completely erase your ATmega64A chip's Flash program memory, write in the new firmware and then read back the code to verify it all went OK. After using gruvin9x for a while, you can take a backup of your model programming data using the following AVRDUDE command ...

avrdude -c usbtiny -p atmega64 -B 1 -U eeprom:r:models.bin:r

... and you can restore that model data after any given re-flash using ...

avrdude -c usbtiny -p atmega64 -B 1 -U eeprom:w:models.bin

Oh by the way; unless you happen to have a battery connected to the '9X (requires the 12-way back cover connector be installed) then leave the tiny little switch on the programmer PCB set to “Power Target”. The programmer will then power up the 9X -- albeit in a fashion it isn’t used to (some switches disconnected etc) and it will complain bitterly with lots of beeping. Block your ears and ignore those, because the new gruvin9x firmware flashing process will very soon put silence all the racket!

What to Expect

After re-flashing for the first time, you can expect to feel a little anxious! Do not fret! The feeling is completely normal. :D

Disconnect and tuck your programming cable away, for now, in such a way that allows you to put the rear cover back on the transmitter. You can tidy things up more once you know its all working.

REMEMBER to reconnect the rear-cabinet cable connector! The first time I flicked the power switch after flashing I got absolutely nothing. Not even a beep or a flicker. “Uhoh!” ... then I realised that things would probably go better with the power and other things actually connected! :-P

During boot-up, the new firmware checks a few things. You’ll get one or more “alerts” on screen, like “Throttle not set idle” and a message like "Alert! Alarms disabled" — meaning the beeper is turned off, as it will be by default. Also, all switches have to be in the “off” state — that is, all front switches ‘up’ and top switches ‘back’. Oh and don’t worry — all these power-up warnings can be disabled through settings in the new '9X menus if you don’t want them. (I don't!)

Once you clear the alerts away (by pressing EXIT for each or satisfying the switch positions), you should see the (also optional) 'gruvin9x' splash screen'. From this point, things just get better and better ...

The first thing you’ll want to do is set the ‘mode’ to ‘Mode 1′, for your throttle on the right, right? — since no one in their right mind would ever use Mode 2 now, would they? :P OK, maybe just a few folk might -- maybe even you. Mode 2 is in fact the default, and I have no plans to change that, actually.

Oh! To access that system settings menu, press and hold LEFT (original '+') button.

On that note, now would be a really good time to give the ER9X Users Guide a thorough once-over. If you haven't already realised, I think you'll be impressed with how powerful this firmware is. It truly does completely transform an otherwise rather average "Chinese '9X" radio into something a lot of fun to own and use.

Compiling from Source

Please see the Compiling From Source wiki page for details on this subject, including changes to the original Makefile defaults employed by gruvin9x.


Sign in to add a comment
Powered by Google Project Hosting