Hello
Im trying to move my arduino code from Arduino Due to Arduino Nano 33 IoT, and having a trouble with TRNG.
I googled and saw some posts about TRNG, and it seemed like TRNG is only offered by SAM3X8E in Arduino Due.
I tried to transfer trng.c code defined in hardware/arduino/system/libsam/source/trng.c and more, but it doesnt work.
Can anyone tell me how to use Arduino Due's TRNG function in Arduino Nano 33 IoT?
Im working on it quite for a while, and cant solve it.
Sample code below:
void Test()
{
int i, j;
uint32_t t;
for (i = 0; i < xlen; i+=4) {
t = trng_read_output_data(TRNG);
*(x + i + 0) = ((unsigned char*)&t)[0];
*(x + i + 1) = ((unsigned char*)&t)[1];
*(x + i + 2) = ((unsigned char*)&t)[2];
*(x + i + 3) = ((unsigned char*)&t)[3];
}
}
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
trng_enable(TRNG);
pmc_enable_periph_clk(ID_TRNG);
Test();
// Serial.println(freeMemory());
}
void loop() {
Serial.end();
}