PEmicro | Experts in Embedded tools for Flash Programming and Development
Cart New Account Login

HomeAbout usProductsSupportForumsBlogCustomer Service

Please accept the use of cookies on our site

At PEmicro we use web browser cookies in order to provide you with an enhanced experience and in order to be able to do things like shopping cart processing and identify you when you login to our website.

Click here to accept

P&E offers an easy and reliable way to control a Cyclone PRO via the built-in RS232 protocol. If you would like to follow along with our example, please pre-program your Cyclone PRO with a stand-alone image and configure your RS232 host device to operate at an 115200 baud rate, 8 data bits, no parity and 1 stop bit mode. You are now ready to enjoy the flexibility of controlling your Cyclone PRO by sending it a pre-defined set of byte strings. These commands cover full range of Cyclone PRO functionality, beginning with Executing All Commands of an Image (Same as Pressing the "Start" button) and ending with Dynamically Programming Data to Target.

In order to ensure that a given command reaches the Cyclone PRO without getting corrupted, each command is concluded by a CRC8 byte. Below is the command structure that should be followed every time the RS232 command is sent: [LENGTH] [COMMAND TYPE] [COMMAND ID] [PARAMETERS] [CRC8]. The user should calculate CRC8 and append it to all commands that are sent from a host system to a Cyclone PRO.

Let's go through a step-by-step example of CRC8 calculation for Execute All command:

The command consists of 4 bytes that include the CRC of $88: $03 $18 $11 $88.

Given an array of pre-calculated CRC values of:

const    crc8tab : array[0..255] of WORD = (

the following function should be executed with the initial CRC variable initialized to 0.

procedure ArrayCRC8(const a: array of byte; const len : byte; var crc: byte);
  i : byte;
     for i := 0 to (len-1) do
         crc := crc8tab[crc xor a[i]];

The first byte in the command representing its length should be omitted from CRC calculation.

Step 1: 0 xor $18 = $18. Retrieve CRC value from 24th location in our lookup table

                                 crc8tab[$18] = $48

Step 2: $48 xor $11 = $59. Retrieve CRC value from 89th location in our lookup table

                                    crc8tab[$59] = $88

Append the calculated CRC8 value of $88 to the end of your command to validate the correctness of the transmission.






search in blog posts


Product pages
Cyclone (42)
Cyclone FX (44)
Multilink (24)
Multilink FX (19)
GDB Server (12)
Prog ACMP (7)
Interface Library Routines (6)

ARM (36)
NXP (44)
Microchip (4)
Cypress (6)
Infineon (1)
Maxim (2)
Nordic Semiconductor (2)
Silicon Labs (4)
STMicroelectronics (5)
Texas Instruments (1)
Toshiba (2)
Renesas (6)

Production Programming (53)
Debug (29)
Automated Control (13)
Miscellaneous (36)

© 2019 P&E Microcomputer Systems Inc.
Website Terms of Use and Sales Agreement