# ******************************************************************************
#   PRECMA S.r.l.  -  Electronic Engineering  -  http://www.precma.com
#       Progettazione Elettronica Controlli di Macchine Automatiche
#
# ADuC8xx Downloader
# Analog Devices ADuC8xx family microcontrollers downloader
#
# Fausto Marzoli - faumarz@8052.it
# Copyright (C)2005-2006 PRECMA S.r.l. - FauMarz - http://www.precma.com/
# ******************************************************************************

This program is distributed under the GNU GPL license, for Windows and Linux.

Using perl module Device::SerialPort (http://sendpage.org/device-serialport/)
or Win32::SerialPort (http://members.aol.com/Bbirthisel/alpha.html)

To install the module, download it the run "perl Makefile.PL" and "perl install.pl".
Under Windows I used Active Perl with the optional module Win32/API (you can install it with the Active Perl Package Manager). Under Windows you can use the executable aduc8xx.exe, without the need to have perl installed.

Made to work with ADuC842, but should work with any other uC of the family, too (except the first versions with loader 1.0 installed onboard).
Developed under Linux (SuSE 9.2 and 10.0); works with Windows, too.
It has been reported to be working with FreeBSD.

Accept and intelligently use multiple options. For example, you can blank and program the LPC device with one single command line:
# aduc8xx.pl --echip --program dummy.hex

When using aduc8xx.pl the first time, you will be asked for using the --port option. After the first successful using of the --port option, aduc8xx.pl writes its configuration in a hidden file named .aduc8xx.cgf in your home dir.
Under Linux, usually the port to be used is /dev/tty0 or /dev/ttyUSB0 or something like this (be sure to have the rights to access the port!). Under windows should be some COM (COM2, or COM3 or something similar).


----------------------------------------------------------
IMPORTANT NOTE:
Some ADuC derivates change the bootloader baud rate if you change the system clock from the default values.
aduc8xx.pl uses a fixed baud rate of 9600 baud and can not use any other baud rate for initiating the communication: so you should use a system clock in order to have a 9600baud rate of the bootloader.

If you use different, you should care of using available standard baud rates and you should modify the aduc8xx.pl source code in order to use it.

----------------------------------------------------------
Quickmode Option:
The --quickmode option changes the baud rate from the bootloader default (usually 9600) to the given value. It can be used only in the derivates that can use Timer 3 for baud rate generation.

The value is composed by two comma-separated strings:
- The first string is the hex value of the registers T3CON+T3FD used for the baud rate generation; the values must be calculated as shown in the microcontroller datasheet (see the "Commonly used baud rates" table, if there is one).
- The second string is the desired baud rate for the PC serial port
Examples (for ADuC842 running with 32KHz crystal):
842D,19200
832D,38400
8309,57600
8209,115200

The ADuC842 bootloader use an internal value of 1 for the PLL configuration CPU core divider bits (CD2=0, CD1=0, CD0=1). I got this info with a few tries at different settings. I don't know if the bootloader uses this config in all the other derivates...

----------------------------------------------------------
Detect option
The --detect option try to initiate a communication with the bootloader; default communication init. baud rate is 9600baud, but you can specify different baud rates.
This can be used if your system uses a clock different from the standard clock for the derivate.
NOTE: you MUST use a system clock than can produce a standard baud rate speed; non-standard baud rate are not supported.

