Jump to content
bigjohnson

Hardware CRC module example

Recommended Posts

Hello all,
I tried the TivaWare™ Peripheral Driver Library example of page 96 of https://www.ti.com/lit/ug/spmu298d/spmu298d.pdf on Energia 1.8.11E23, this is the code I run:

#include <sysctl.h>
#include <crc.h>

void setup() {
  Serial.begin(115200);
  while (!Serial){};
  
  Serial.println("Inizio");
  // put your setup code here, to run once:
  uint32_t g_ui32Result;
  // Random data for generatingCRC.
  //
  uint32_t g_ui32RandomData[16] =
  {
    0x8a5f1b22, 0xcb935d29, 0xcc1ac092, 0x5dad8c9e,
    0x6a83b39f, 0x8607dc60, 0xda0ba4d2, 0xf49b0fa2,
    0xaf35d524, 0xffa8001d, 0xbcc931e8, 0x4a2c99ef,
    0x7fa297ab, 0xab943bae, 0x07c61cc4, 0x47c8627d
  };
  // put your main code here, to run repeatedly:
  //
  // Enable the CRC module.
  //
  SysCtlPeripheralEnable(SYSCTL_PERIPH_CCM0);
  
  Serial.println("Abilitata la periferica");
  
  //
  // Wait for the CRC module to be ready.
  //
  while (!SysCtlPeripheralReady(SYSCTL_PERIPH_CCM0))
  {
  }

  Serial.println("La priferica è pronta");

  //
  // Configure the CRC module.
  //
  CRCConfigSet(CCM0_BASE,
               CRC_CFG_INIT_SEED |
               CRC_CFG_TYPE_P4C11DB7 |
               CRC_CFG_SIZE_32BIT);

 
  Serial.println("Configurata la periferica");

  //
  // Set the seed value.
  //
  CRCSeedSet(CCM0_BASE, 0x5a5a5a5a);

  Serial.println("Configurato il seed");

  //
  // Process the data and get the result.
  // The result should be
  // 0x75fd6f5c.
  //
  g_ui32Result = CRCDataProcess(CCM0_BASE, g_ui32RandomData, 16, false);
  
  Serial.print("Dati processati il risultato è: ");
  Serial.println(g_ui32Result, HEX);
 
}

void loop() {

}

but the result is E6C4210D not the expected 0x75fd6f5c

does somehone know which is the issue?
Thanks.

Alberto

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...