KP-32 Boot Downloader
=====================

Version 0.1.1
-------------

File type:   Motorola
File offset: 0
EPROM type:  29F040
Date:        2014-01-09
Checksums:   U2 = 354e, U3 = ac53

------------
DIP switches
------------

Positions 8-7	Mode selection
Positions 6-1	Not used by downloader

Switch 8	Switch 7	Mode
--------	--------	----
Open		Open		Normal operation
Open		Closed		Normal operation
Closed		Open		Force download
Closed		Closed		Reserved (debug-only mode)

Note that, while DIP switch positions 1-6 are not used by the
downloader, some of these are used by the client code (the fully
functional KP-32 code).


-----------
Description
-----------

The boot downloader occupies the first sector (out of 8 sectors) in
each of the flash EPROMs. On reset, the boot downloader checks for
the presence of valid "client" code, i.e. the real keypanel code,
starting in the second sector. If this code is present, control
is transferred to it, and the panel wakes up as a fully functional
keypanel.

If the boot downloader cannot find a client image, it enters download
mode. In this operation, it will communicate with the matrix, but
will ignore all messages except for firmware download messages.
The panel will display ****'s until it starts communicating with
the matrix; it will then display dashes, with the message "This panel
needs a firmware download!" in one of the displays. To further
highlight the need for downloading the panel, the displays will show
just 2 dashes for each key (" -- "), rather than the 4 dashes that
the intercom usually shows.

The panel will send the version string "NEEDS DOWNLOAD!" to the
intercom; this can be viewed from AZedit by going to the
Status / Software Versions / Keypanels screen.

During a download, the panel will show the progress of download on
one of the displays. The firmware is downloaded in "chunks", and
the panel shows how much of the current chunk has been downloaded.
Once the first chunk has been downloaded, the panel will perform
certain validations (e.g. that it is a valid keypanel image being
downloaded, and that there is enough RAM to do the download);
it will then show progress in a form similar to the following:

		Code Download in progress...
		 Chunk 2 of 12, try 1,  22%

Once the download completes, it will display a message indicating
that it is rewriting the flash, and that the power should
not be cycled.

It is possible that the client code passes all the validations, but
crashes when it is passed control. In this case, turning DIP switch
position 8 on will cause the downloader to ignore the client image
and to force a download.

* NOTE *

The standard KP-32 automatically determines the baud rate (9600 baud
or 76.8K baud). However, the boot downloader does not - it will
only communicate at 9600 baud. This should not be a problem, since
only ADAM, ZEUS, and Cronus intercoms are able to download firmware
to panels, and these intercoms only support 9600 baud polling.

* NOTE *

When the downloader has control, no other functions are supported.
The talk and listen keys will not work. Key assignments will not
be displayed. The keypad will not work. The front panel volume
control will not work. Audio cannot be changed; if the downloader
gets control after a reset (because there is not a valid client
image, or because the force-download switch is set), there will
be no audio through the panel.


----------------------------
Updating the Boot Downloader
----------------------------

If you try to download a new version of the boot downloader to a
member of the KP-32 family of keypanels, the download will fail.
In order for this to work, the panel must be in boot download mode.

To update the boot downloader: Turn on DIP position 8 and reset
the panel. This forces the panel to ignore the "client" code and
just run the boot downloader. Then you can download a new version
of the boot downloader. Once the download is complete, the panel
will reprogram itself, reset, and then restart, again coming up in
the boot downloader. Turn off DIP position 8 and reset the panel
to restore full panel operation.


--------------
Change History
--------------

New in version 0.1.1
--------------------

* Panel would sometimes remain in boot loader mode

  In some instances, when a keypanel was powered on, the panel would end up
  in boot loader mode, rather than executing the "client code". Fixed.


New in version 0.1.0
--------------------

* Support larger client image sizes

  Starting with version 2.4.0, the client code image is too large for earlier
  versions of boot loader to handle it.

  When a KP-32 needs to be updated to v2.4.0 or later via downloading, it is
  necessary to first update the boot loader to v0.1.0 (or later); once this
  is done, the client code can be downloaded.

* Display boot loader version string in AZedit

  When operating in boot loader mode, the version string (as displayed by
  AZedit) was simply "NEEDS DOWNLOAD!". For boot loader version 0.1.0 and
  later, the actual boot loader version is displayed.


New in version 0.0.9
--------------------

* When a download was started to the keypanel, sometimes garbage would be
  displayed briefly, before displaying the standard download progress
  message. Fixed.

* Very sporadically, a keypanel would enter the boot downloader, even though
  a valid client image was present. This could happen either when the panel
  was powered on, or during normal operation. A modification has been made
  to try to prevent this.


New in version 0.0.8
--------------------

* Test version - displays diagnostic information when boot downloader entered


New in version 0.0.6
--------------------

* Changed from 29F010 flash to 29F040

  !! NOTE !!

  This version can only be used with KP-32 firmware version 2.0.0
  and later.


New in version 0.0.3
--------------------

* Download status display improved

  While downloading a new version of firmware, a communications error
  when sending a message to a display module would cause the panel to
  display ****'s, although the download would continue. This was
  especially a problem with the KP-32/16. Fixed.
  
* Version strings sent to intercom during download

  The download status is now periodically sent to ADAMedit (as the
  keypanel version string) while downloading a new version of code.

* Boot downloader can now be downloaded

  With previous versions, only new KP-32 "client" code could be
  downloaded. Boot downloader version 0.0.3 is now able to download
  a version of the boot downloader, if DIP switch position 8 ("force
  download") is closed. Note that existing panels in the field
  do not have this capability, and so the boot downloader can only
  be updated by removing and reprogramming the flash EPROM.


New in version 0.0.2
--------------------

Do not use. This was an interim test version.


New in version 0.0.1
--------------------

Original version.
