
(0xFB), the response is eight bytes, intended to be human readable:
Tx
__{FB}______________________________
Rx
________{56)45)52)2E)31)2E)34)38}___
In the above example, the version string is "VER.1.48". The chips I've seen all follow this pattern
(with various digits, of course), so my utility checks for each character to be the right type (specific
letters, any digits, etc).
Status
The next command to know is how to check the status of the bootloader. We use this command at
various points to make sure the previous operation completed successfully. The request is a single byte
(0x70), and response is two bytes:
Tx
__{70}________________
Rx
________{SRD1)SRD2}___
There are only a couple of bits that we care about. Bit 7 of SRD1 is set when the bootloader is ready
for another command. Bit 5 is set when an erase command fails. Bit 4 is set when a program
command fails. Bits 3 and 2 of SRD2 tell you if you've "unlocked" the flash by providing the correct
unlock key:
xxxx 00xx
No key provided yet
xxxx 01xx
Wrong key provided
xxxx 11xx
Correct key provided
Throughout this manual, when we say "check the status" we mean to run this command and check the
status bits that are returned. You can also clear the status bits:
Tx
__{50}________________
Rx
______________________
You should clear the status before erasing or programming the flash, as the error bits for those are
cumulative.
Ok, now that we know how to talk to the bootloader, we need to start the process of downloading the
new application into the flash. We first have to unlock the chip. Then we erase the flash. Then, for
each page (256 bytes) of memory that needs to be programmed, we download that page then read it
back to verify it.
Address Sizes
A quick note on address sizes... The commands we send to the chip all have 24-bit address parameters.
This is because the protocol was designed for the M16C family, which has a 20-bit address. However,
with the introduction of the R32C, which has a 32-bit address, a new command was added to provide
the upper 8 bits of the address separately. Throughout this manual, where you see a command that
takes a 24-bit address, for the R32C, you prefix it with this sequence (0x48, not 0x4B) to provide the
extra bits:
Tx
__{48)MSB}____________
For example, to issue a fictitious command CMD with address 0x12345678, we'd do something like
Kommentare zu diesen Handbüchern