This section walks through the entire
flow of programming an application into flash using the MCAN boot mode.
Ensure the device is ready for MCAN
communications by resetting the device while ensuring the boot mode pins are in the
proper state to select MCAN Boot mode. These are the steps that follow:
- The device enters the MCAN Boot
loader and waits to receive message frames in the RX Message Buffer. Acceptable
messages have a MSGID value of 0x1 for boot-loader communication.
- The flash kernel is transferred
to the device with 64 bytes of data per frame at 1Mbps (nominal bitrate). The
host programmer will transmit frames to the device until the kernel has finished
download.
- The ROM transfers control and the
flash kernel begins to execute. There is a small delay in which the kernel must
prepare the device for flash programming before it is read to begin
communications, and in this time the kernel configures the PLL, flash wait
states, and so forth.
- The F28P55x kernel will
erase the user-designated flash banks/sectors at this point.
- The F28P65x and F28003x
kernels erase flash at a later point.
- The kernel enters MCAN Boot mode
and waits to receive message frames in the RX Message Buffer. The bit-rate
switching (BRS) value is adjusted within the project and allows the bitrate to
be increased to 2Mbps (data bitrate), to allow for a faster download of the
application.
- The host programmer delays for 5
seconds before sending the application image at 2Mbps and payload of 64 bytes
per frame.
- At the beginning of the download
process, a key, a few reserved fields, and the application entry point are
read.
- The F28P65x kernel begins
to erase the flash at this point. Erasing flash can take a few seconds,
so it is important to note that while it looks like the application load
may have failed, it is likely that the flash is just being erased.
- Once the flash is erased, the
application load continues by transferring frames of data into blocks of
application code, and programming that into flash 128-bits or 512-bits at a
time.
- The F28P55x flash kernel
programs 512-bits at a time
- The F28003x and F28P65x
flash kernels program 128-bits at a time
- Before
programming data, the F28003x kernel checks each flash sector to
see if it has been erased . If it is has not been previously
erased, the sector is erased and the application data is
programmed.
- After a block of data is
programmed into flash, the kernel continue to receive messages to program the
next block of data. This process continues until the entire application has been
programmed into flash.
Now that the application is programmed
into flash, the flash kernel attempts to run the application by branching to the
entry point that was transferred to it at the start of the application load process.
A device reset is needed for this.