Cycle counter accuracy with PLL and HSE Clock for STM32L4
I am currently designing an application where I will read Sensors that can be integrated over time (e.g. Accelerometer, flow meter). As a first step I want to calculate whats the maximum error I could get by using the cycle counter as a unit of time.
For example I have a 24 MHZ external clock (50ppm) and use HSE that will give me a CPU frequency of 80 MHZ. When I use the DWT Cycle counter I can calculate execution time between functions for example.
Lets say that I have an integration function that is called approx each 1 millisecond, of course due to external factors (e.g. execution time of other functions,interrupts,etc) the function will not be called exactly each 1 millisecond. With the DWT Cycle counter I can accurately calculate the relative time the last time the integration function was called.
For thise case the unit of time for the cycle counter is 12,5 nanoseconds (1/80MHz). My question is how can I calculate the accuracy of these 12,5 nanoseconds due to error of the ppm stability and the STM32 PLL accuracy.
I basically want to calculate what is the minimum time I can integrate without losing accuracy or at least calculate whats the deviation I can get while integrating over time.
Thanks in advanced for passing by