Merge pull request #10387 from SemjonKerner/fix_nrf52_hwrng
cpu/nrf5x: fix hwrng hang
This commit is contained in:
commit
a98edd33a0
@ -39,6 +39,7 @@ void hwrng_read(void *buf, unsigned int num)
|
|||||||
#ifdef CPU_FAM_NRF51
|
#ifdef CPU_FAM_NRF51
|
||||||
NRF_RNG->POWER = 1;
|
NRF_RNG->POWER = 1;
|
||||||
#endif
|
#endif
|
||||||
|
NRF_RNG->INTENSET = RNG_INTENSET_VALRDY_Msk;
|
||||||
NRF_RNG->TASKS_START = 1;
|
NRF_RNG->TASKS_START = 1;
|
||||||
|
|
||||||
/* read the actual random data */
|
/* read the actual random data */
|
||||||
@ -51,9 +52,11 @@ void hwrng_read(void *buf, unsigned int num)
|
|||||||
b[count++] = (uint8_t)NRF_RNG->VALUE;
|
b[count++] = (uint8_t)NRF_RNG->VALUE;
|
||||||
/* NRF51 PAN #21 -> read value before clearing VALRDY */
|
/* NRF51 PAN #21 -> read value before clearing VALRDY */
|
||||||
NRF_RNG->EVENTS_VALRDY = 0;
|
NRF_RNG->EVENTS_VALRDY = 0;
|
||||||
|
NVIC_ClearPendingIRQ(RNG_IRQn);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* power off RNG */
|
/* power off RNG */
|
||||||
|
NRF_RNG->INTENCLR = RNG_INTENSET_VALRDY_Msk;
|
||||||
NRF_RNG->TASKS_STOP = 1;
|
NRF_RNG->TASKS_STOP = 1;
|
||||||
#ifdef CPU_FAM_NRF51
|
#ifdef CPU_FAM_NRF51
|
||||||
NRF_RNG->POWER = 0;
|
NRF_RNG->POWER = 0;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user