NCN49599
www.onsemi.com
31
Bootloader
SDO
NCN49599
SDI
SCK
SDI
SD0
SCK
EEPROM
LE25U20AQGTXG
CSB
CSB
Figure 37. Connecting an External SPI Memory to the Modem
The memory must be connected to the pins of the
dedicated serial peripheral interface (SPI), as shown in
Figure 37. Connecting an external SPI memory to the
modem. Figure 37. Any non−volatile memory with the
standard command set and three bytes addressing is
supported; is recommended.
The user must program the firmware into the external
memory starting from address 0. Four bytes must be added
at the end of the lowest 256−byte sector that can fit them, i.e.
either the sector containing the last byte of the firmware or
the next sector. These four bytes contain the checksum, the
number of sectors used, and the magical numbers A5
H
and
5A
H
. The checksum must be computed over the entire binary.
Between the four metadata bytes and the firmware,
zero−padding must be written.
This is illustrated in Table 26.
Table 26. Required contents of an external bootable SPI
memory for a binary firmware file of length N bytes
Address Content
0
Firmware binary
...
N
N + 1
Zero padding, if required
...
100
H
• S + FB
H
100
H
• S + FC
H
Checksum
100
H
• S + FD
H
S, the number of sectors used
100
H
• S + FE
H
Magical number: A5
H
100
H
• S + FF
H
Magical number: 5A
H
Where S is the number of sectors used:
The tool PlcEepromGenerator.exe, provided by
ON Semiconductor, may be used to convert a binary
firmware file into a file that follows these requirements. The
latter can be written directly in the external memory.
As an example, if the firmware binary size is 618 bytes,
the first two 256−byte sector will be filled completely. The
last 106 bytes of the firmware binary will be written to the
third sector, followed by zero padding (256 − 106 − 4 = 146
bytes), followed by four bytes: checksum, 03
H
, A5
H
and
5A
H
.
Once the boot loader has finished copying the firmware to
the internal memory, the checksum is calculated and
compared to the stored checksum. If both match, the
processor is released from reset and the firmware starts
executing. IO2 subsequently becomes available as a normal
GPIO.
Firmware Upload Over the Serial Communication
Interface
During reset, the boot loader module in the modem can
receive the firmware over the serial interface.
To enable this mode, the IO2 and the boot control pin SEN
must be driven low; subsequently the modem must be reset.
IO2 must remain low during the entire boot process; if
driven high during boot the boot loader terminates
immediately. To restart the boot loader, reset the modem.
As soon as the reset of the modem is released, the boot
loader process starts. When it is ready to receive the
firmware from the external microcontroller, the boot loader
will send a 02
H
(STX) byte.
Upon receiving this byte the user must send the byte
sequence specified in Table 27. The sequence contains a
checksum to verify correctness of the received binary image.
The CRC must be calculated over the firmware binary only
(excluding the magical number and the size). The program
crc.exe, provided by ON Semiconductor, can be used for this
calculation.