Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

Thread: Logging the CPU time on an interrupt automatically?

  1. #1
    Senior Member
    Join Date
    Oct 2019
    Posts
    178

    Logging the CPU time on an interrupt automatically?

    I have an application where an swarm of interrupts will hit a set of pins. The application is to communicate timing data over the air as finely in time as possible. I need to log the CPU time for the interrupts on each pin...but they are closely spaced in time and can hit during the same clock cycle...and I need to detect if that happens.

    It seemed plausible that there is a way to do this behind the scenes without ever running an ISR...instead the CPU time is simply saved to a memory location and the regular program can poll it. Does functionality like this exist?

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    24,766
    Closest thing might be the ARM DWT cycle counter. You can read it at any time to get a 32 bit count of the number of cycles since started. Not sure if that can be used to detect when 2 interrupts are pending at the same instance, but maybe you can get close?

  3. #3
    Senior Member
    Join Date
    May 2015
    Location
    USA
    Posts
    1,051
    Sounds to me like you want "input capture", where the hardware records the time when pins change.

  4. #4
    Senior Member
    Join Date
    Oct 2019
    Posts
    178
    Yes, the AMR DWT cycle counter is exactly what I'm looking to capture.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •