Skip to content

Commit

Permalink
furi_hal_random: Wait for ready state and no errors before sampling (#…
Browse files Browse the repository at this point in the history
…3933)

When random output is not ready, but error state flags are not set,
sampling of random generator samples zero until next value is ready.
  • Loading branch information
n1kolasM authored Oct 6, 2024
1 parent 00c1611 commit cfb9c99
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion targets/f7/furi_hal/furi_hal_random.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#define TAG "FuriHalRandom"

static uint32_t furi_hal_random_read_rng(void) {
while(LL_RNG_IsActiveFlag_CECS(RNG) && LL_RNG_IsActiveFlag_SECS(RNG) &&
while(LL_RNG_IsActiveFlag_CECS(RNG) || LL_RNG_IsActiveFlag_SECS(RNG) ||
!LL_RNG_IsActiveFlag_DRDY(RNG)) {
/* Error handling as described in RM0434, pg. 582-583 */
if(LL_RNG_IsActiveFlag_CECS(RNG)) {
Expand Down

0 comments on commit cfb9c99

Please sign in to comment.