Resolution of port GET RUN TIME COUNTER VALUE can cause overflow in run-time stats counters

@richard-damon I’ve spend the entire evening figuring out what the hell was causing this weird behavior. Also, my math for calculating the timer didn’t add up.

After hours, I found out exactly what you already pointed out…! I cleared the interrupt at the end of the interrupt routine, instead of at the beginning. When I finally found the root cause, and captured new data from saleae I thought lets share one more screenshot. Then I read that you already pointed out where the potential bug could be. Ouch. Wasted some time. Learned a lot though…

Things are starting to make sense now.

So one more time: thanks a lot for all the advice/input/insights! I learned a lot.

  • Ditched the pointless reset of the task counter
  • Used the configRUN_TIME_COUNTER_TYPE and defined it as unsigned long lone
  • Learned in general that interrupts are much more expensive then I thought they were
  • Fixed a horrible bug in the interrupt handler, which caused it to interrupt twice

I’m impressed :slight_smile: