Embedded Artists


We are the leading providers of products and services around prototyping, evaluation and OEM platforms using NXP's ARM-based microcontrollers.

LPC4088DM Using CRC

The LPC4088 MCU on the display modules has a Cyclic Redundancy Check (CRC) generator described in detail the LPC4088 User Manual, found here.

The DMSupport library has a CRC class to make it easier to calculate the checksum.

The checksum is used when the BIOS is loaded to make sure it is not corrupted.

A small example using the CRC:

#include "mbed.h"
#include "DMBoard.h"
#include "crc.h"

void main() {
  // initialize DMBoard...

  // Calculate checksum on the entire file /mci/firmware.bin
  FILE* f = fopen("/mci/firmware.bin", "r");
  if (f == NULL) {
    DMBoard::instance().logger()->printf("Failed to open /mci/firmware.bin\n");
  } else {
    uint32_t crcFirmware = crc_File(f);
    fclose(f);
    DMBoard::instance().logger()->printf("CRC32 checksum of /mci/firmware.bin is 0x%08x\n", crcFirmware);
  } 

  // Calulate the checksum of the string "Hello World!"
  uint32_t crcHello = crc_Buffer((uint32_t*)"Hello World!", strlen("Hello World!"));
  DMBoard::instance().logger()->printf("CRC32 checksum of \"Hello World!\" is 0x%08x\n", crcHello);
}

All wikipages