JupiterMoll
Member
Hallo,
I,m trying to compile the example Seed_PRNG included in the Entropy library of Teensyduino for generating random Numbers with Teensy 4.0
I got this error message during compiling:
It seems that the Entropy Library is not compatible with Teensy 4.0.
Is there a workarround to create random Numbers or can somebody help me to updated this library to work with Teensy 4.0 ???
Thx...
I,m trying to compile the example Seed_PRNG included in the Entropy library of Teensyduino for generating random Numbers with Teensy 4.0
Code:
#include <Entropy.h>
#define randomSeed(s) srandom(s)
void setup()
{
uint32_t seed_value;
Serial.begin(9600);
while (!Serial) {
;
}
Entropy.initialize();
seed_value = Entropy.random();
Serial.print("Seed value = ");
Serial.println(seed_value);
randomSeed(seed_value);
}
void loop()
{
}
I got this error message during compiling:
Code:
Arduino: 1.8.9 (Linux), TD: 1.48, Board: "Teensy 4.0, Serial, 600 MHz, Faster, US English"
/home/alphi/Arduino/libraries/Entropy/Entropy.cpp: In member function 'void EntropyClass::initialize()':
/home/alphi/Arduino/libraries/Entropy/Entropy.cpp:67:3: error: 'SIM_SCGC5' was not declared in this scope
SIM_SCGC5 |= SIM_SCGC5_LPTIMER;
^
/home/alphi/Arduino/libraries/Entropy/Entropy.cpp:67:16: error: 'SIM_SCGC5_LPTIMER' was not declared in this scope
SIM_SCGC5 |= SIM_SCGC5_LPTIMER;
^
/home/alphi/Arduino/libraries/Entropy/Entropy.cpp:68:3: error: 'LPTMR0_CSR' was not declared in this scope
LPTMR0_CSR = 0b10000100;
^
/home/alphi/Arduino/libraries/Entropy/Entropy.cpp:69:3: error: 'LPTMR0_PSR' was not declared in this scope
LPTMR0_PSR = 0b00000101; // PCS=01 : 1 kHz clock
^
/home/alphi/Arduino/libraries/Entropy/Entropy.cpp:70:3: error: 'LPTMR0_CMR' was not declared in this scope
LPTMR0_CMR = 0x0006; // smaller number = faster random numbers...
^
In file included from /home/alphi/Downloads/arduino-1.8.9-linux64/arduino-1.8.9/hardware/teensy/avr/cores/teensy4/core_pins.h:32:0,
from /home/alphi/Downloads/arduino-1.8.9-linux64/arduino-1.8.9/hardware/teensy/avr/cores/teensy4/wiring.h:38,
from /home/alphi/Downloads/arduino-1.8.9-linux64/arduino-1.8.9/hardware/teensy/avr/cores/teensy4/WProgram.h:45,
from /tmp/arduino_build_981811/pch/Arduino.h:6:
/home/alphi/Arduino/libraries/Entropy/Entropy.cpp:72:19: error: 'IRQ_LPTMR' was not declared in this scope
NVIC_ENABLE_IRQ(IRQ_LPTMR);
^
/home/alphi/Downloads/arduino-1.8.9-linux64/arduino-1.8.9/hardware/teensy/avr/cores/teensy4/imxrt.h:8296:52: note: in definition of macro 'NVIC_ENABLE_IRQ'
#define NVIC_ENABLE_IRQ(n) (*(&NVIC_ISER0 + ((n) >> 5)) = (1 << ((n) & 31)))
^
/home/alphi/Arduino/libraries/Entropy/Entropy.cpp: In function 'void lptmr_isr()':
/home/alphi/Arduino/libraries/Entropy/Entropy.cpp:336:3: error: 'LPTMR0_CSR' was not declared in this scope
LPTMR0_CSR = 0b10000100;
^
Multiple libraries were found for "Entropy.h"
Used: /home/alphi/Arduino/libraries/Entropy
Not used: /home/alphi/Downloads/arduino-1.8.9-linux64/arduino-1.8.9/hardware/teensy/avr/libraries/Entropy
Using library Entropy in folder: /home/alphi/Arduino/libraries/Entropy (legacy)
Error compiling for board Teensy 4.0.
It seems that the Entropy Library is not compatible with Teensy 4.0.
Is there a workarround to create random Numbers or can somebody help me to updated this library to work with Teensy 4.0 ???
Thx...