Skip to content

Commit

Permalink
FW: fix random number generator initialization?
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannesTaelman committed Aug 26, 2016
1 parent fb9cb4a commit f1b2506
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion firmware/axoloti_math.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,14 @@ void axoloti_math_init(void) {
*q16++ = (uint32_t)(e * (1 + INT16_MAX));
}

// initialize the hardware random number generator
// reset & initialize the hardware random number generator
RCC->AHB2RSTR |= RCC_AHB2RSTR_RNGRST;
RCC->AHB2RSTR &= ~RCC_AHB2RSTR_RNGRST;
RCC->AHB2ENR |= RCC_AHB2ENR_RNGEN;
chThdSleepMilliseconds(1);
RNG->CR = RNG_CR_RNGEN;
while(!(RNG->SR & RNG_SR_DRDY)) {
}
}

uint32_t FastLog(uint32_t i) {
Expand Down

0 comments on commit f1b2506

Please sign in to comment.