Fix CC2538 random_init lockup
Contiki sometimes fails to boot correctly and locks up in random_init() This problem only manifests itself for specific versions of the arm-gcc toolchain and then again only for specific levels of optimisation (-Os vs -O2, depending on the value of the SMALL make variable) The lockup is caused when we write an RFCORE XREG before the RF clock ungating has taken effect, which in turn only occurs depending on the assembly generated for those two instructions: REG(SYS_CTRL_RCGCRFC) = 1; REG(RFCORE_XREG_FRMCTRL0) = 0x00000008; This commit makes the RNG wait for the ungating to take effect before attempting to write the register
This commit is contained in:
parent
33abe26ec8
commit
eed1352282
|
@ -92,6 +92,9 @@ random_init(unsigned short seed)
|
|||
/* Enable clock for the RF Core */
|
||||
REG(SYS_CTRL_RCGCRFC) = 1;
|
||||
|
||||
/* Wait for the clock ungating to take effect */
|
||||
while(REG(SYS_CTRL_RCGCRFC) != 1);
|
||||
|
||||
/* Infinite RX - FRMCTRL0[3:2] = 10
|
||||
* This will mess with radio operation - see note above */
|
||||
REG(RFCORE_XREG_FRMCTRL0) = 0x00000008;
|
||||
|
|
Loading…
Reference in a new issue