How to Generate a Single PWM Period and Stop (S32K312 eMIOS)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to Generate a Single PWM Period and Stop (S32K312 eMIOS)

793 Views
CCY_Yu
Contributor I

Hi, NXP: I am trying to generate the PWM using Emios pwm mode with S32K312. Is there any method could only generate one period and stop generated the pwm?

0 Kudos
Reply
7 Replies

627 Views
_Leo_
NXP TechSupport
NXP TechSupport

For single pulse with eMIOS there are two ways, using DAOC or OPWMB mode.

Please find attached projects.

In DAOC mode, pulse width will be defined by duty cycle and it will enter to the ISR once.

_Leo__0-1747342459223.png

In OPWMB mode, it will be necessary an extra GPIO output, pulse width will be defined by period and it will enter to the ISR twice.

_Leo__1-1747342469909.png

If you need continuous pulses, comment "#define Single_Pulse" line.

Please use S32DS 3.6 and RTD 5.0.0 with S32K31XEVB-Q100. If you need an different S32K3 derivative, you can create a new project, do manual config and code copy.

0 Kudos
Reply

611 Views
CCY_Yu
Contributor I

Hi, @_Leo_ :

Thank you for your previous feedback.

We observed that after calling Emios_Pwm_Ip_InitChannel(), the PWM pulse was successfully generated, and an interrupt event was triggered. However, it seems that the callback function subsequently disabled the interrupt notification.

We would like to understand the correct procedure for generating the PWM pulse again. Specifically:

Is it appropriate to call Emios_Pwm_Ip_InitChannel() again to re-trigger the pulse?

Or is there an alternative API that should be used to restart pulse generation and re-enable the interrupt?

We would appreciate your clarification on the recommended approach for re-generating the pulse after the initial trigger.

0 Kudos
Reply

564 Views
_Leo_
NXP TechSupport
NXP TechSupport

Please help us create a new post or ticket for this new request. Feel free to reference this post.

Thank you in advance for your understanding.

0 Kudos
Reply

706 Views
CCY_Yu
Contributor I

We are currently working with the S32K312, and would like to generate a single pulse using the eMIOS module in PWM mode, and then capture the generated pulse using ICU.

According to the eMIOS training material, it appears that DAOC mode (Dual Action Output Compare) can be used to generate a single pulse.

We would like to confirm:

  1. Is DAOC mode supported on the S32K312 platform?

  2. We attempted to configure DAOC mode, but the result was a repetitive (continuous) pulse, instead of a single-shot pulse.

    • Are there any specific tips or configuration requirements to ensure only one pulse is generated?

Our goal is to:

  • Generate one-time high-level output (e.g., 5ms pulse width)

  • Automatically return to low after the pulse

  • Avoid repeated waveform generation

Any guidance, example, or clarification would be greatly appreciated.

0 Kudos
Reply

756 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @CCY_Yu 

Could you please provide more details about the implementation you are ooking to achieve?

As your goal is to generate a single PWM period and then stop, in my opinion, using a timer would be a good option. This allows you to toggle a pin for a specific duration, representing one full PWM cycle and then automatically stop without further toggling. This approach is more suitable than continuous PWM generation when only a single pulse is needed.

 

BR, VaneB

0 Kudos
Reply

670 Views
CCY_Yu
Contributor I

Hi, @VaneB :

  Any update on this topic?

0 Kudos
Reply

648 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @CCY_Yu 

I was able to reproduce the behavior you described, and I am looking into the situation to better understand what is going on. I will keep you updated as I make progress.

0 Kudos
Reply