Porting to the Sanguino (ATMega644p)

Over the weekend, I duplicated the 'Satpack' breadboard, this time using an ATMega644p micro-controller, which offers twice the programming space, EEPROM and, perhaps most important for debugging radio-control software, two hardware serial ports.
Bootloading this with my USBTinyISP  was a complete snap, in part because this chip puts all the SPI pins beside each other. I used the Arduino environment to bootload, following the instructions at http://sanguino.cc



The only snag I ran into, besides the usual wrong pin counts, etc., was that the reset pin, connected to the serial DTR via a 0.1 microfarad capacitor, really does need a pull-up resistor, despite the presence of an internal one. Without it, I had unreliable uploads.

On the whole, it was amazingly easy to port code: just recompile (which the Arduino IDE does automatically), and load. One quirky difference between this chip and the ATMega328 was the speed with which it did EEPROM writes. Developing on the ATMega328, my code to store satellite elements in EEPROM basically just threw the data in as fast as it could. This resulted in bad communication on the '644p, so I introduced a delay variable. This needed to be as high as 50ms per character to get reliable writing. Over 2kB of data, that's a pretty bad delay. Unless I can somehow get rid of this, it will be a strong argument for just using the DS32C35 as a RTC and memory chip.

Comments

Popular posts from this blog

Building and Operating a Transmitter from the Roaring 20s

Defining a 49:1 EFHW Transformer's Losses