Renesas M16C FAMILY Handbuch Seite 6

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 11
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 5
Erase All
Erasing everything is easy. It's not as fast or as optimal as just erasing the blocks you need, but it's
universal. Since this command takes a while to run, special precautions will be taken to properly clear
and read the status.
Tx
__{50}_{A7)D0}____{70}____________________{70}____________
Rx
_________________________{TIMEOUT}____________{SRD1)SRD2}_
After you issue the format command (0xA7, 0xD0), set up a 1 second timeout on receive and start
asking for status. If the status read times out, keep trying. I try 15 times. If you get data back but it
doesn't make sense, or if it indicates that the erase isn't done, wait 500mS and flush any other bytes you
may have received before trying again. This helps re-synchronize the status read, so that you're sure
you're reading SRD1 first and not the old SRD2 first.
Program Page
A "page" of memory is 256 bytes, aligned on a 256 byte boundary. Since the address always ends in
0x00, only two bytes of address need be downloaded
*
. Send the middle byte first, followed by the high
(MSB) byte, followed by 256 bytes of data:
Tx
__{50}_{41)ADR1)ADR2)BYTE0)BYTE1)**)BYTE255}_____{70}_____
Rx
______________________________________________________{*}_
The same timeout/retry instructions apply here as for when erasing. So, for example, to write all fours
to address 0x12300:
Tx
__{50}_{41)23)01)44)44)**)44}_____{70}____
Rx
______________________________________{*}_
*
For R32C, send the top 8 bits (bits 31-24) separately, with bits 23-16 then bits 15-8 in the command.
Page Read
After you program each page, you should read it back to ensure it was programmed correctly. In my
utilities, I retry the program/read/verify cycle three times before giving up (at which point, you need to
erase the flash and start again). The sequence to read a page is similar to programming a page, in that
you send the read page command (0xff), two of the three address bytes, then read 256 data bytes back:
Tx
___{FF)ADR1)ADR2}_____________________________
Rx
__________________{BYTE0)BYTE0)**)BYTE255}____
Note that there is no need to clear or read the status, however it may be prudent to drain any bytes
waiting on the Rx line to ensure you're in sync with the bootloader, before doing this command.
Done!
Once you've downloaded all the pages you need (don't forget the page that includes the reset vector),
there's nothing left to do but reset in user mode and run your application!
nRESET
====\/== · · ·
MODE/CNVss
??/===== · · ·
Seitenansicht 5
1 2 3 4 5 6 7 8 9 10 11

Kommentare zu diesen Handbüchern

Keine Kommentare