In-system programming timings, Protection mechanisms, Transfer checks – Rainbow Electronics T89C5121 User Manual

Page 66

Advertising
background image

66

A/T8xC5121

4164G–SCR–07/06

In-System Programming
Timings

The download from the internal EEPROM to CRAM is executed after 4 seconds when
operating at 12 MHz frequency.

Protection Mechanisms

Transfer Checks

In order to verify that the transfers are free of errors, a CRC check is implemented dur-
ing the download of the program in CRAM.

This test is done at the end of the 16K space programming.

As detailed in the next algorithms:

in ISP mode, if CRC test pass, a character Y is returned before the CRLF
characters else a character Z is retuned.

in download mode, a serial data AA is sent on P3.7 port and CRAM is not executed.

For this purpose, the user program must include in the two last upper bytes (address
3FFEh and 3FFFh) the CRC of the previous bytes (calculated from the address 0000h
to 3FFFDh).

The following frames are examples including the CRC in the two last upper bytes:

FF 03 C0 21 04 00 00 08 07 02 08 02 2D DB (CRC = 2DDBh)

FF 03 80 21 02 04 00 0A 03 06 C0 A8 70 01 E3 3D (CRC = E33Dh)

FF 03 C0 21 02 01 00 10 02 06 00 00 00 00 05 06 00 00 76 55 49 AC (CRC =
49ACh)

The CRC algorithm is the following :

***************************************************************************************************

Uint16 compute_crc (Uint16 W)
{
UcharC;
W&=(Uint16)0x00FF;
for (C=(Uchar)8;C;C--)
{
if ((Uchar)W&(Uchar)1)
{
W>>=1;
W^=(Uint16)0x8408;
}
else
W>>=1;
return W;

Data Bytes

2 Bytes CRC

HSB

LSB

Address: 3FFE,3FFF

Advertising