Main Site Documentation

Curbuino Bee Enable Random Number Generator


#1

I’m using the register class in 4.3 to try and enable the random number generator (RNG) peripheral in the STM32F405 microcontroller on the Cerbuino bee but I can’t seem to set the enable bit to a one. According to the reference manual pg.752 (http://www.st.com/st-web-ui/static/active/en/resource/technical/document/reference_manual/DM00031020.pdf) in order to enable the random number generator, bit 2 in the RNG control register (0x50060800) needs to be set to a one. I try and use SetBits but when I read back the value of the register, the 2nd bit is still a zero. I can successfully set bits in other registers but not this one. Do you guys know what I’m doing wrong? THX

// Random Number Generator Control Register
Register REG_RNG_CR = new Register(0x50060800);
// Set bit 2 to a one to enable random number generator
REG_RNG_CR.SetBits(1 << 2);
// Read RNG Control Settings
uint REG_RNG_CR_VALUE = REG_RNG_CR.Value;
Debug.Print("REG_RNG_CR_VALUE = " + REG_RNG_CR_VALUE);

Output in debug window:
REG_RNG_CR_VALUE = 0