Skip to content

Commit 20e4a35

Browse files
committed
Revert "STM32L5 RNG : update for deprecated MCU version"
This reverts commit f599a54.
1 parent 5aaf3a3 commit 20e4a35

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

targets/TARGET_STM/TARGET_STM32L5/STM32Cube_FW/STM32L5xx_HAL_Driver/stm32l5xx_hal_rng.c

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@
116116
/* Health test control register information to use in CCM algorithm */
117117
#define RNG_HTCFG_1 0x17590ABCU /*!< Magic number */
118118
#define RNG_HTCFG 0x0000A2B3U /*!< Recommended value for NIST compliancy */
119-
#define RNG_HTCFG_REVB 0x000CAA74U /*!< Recommended value for old MCU cut - deprecated */
120119
/**
121120
* @}
122121
*/
@@ -211,18 +210,10 @@ HAL_StatusTypeDef HAL_RNG_Init(RNG_HandleTypeDef *hrng)
211210
MODIFY_REG(hrng->Instance->CR, RNG_CR_CED | RNG_CR_CONDRST, hrng->Init.ClockErrorDetection | RNG_CR_CONDRST);
212211

213212
#if defined(RNG_VER_3_2) || defined(RNG_VER_3_1) || defined(RNG_VER_3_0)
214-
if ( HAL_GetREVID() == 0x2000) { // Deprecated - old MCU
215213
/*!< magic number must be written immediately before to RNG_HTCRG */
216214
WRITE_REG(hrng->Instance->HTCR, RNG_HTCFG_1);
217215
/* for best latency and to be compliant with NIST */
218-
WRITE_REG(hrng->Instance->HTCR, RNG_HTCFG_REVB);
219-
}
220-
else {
221-
/*!< magic number must be written immediately before to RNG_HTCRG */
222-
WRITE_REG(hrng->Instance->HTCR, RNG_HTCFG_1);
223-
/* for best latency and to be compliant with NIST */
224-
WRITE_REG(hrng->Instance->HTCR, RNG_HTCFG);
225-
}
216+
WRITE_REG(hrng->Instance->HTCR, RNG_HTCFG);
226217
#endif /* RNG_VER_3_2 || RNG_VER_3_1 || RNG_VER_3_0 */
227218

228219
/* Writing bit CONDRST=0 */
@@ -691,10 +682,6 @@ HAL_StatusTypeDef HAL_RNG_GenerateRandomNumber(RNG_HandleTypeDef *hrng, uint32_t
691682
{
692683
hrng->State = HAL_RNG_STATE_READY;
693684
hrng->ErrorCode = HAL_RNG_ERROR_TIMEOUT;
694-
if (__HAL_RNG_GET_FLAG(hrng, RNG_FLAG_SECS) != RESET)
695-
{
696-
hrng->ErrorCode |= HAL_RNG_ERROR_SEED;
697-
}
698685
/* Process Unlocked */
699686
__HAL_UNLOCK(hrng);
700687
return HAL_ERROR;

0 commit comments

Comments
 (0)