diff --git a/os/hal/ports/STM32/LLD/RNGv1/hal_trng_lld.c b/os/hal/ports/STM32/LLD/RNGv1/hal_trng_lld.c index b4a780d90..c81e433f6 100644 --- a/os/hal/ports/STM32/LLD/RNGv1/hal_trng_lld.c +++ b/os/hal/ports/STM32/LLD/RNGv1/hal_trng_lld.c @@ -45,7 +45,7 @@ TRNGDriver TRNGD1; /* Driver local variables and types. */ /*===========================================================================*/ -static const TRNGConfig default_cfg = {0}; +static const TRNGConfig default_cfg = {.cr = 0}; /*===========================================================================*/ /* Driver local functions. */ diff --git a/os/hal/ports/STM32/LLD/RNGv1/hal_trng_lld.h b/os/hal/ports/STM32/LLD/RNGv1/hal_trng_lld.h index c537b84fd..2a1e9ba46 100644 --- a/os/hal/ports/STM32/LLD/RNGv1/hal_trng_lld.h +++ b/os/hal/ports/STM32/LLD/RNGv1/hal_trng_lld.h @@ -85,8 +85,12 @@ #error "STM32_RNGCLK not defined in this HAL" #endif -#if STM32_RNGCLK != 48000000 -#error "STM32_RNGCLK is not exactly 48000000" +#if ((STM32_RNGCLK < 47000000) || (STM32_RNGCLK > 49000000)) && \ + ((STM32_RNGCLK < 3500000) || (STM32_RNGCLK > 4500000)) +#if !defined(STM32_DISABLE_RNG_CLOCK_CHECK) +#error "STM32_RNGCLK is not within a tested clock range" +#error "define STM32_DISABLE_RNG_CLOCK_CHECK to override this check" +#endif #endif /*===========================================================================*/ @@ -101,8 +105,8 @@ * @brief Low level fields of the TRNG configuration structure. */ #define trng_lld_config_fields \ - /* Dummy configuration, it is not needed.*/ \ - uint32_t dummy + /* CR register initialization value.*/ \ + uint32_t cr /** * @brief Low level fields of the TRNG driver structure.