Input PWM Duty cycle measurement Issue using S32K312 eMIOS SAIC mode

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

Input PWM Duty cycle measurement Issue using S32K312 eMIOS SAIC mode

677件の閲覧回数
CCY_Yu
Contributor I

Dear NXP Support Team,

I am currently working with the S32K312 and using the eMIOS ICU in SAIC mode to measure a PWM signal. However, I am observing inconsistent and inaccurate results in the measured duty cycle and period time.

System Setup:

  • PWM Output Pin: PTA12

    • Configured using eMIOS_0 channel 8 in OPWMB mode

  • ICU Input Pin: PTC11

    • Configured using eMIOS_1 channel 1 in SAIC (IPWM) mode

  • Connection: PTA12 (PWM output) is physically connected to PTC11 (ICU input)

Signal Characteristics:

  • PWM frequency: 1 Hz

  • Duty cycle: 5 ms high time

  • Verified by oscilloscope: waveform is stable and correct

🧭 Clock Configuration:

  • Core clock: 80 MHz

  • eMIOS global clock: divided by 160 → 0.5 MHz

  • OPWMB prescaler: ÷10 → Tick = 20 µs (50 kHz)

  • SAIC measurement also uses BUS_DIVERSE, with same tick = 20 µs

Observed Issue:

  • The expected measured values (based on 20 µs ticks) should be:

    • PeriodTime ≈ 50,000 ticks

    • ActiveTime ≈ 250 ticks (5 ms ÷ 20 µs)

  • However, most of the time we observe:

    • ActiveTime = 285

    • PeriodTime = 285 (unexpected, matches active time)

  • Occasionally:

    • ActiveTime = 285

    • PeriodTime = 50000 (correct)

This suggests that in most cases, the period time is not measured properly and may be overwritten or missed.

Request:

Could you please help us understand:

  1. How to correctly configure eMIOS ICU in SAIC mode to reliably measure both ActiveTime and PeriodTime for low-frequency PWM input?

  2. Are there specific timing or synchronization requirements between the OPWMB and SAIC channels?

  3. Is there any known issue or workaround for measuring low-frequency PWM (e.g., 1 Hz) using this setup?

Attached below is the scope snapshot and software configuration if needed.

Thank you for your support.

Here is the detailed configuration:
*
* Connect PTC12 (PWM) to PTC11 (SAIC)
* PWM signal generated by EMIOS_0_ch8 (in OPWMB mode) is measured by EMIOS_1_ch_0 (SAIC mode).
*
* EMIOS_0 global global clock (core clock = 80MHz) prescaled in EMIOS_Mcl driver (/160) = 0.5MHz.
*
* Internal BUS generated by EMIOS_0_ch_8
* Tick = 20us (0.5MHz global clock prescaled by 10 = 50kHz)
*
* PWM (OPWMB), EMIOS_0_ch_8, PTA12
* Tick = 20us (0.5MHz global clock prescaled by 10 = 50kHz)
*
* IC (IPWM), EMIOS_1_ch_0, PTC11
* Clocked by Internal BUS (Diverse)
* Tick = 20us

CCY_Yu_1-1746502273037.png

 

0 件の賞賛
返信
3 返答(返信)

647件の閲覧回数
CCY_Yu
Contributor I

This feature was developed based on an ongoing customer project.
Due to company policy, I am unable to provide the full source code.

However, would it be helpful if I share the S32K MEX configuration file for your review?

0 件の賞賛
返信

644件の閲覧回数
Senlent
NXP TechSupport
NXP TechSupport

Hi@CCY_Yu

It's okay, I can make a similar demo, but it will take me some time.

Aslo, please tell me the RTD version you're using.

0 件の賞賛
返信

660件の閲覧回数
Senlent
NXP TechSupport
NXP TechSupport

Hi@CCY_Yu

The description of the problem is very detailed.

Can you provide your test project so that I can help you find the cause of the problem?

0 件の賞賛
返信