cancel
Showing results for 
Search instead for 
Did you mean: 

CRYP issue when Timer is used as Timebase Source

MattCZ
Associate

Hi, I have nucleo-h753ZI and I want to use CRYP in a project that also uses FREERTOS. I set Timer 6 as Timebase Source (recommended due to FREERTOS) and as a result, program goes to HardFault every time I use HAL_CRYP_Encrypt function.

HAL_CRYP_Decrypt(&hcryp, (uint32_t *)AES_input, 48, (uint32_t *)encrypted, 100);

I configured CRYP to AES CBC with 256bit key and 8bit data and my array size is 48.

When I change Timebase Source to systick, it works without any issues.

Does anyone know what is the issue here?

Thanks.

4 REPLIES 4
CMYL
ST Employee

Hello MattCZ,

I will check to reproduce the issue once I got the board, could you give me more details about your settings.

  • Is it the default one generated by the CubeMx?
  • What is the version of CMSIS FreeRTOS APIs, V1 or V2 ?
  • MPU disabled or enabled ?
  • How many tasks ? One task calling HAL_CRYP_Decrypt(&hcryp, (uint32_t *)AES_input, 48, (uint32_t *)encrypted, 100); ?
  • What is the Tick period used ?

Best Regards,

Younes

CMYL
ST Employee

Hi,

Attached a main.c file running STM32H7B3I-DK as the nucleo-h753ZI is not available for me. It is easy to migrate it to nucleo-h753ZI.

The freeRTOS project contains 2 Tasks, one for encrypt and the second for Decrypt. The default settings of FreeRTOS are used.

0693W00000Nrg3KQAR.png 

To reuse the project, you can generate a new one for nucleo-h753ZI by CubeMx enabling the TIM6 as source of Tick. Then use this main.c file instead of the generated one.

Best Regards,

Younes

Hi Younes,

thank you for your reply. I found out that there is some relation to data width you use for crypto. When I was trying 8bit data, it was not working. When I switched to 32bit, it is working fine with Timer 6 as timebase source. I have no idea why.

My original test was with default Cube MX project for H753ZI, no MPU, CMSIS V2, 1 task in freertos and 1msec period.

I was able to continue with 32 bit data, so it is not stop condition. Since you used 16bit, maybe the problem is only with 8bit data width.

Martin

CMYL
ST Employee

Hi Martin,

I will check also the 8bits data size :)

Younes