Example for PRNG

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Not applicable
Hi,

I'm looking for example code for PRNG.
0 Likes
2 Replies
chismo
Employee
Employee
First like received
Hello,

With the PRNG XMC lib, it is quite easy.
The PRNG configuration needs to be defined first:

/* PRNG configuration */
XMC_PRNG_INIT_t prng_config =
{
.block_size = XMC_PRNG_RDBS_WORD,
.key_words = 5
};

And after the PRNG is initialized with the defined configuration, the random data can be read.

/* Initialize PRNG */
XMC_PRNG_Init(&prng_config);

/* Read into a variable */
random_data = XMC_PRNG_GetPseudoRandomNumber();


The file "xmc_prng.h" must be included of course.

Regards,
Min Wei
0 Likes
Not applicable
it seems that the DAC of XMC4500 can be used for the same purpose. However, there is so sample code about this. The documentation is also very limited in the reference manual.


chismo wrote:
Hello,

With the PRNG XMC lib, it is quite easy.
The PRNG configuration needs to be defined first:

/* PRNG configuration */
XMC_PRNG_INIT_t prng_config =
{
.block_size = XMC_PRNG_RDBS_WORD,
.key_words = 5
};

And after the PRNG is initialized with the defined configuration, the random data can be read.

/* Initialize PRNG */
XMC_PRNG_Init(&prng_config);

/* Read into a variable */
random_data = XMC_PRNG_GetPseudoRandomNumber();


The file "xmc_prng.h" must be included of course.

Regards,
Min Wei
0 Likes