Does the ULP have a fixed execution frequency?
Posted: Fri Jan 15, 2021 9:06 pm
From my testing it seems that when you setup the ULP via ulp_set_wakeup_period, and run the ULPs program, it essentially works like a loop with a delay with the length being the period you set. This means that if you, for example, set a period of 100ms, the actual execution time for each loop will be 100.13ms (130us is roughly the execution time I measured for my ULP code). Section 31.5 of the ESP32 Technical reference seems to also describe this the same way.
Of course the reason you don't want this, is that over 100s or 1000s of cycles, you accumulate quite a large delay - severity depending on the clock cycle. 10ms wakeup cycles giving me roughly 1.8% or 18000ppm drift.
On the MCU, you'd use vTaskDelayUntil instead of vTaskDelay to solve this.. I guess the ULP just can't be this simple.
Essentially my questions are:
- are my observations correct?
- is there something I can do about this?
For example, is there a way to read the RTC_TIME registers at the very beginning, then reading them at the very end of the program, and using the difference to alter the ULPs sleep timer? - and also accounting for the fixed number of cycles we spend doing this of course.
According to the documentation, and technical reference, you can only
Of course the reason you don't want this, is that over 100s or 1000s of cycles, you accumulate quite a large delay - severity depending on the clock cycle. 10ms wakeup cycles giving me roughly 1.8% or 18000ppm drift.
On the MCU, you'd use vTaskDelayUntil instead of vTaskDelay to solve this.. I guess the ULP just can't be this simple.
Essentially my questions are:
- are my observations correct?
- is there something I can do about this?
For example, is there a way to read the RTC_TIME registers at the very beginning, then reading them at the very end of the program, and using the difference to alter the ULPs sleep timer? - and also accounting for the fixed number of cycles we spend doing this of course.
According to the documentation, and technical reference, you can only
So I'm a bit sceptical about the feasibility of this - this is why I came here to ask, instead of spending hours digging through the documentation, dumping and writing to registers, etc.select one of theSENS_ULP_CP_SLEEP_CYCn_REG registers that contain the expiration period