View Single Post
Old Jun 03, 2011, 04:19 PM
OlliW is offline
Find More Posts by OlliW
Joined Sep 2009
2,922 Posts
Firmware for the Programming Box and the AvrCongif PC Program

Firmware for the Programming Box:
As with the GA250 the first thing to do is to solder cables to the ISP pads and burn the Atmega88 or Atmega88PA (which depends on your Robbe Box) with Haagens bootloader. Here I used a modified version of the bootloader, which requires the most left key to be pressed upon startup for the bootloader to become active. This was necessary to avoid potential communication conflicts on the one-wire port. After that the ISP cables can permanently be removed and the box closed, "for ever".

Then the firmware can be flashed into the programming box using Haagen's AVRootLoader Windows program. A serial or usb port is needed on the computer and an approrpiate adapter needs to be build (which is however simple to do) to connect the programming box to the PC.

A link to the latest firmware for the programming box I will provide below.

Functions of the Programming Box
The programming box is connected to the gyromixer via a standard servo extension cable to the programming connector atthe gyromixer, which is the YELLOW marked one. ATTENTION: please ensue that the servo extension cable is correctly plugged into the programming box (the black/brown ground cable should be at the top, and the white/yellow/orange/red signal cable at the bottom). Depending on the current state of the gyromixer (see next post), a connection is then established, which will be indictaed on the gyromixer by a blue LED going on and on the programming box by the display changing from "not connected" to showing the first menu item.

One may browse the parameters using the up and down keys to the most rright and left. The paramter setting may be changed using the + and - keys (also labelled Inc and Dec) in the middle of the key field.

IMPORTANTLY: Any change to the parameter becomes effectivel immediately. That is, if one disconnects the programming box and starts flying, the newly set parameters wil be used. This is most convennient as the heli does not have to be switched on and off for every parameter changes. HOWEVER, the parameter changes will be lost if the gyromixer is switched off, and the "old" parameters would be used the next time, whichis convennient of one doesn't like the parameter setting.

In order to store the current parameters PERMANENTLY one has to browse to the last menu item, switch to yes by pressing the + button, and initiate the permanet store by holding down the + key for about 2 seconds.

Some words on what happens internally.
The firmware for the programming box consists in fact of two parts, which have to work hand-in-hand, namely the code which is to be flashed into the uC of the programming box, and of course the code which has to be integrated into the GA250 software as the counter-part. The development of these software was in fact (so far) the most difficult part in the project, because of two reasons:

(A) I didn't wanted to have to update the software for the programmer box whenever I would change the parameters for the GA250 gyromixer... So, the parameters, their values, etc., i.e., the menu of the programming box has to be stored somehow in the GA250 itself. Since, however, menus do quickly consume quite a lot of the precious memory space this has to be done in some clever, memory friendly way.

(B) The communication between the box and gyromixer should be one wire, which in principle is simple. However, unfortunately, the ports easily available via the soldering pads in the GA250 do not provide an interrupt, hence one has to use a software UART with polling, but polling means that any interference by interrupts has to be avoided, which in turn means that during this time period all actions basically have to be disabled. In short, having to use a polling software UART requires some quite careful considerations as regards the communication protocol and timing.

Anyhow, after some efforts I found a reasonable solution. It comes at some cost, however, namely the minimal frame length for the PPM output signals to the motors is limited to 4 ms... Clearly, 3 ms or even 2 ms would be cool, but considering the limitations set by the mechanics of the coax heli itself a frame rate of 4 ms, which corresponds to 250 Hz update frequency, is way sufficient.

AvrConfig Windows PC Program
As an alternative to the programming box, a Windows PC program is available which allows to set the parameters via a GUI. A screen shot is attached below.

However, in contrast to the programming box it doesn't allow a "live" changing of the parameters. That is, the gyromixer has first to be connected to the computer, then the "Connect" button needs to be clickedm, and then the gyromixer needs to be switched on. Now the paramters can be read from the gyromixer, changed, and written back into the gyromixer. During all this the gyromixer is not functional as the firmware in it is actually not excecuted.

For the connection to the gyro mixer a computer with a serial or usb port is needed. If the usb port is to be used, which I consider the standard way of doing things and which I will describe only here, one needs a USB-TTL adapter together with a connector-button-wire-assembly which is described below (I call it the USB-Programming Adapter), and the appropriate drivers such that the usb-ttl adapter is recognized as a virtual COM port by Windows.

PS: I am not a good Windows GUI programmer, so I am not sure how well AvrConfig will do on different environments, I have tested it myself on a couple of Windows XP computers, where it worked, but this doesn't mean a lot. The key problem is the COM port handling (enumerating, timeout settings).
OlliW is offline Find More Posts by OlliW
Last edited by OlliW; Oct 23, 2011 at 09:36 AM.