2366505_en-US

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

2366505_en-US

2366505_en-US

S32K3 measuring PWM duty cycle (eMIOS ICU IPWM) without blocking

Hello,

For context -
I am using an eMIOS ICU channel to measure a varying PWM duty cycle in IPWM mode. I am currently able to successfully measure duty cycle in a "blocking" manner.

My input transitions from 100% duty cycle (effectively no PWM) to a PWM signal of a given duty cycle which I need to measure.

My .mex configuration is as follows - 

Hareesh_S_0-1778951748752.png

Hareesh_S_1-1778951764813.png

My sample code is as follows -

Hareesh_S_2-1778952311888.png

While this works, I would prefer to start signal measurement once and periodically call Emios_Icu_Ip_GetDutyCycleValues(), without having to call Emios_Icu_Ip_StopSignalMeasurement(), to avoid being blocked before the measurement is complete. Alternatively, if there is a interrupt fired whenever a measurement has completed, that would work for me too.

I have tried only calling Emios_Icu_Ip_StartSignalMeasurement() initially and calling Emios_Icu_Ip_GetDutyCycleValues() periodically (every 1 second, while the PWM frequency is 1kHz), but the data is inaccurate.

From my understanding, SAIC is better suited for varying PWM signals (which I believe fits my usecase), but I assume I could also use IPWM, with a delayed measurement reading. I do not mind if the returned result is slightly delayed or stale by few milliseconds as I am not expecting rapid changes in duty cycle, and the frequency will be constant.

If someone can clarify how I can achieve this using IPWM, or if I can only implement this via SAIC, that would be great.

Thanks 

 

Re: S32K3 measuring PWM duty cycle (eMIOS ICU IPWM) without blocking

Hello,

The issue you’re hitting is a known limitation of the eMIOS ICU IPWM mode on S32K3:
IPWM is inherently “measurement-window based”, not continuous, so reading it periodically without restarting/closing the measurement leads to stale or partially updated values.

IPWM is not designed for unsynchronized periodic polling
You must either:

  • use interrupt notification, or
  • restart measurement before reading, or
  • switch to SAIC for true non-blocking continuous measurement

Best regards,

Peter

タグ(1)
評価なし
バージョン履歴
最終更新日:
‎05-19-2026 04:35 AM
更新者: