This section walks through the entire
flow of programming an application into flash using the DCAN boot mode.
Ensure the device is ready for DCAN
communications by resetting the device while ensuring the boot mode pins are in the
proper state to select DCAN Boot mode. These are the steps that follow:
- The device enters the DCAN Boot
loader and waits to receive message frames in Mailbox 1. Acceptable messages
have a message identifier (MSGID) value of 0x1 for boot-loader communication.
For more on mailboxes and MSGID, refer to the DCAN chapter of the
device-specific TRM [6].
- The flash kernel is transferred
to the device with 2 bytes of data per frame. The host programmer will transmit
frames to the device, checking if data bytes 3 and 4 are non-zero values. Bytes
3 and 4 of the text file must be replaced with the hex value calculated from the
final result of the bit timing register value (CAN_CALC_BTRREG) in order
of least significant byte followed by the most significant byte. If the host
programmer recognizes a bit-timing change with bytes 3 and 4, the host
programmer will then send the bit-timing change to the device and re-initialize
itself (skipping the following 7 reserved words). The device will increase the
bitrate to the desired bit-timing and continue to receive frames 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 F28P65x and F280015x
devices will erase the user-designated flash banks and sectors at this
point.
- The F28003x kernel erases
at a later point
- The kernel enters DCAN Boot mode
and waits to receive message frames in Mailbox 1. The CAN_CALC_BTRREG
value (bootloader_can_timing.h) is adjusted within the project to 1Mbps
and the DCAN message buffer size is adjusted by the kernel from 2 bytes per
frame to 8 bytes per frame, to allow for a faster download of the
application.
-
The host programmer will delay
for 5 seconds before sending the application image at 1 Mbps and payload of
8 bytes per frame.
- At the beginning of the download
process, a key, a few reserved fields, and the application entry point are
read.
- The F28003x 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 F280015x and F28P65x
flash kernels program 512-bits at a time
- The F28003x flash kernel
and 128-bit version of the F28P65x flash kernel program 128-bits at a
time
- After a block of data is
programmed into flash, the kernel continues 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.