LM3S610 Data Sheet
October 8, 2006 391
Preliminary
Appendix A. Serial Flash Loader
The Stellaris serial flash loader is used to download code to the flash memory of a device without
the use of a debug interface. The serial
flash loader uses a simple packet interface to provide
synchronous communication with the device. Th
e flash loader runs off the crystal and does not
enable the PLL, so its speed is determined by the crystal used. The two serial interfaces that can
be used are the UART0 and SSI interfaces. For simplicity, both the data format and
communication protocol are identical for both serial interfaces.
A.1 Interfaces
Once communication with the flash loader is established via one of the serial interfaces, that
interface is used until the
flash loader is reset or new code takes over. For example, once you start
communicating using the SSI port, communications with t
he flash loader via the UART are
disabled until the device is reset.
A.1.1 UART
The Universal Asynchronous Receivers/Transmitters (UART) communication uses a fixed serial
format of 8 bits of data, no parity, and 1 stop bit. The baud rate used for communication is
automatically detected by
the flash loader and can be any valid baud rate supported by the host
and the device. The auto detection sequence requires that the baud rate should be no more than
1/32 the crystal frequency of the board that is running the serial
flash loader. This is actually the
same as the hardware limitation for the maximum baud rate for any UART on a Stellaris device.
In order to determine the baud rate, the serial
flash loader needs to determine the relationship
between its own crystal frequency and the baud rate. This is enough information for the
flash
loader to configure its UART to the same baud rate as the host. This automatic baud rate detection
allows the host to use any valid baud rate that it wants to communicate with the device.
The method used to perform this automatic synchronization relies on the host sending the flash
loader two bytes that are both 0x55. This generates a series of pulses to th
e flash loader that it can
use to calculate the ratios needed to program the UART to match the host’s baud rate. After the
host sends the pattern, it attempts to read back one byte of data from the UART. The
flash loader
returns the value of 0xCC to indicate successful detection of the baud rate. If this byte is not
received after at least twice the time required to transfer the two bytes, the host can resend
another pattern of 0x55, 0x55, and wait for the 0xCC byte again until t
he flash loader
acknowledges that it has received a synchronization pattern correctly. For example, the time to
wait for data back from the
flash loader should be calculated as at least 2*(20(bits/sync)/baud rate
(bits/sec)). For a baud rate of 115200, this time is 2*(20/115200) or 0.35ms.
A.1.2 SSI
The Synchronous Serial Interface (SSI) port also uses a fixed serial format for communications,
with the framing defined as Motorola format with SPH set to 1 and SPO set to 1. See the section
on SSI formats for more details on this transfer protocol. Like the UART, this interface has
hardware requirements that limit the maximum speed that the SSI clock can run. This allows the
SSI clock to be at most 1/12 the crystal frequency of the board running th
e flash loader. Since the
host device is the master, the SSI on th
e flash loader device does not need to determine the clock
as it is provided dir ec tl y by the host.
A.2 Packet Handling
All communications, with the exception of the UART auto-baud, are done via defined packets that
are acknowledged (ACK) or not acknowledged (NAK) by the devices. The packets use the same