Skip to main content
TZeig.1
Associate
Mar 10, 2021 5:28 PM UTC
Solved

STM32L476G-EVAL CRYP Examples Problem

The code from the 1.16 example builds fine in the EWARM. It writes the source blocks to the terminal, but as I see in the debugger, it fails to encrypt the input block. That times out as it fails to return a HAL_OK status.

 /* Start decrypting aCyphertext, the decrypted data is available in aDecryptedtext */

  if (HAL_CRYPEx_AES(&CrypHandle, aCyphertext, AES_TEXT_SIZE, aDecryptedtext, TIMEOUT_VALUE) == HAL_OK)

  {

   /* Display decrypted Data */

   Display_DecryptedData(CBC, 128, AES_TEXT_SIZE);

  }

  else  

  {

   /* Processing Error */

   Error_Handler();

  }

I have read all the how-to info in the examples.

Has anyone else run into this issue and found a solution?

This topic has been closed for replies.
Tesla DeLorean
Tesla DeLoreanBest answer
Guru
Mar 10, 2021 5:35 PM UTC

@par Hardware and Software environment

  - This example runs on STM32L486xx devices.

  - This example has been tested with a STM32L486ZG embedded on an

  STM32L476G-EVAL board and can be easily tailored to any other supported

  device and development board.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..

5 replies

Tesla DeLorean
Tesla DeLoreanBest answer
Guru
Mar 10, 2021 5:35 PM UTC

@par Hardware and Software environment

  - This example runs on STM32L486xx devices.

  - This example has been tested with a STM32L486ZG embedded on an

  STM32L476G-EVAL board and can be easily tailored to any other supported

  device and development board.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
TZeig.1
TZeig.1Author
Associate
Mar 10, 2021 5:40 PM UTC

I have the STM32L476xx on my  STM32L476G-EVAL board. That does not have the crypto processor, is that correct?

Tesla DeLorean
Guru
Mar 10, 2021 6:06 PM UTC

It doesn't have the cryp/hash unit enabled, it is probably the same die with either it fused off at the die test stage, or with a different mask in the set lacking metalization, etc related to the unit. ST doesn't disclose the exact methodology, but the parts coming in a without/with pairing ie L476/L486 or F767/F777

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Pavel A.
Mar 10, 2021 7:45 PM UTC

It looks like twin models with and without crypto can be distinguished by checking that config register of a crypto thingy holds written value.

For example, below is a code we use to distinguish STM32H753 from 743.

Maybe the same will work for L486 vs 476.

-- pa

#ifndef STM32H753xx
#define STM32H753xx /* override! */
#undef STM32H743xx
#endif
 
#include "stm32h7xx_hal.h"
#include <stdint.h>
#include <stdbool.h>
 
// Return true if the MCU has crypto 
// so this is H7 variant with crypto (ex. H753 vs H743)
bool H7_hw_crypto_test()
{
 // Test if HASH->CR is writable
 __HAL_RCC_HASH_CLK_ENABLE();
 HAL_Delay(5);
 HASH->CR = 0;
 __DSB();
 HASH->CR = 0x20; // set HASH_CR_DATATYPE=HASH_DATATYPE_8B
 __DSB();
 uint32_t u = HASH->CR;
 bool y = ((u & 0x30) == 0x20);
 __HAL_RCC_HASH_CLK_DISABLE();
 return y;
}

TZeig.1
TZeig.1Author
Associate
Mar 10, 2021 6:11 PM UTC

okay thank you!