title: How to set STM32 to generate standard CRC32
body: <p>I am trying to generate CRC with STM32L4 hardware modul. I would like to validate fatfs files so basically I have byte arrays. I am using this CRC <a href="http://www.sunshine2k.de/coding/javascript/crc/crc_js.html" rel="noreferrer">generator</a>.</p>
  
  <p>Unfortunately I cannot figure out how to set STM32L4 to generate the same result. I need CRC32 and I have </p>
  
  <p>configuration:</p>
  
  <pre><code>hcrc.Instance = CRC;
  
  /* The default polynomial is not used. It is required to defined it in CrcHandle.Init.GeneratingPolynomial*/
  hcrc.Init.DefaultPolynomialUse    = DEFAULT_POLYNOMIAL_DISABLE;
  /* Set the value of the polynomial */
  hcrc.Init.GeneratingPolynomial    = 0x4C11DB7;
  //hcrc.Init.GeneratingPolynomial    = 0xFB3EE248;
  hcrc.Init.CRCLength= CRC_POLYLENGTH_32B;
  /* The default init value is used */
  /* The default init value is not used */
  hcrc.Init.DefaultInitValueUse     = DEFAULT_INIT_VALUE_ENABLE;
  
  /* User init value is used instead */
  //hcrc.Init.InitValue               = 0;
  hcrc.Init.InputDataInversionMode = CRC_INPUTDATA_INVERSION_NONE;
  //hcrc.Init.InputDataInversionMode = CRC_INPUTDATA_INVERSION_BYTE;
  /* The input data are inverted by word */
  //hcrc.Init.InputDataInversionMode  = CRC_INPUTDATA_INVERSION_WORD;
  
  //hcrc.Init.OutputDataInversionMode = CRC_OUTPUTDATA_INVERSION_ENABLE;
  hcrc.Init.OutputDataInversionMode = CRC_OUTPUTDATA_INVERSION_DISABLE;
  hcrc.InputDataFormat = CRC_INPUTDATA_FORMAT_BYTES;
  HAL_CRC_Init(&amp;hcrc);
  </code></pre>
  
  <p>testing:</p>
  
  <pre><code>uint8_t test[] = {49,50,51,52};
  uint32_t uwCRCValue = HAL_CRC_Calculate(&amp;hcrc,(uint32_t *) test, 4);
  </code></pre>
  
  <p>result: <code>A695C4AA</code></p>
  
  <p>I am out of ideas. There is one way that I am succeeded with it to have <code>uint32_t test[]</code> and input is set to <code>hcrc.InputDataFormat = CRC_INPUTDATA_FORMAT_BYTES;</code> 
  Unfortunately I have <code>uint8_t</code>...</p>