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

Thread: IDE with instruction time measuring (simulator mode)

  1. #1

    IDE with instruction time measuring (simulator mode)

    Hello! I'm new on Teensy and amazed with the hardware capacity!!
    My last project used a Microchip dsPIC33F coded with MikroC compiler.

    My project has demand for instruction time precision, i.e., i need to know exactly how many nano seconds a loop or a specific instruction will spend. If it is not according to my specification, then I need to insert NOPs in the code.

    With MikroC running in simulator mode I had option to check the elapsed time after each instruction line.

    I did not find this resource in Teensyduino.
    Is there some IDE for Teensy programming with these capability?

    Thank you very much!

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,328
    There isn't any simulator or static timing analysis tool provided with Teensyduino.

    You can get close to 1 cycle per NOP if you use FASTRUN on your function, so it gets placed in the single-cycle RAM. By default code goes into flash memory, where timing can vary due to cache misses.

    On Cortex-M4 timing is usually very predictable. But future ARM like Cortex-M7 will have branch prediction and superscaler (sometimes 2 instructions per clock) execution, so you can expect the number of cycles to change on future hardware.

    Even on M4, if DMA is active it can cause memory access to be delayed due to bus arbitration.

  3. #3
    Senior Member
    Join Date
    Oct 2012
    Location
    Portland OR
    Posts
    582
    On the simplest microcontrollers you can rely on instruction cycle timing, but Teensy 3 is already complicated enough (esp. with DMA, as Paul mentioned) that time-critical operations are best done with hardware peripherals like the various timers, for example https://www.pjrc.com/teensy/td_timin...rvalTimer.html and https://www.pjrc.com/teensy/td_libs_PulsePosition.html

  4. #4
    I could not imagine the influence of DMA as stated by Paul. It is very new for me.
    JBeale, for my needs the IntervalTimer seems to be enough.
    I`ll try to use that!

    Thank you all

Posting Permissions

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