I get wrong values using micros() after changing CPU speed with set_arm_clock on a T4.
this code gives me 1050 as printout
when commenting the clock change I get the correct value of 50000
Code:
#if defined(__IMXRT1062__)
extern "C" uint32_t set_arm_clock(uint32_t frequency);
#endif
void setup() {
// put your setup code here, to run once:
#if defined(__IMXRT1062__)
set_arm_clock(24000000); // comment here to get full speed
#endif
}
void loop() {
// put your main code here, to run repeatedly:
static uint32_t t0;
if(millis()>(t0+1000))
{
t0=millis();
uint32_t t1=micros();
delay(50);
Serial.println(micros()-t1);
}
}
this code gives me 1050 as printout
when commenting the clock change I get the correct value of 50000