Timing Delays in FTM Input Edge Capture and Periodic Interrupt Timer Implementation S32k144

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Timing Delays in FTM Input Edge Capture and Periodic Interrupt Timer Implementation S32k144

317 次查看
prasannak9488
Contributor I

I am working on a project involving a crank signal (36-2) and using the FTM Input Edge Capture block to detect the falling edges. The configuration is as follows:

  1. FTM Input Edge Capture Block:

    • Configured for falling edge detection.
    • Outputs a timestamp for each falling edge.
    • Triggers a function that counts the number of edges and resets back to 0 when needed.
  2. Periodic Interrupt Timer Block:

    • Configured with a period of 30 microseconds.
    • Triggers another function every 30 microseconds.
    • This function increments a counter, which is reset by the function triggered by the FTM Input Edge Capture block.

Issue:
As the complexity of the logic within the function triggered by the FTM Input Edge Capture block increases, the execution time for this function also increases. This results in a delay between the blue signal (input to the block) and the yellow signal (output of the command block).

Additionally, the function triggered by the 30-microsecond interrupt timer introduces further delay in the logic due to its execution time. This compounding delay is evident in the attached oscilloscope capture:

  • Channel 3 (Blue): Input signal to the FTM Input Edge Capture block.
  • Channel 1 (Yellow): Output of the function triggered by the FTM Input Edge Capture block.
  • Channel 4 (Pink): Delay caused by the interaction between the 30-microsecond timer and the FTM Input Edge Capture block.

Question:
How can I minimize or manage the execution delays caused by these interactions? Specifically:

  1. Is there an optimized way to handle the logic within the function triggered by the FTM Input Edge Capture block to reduce its execution time?
  2. Would offloading some of the calculations to a different task or interrupt level help mitigate these delays?
  3. Are there any best practices for using the Periodic Interrupt Timer and FTM Input Edge Capture blocks together to avoid cascading delays?
    Screenshot 2025-02-06 at 9.37.12 PM.pngScreenshot 2025-02-06 at 9.36.55 PM.pngScreenshot 2025-02-06 at 9.36.39 PM.pngScreenshot 2025-02-06 at 9.36.10 PM.png
0 项奖励
回复
0 回复数