Measure input pulse measure with edge count

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

Measure input pulse measure with edge count

721 Views
elnino
Contributor I

I have configured eMios channel 4 of HW instance 0 as ICU_MODE_SIGNAL_MEASUREMENT.

I am able to read Period, duty with this configuration.  But I would like to measure edge/Pulse count as well. So, is it possible to get period and Edge count simultaneously using ICU_MODE_SIGNAL_MEASUREMENT? If not, please guide me to do the same.

0 Kudos
Reply
4 Replies

683 Views
elnino
Contributor I

Thanks for details. Do you have any example code "to route the external signal to be measured to a pin configured as trgmux_inX."

I am not aware of trgmux_inX. 

This is my pin configuration for my input PWM.

elnino_1-1744275049382.png

 

 

0 Kudos
Reply

628 Views
_Leo_
NXP TechSupport
NXP TechSupport

Hi again,

Please give me more time to give you a proper answer.

0 Kudos
Reply

590 Views
_Leo_
NXP TechSupport
NXP TechSupport

Hi again,

Please find attached project.

This example perform two eMIOS ICU modes, PEC (EMIOS_0_CH_5) and IPWM (EMIOS_0_CH_5), in the same pin (PTD2). It is archived routing the same PWM input signal to two eMIOS channels though TRGMUX (trgmux_in5).

The PWM signal is generated using the EMIOS_1_CH_0 (PTA0) in OPWMB mode and using EMIOS_CH_23 in MCB mode as time base.

_Leo__0-1744926700069.png

Please use S32DS 3.6, RTD 5.0.0, S32K3X4EVB-T172 (and connect PTA0 to PTD2).

If you need different SW and/or HW, you can create a new project, do manual config and code copy.

Note -> Although you are able to read period and duty cycle, please consider that IPWM measurements in attached project should be improved, meanwhile please refer to the following community posts:

https://community.nxp.com/t5/S32K-Knowledge-Base/Example-IP-S32K312-EMIO-PWM-Generation-amp-Duty-cap...

https://community.nxp.com/t5/S32K-Knowledge-Base/Example-IP-S32K312-EMIO-PWM-Generation-amp-Duty-cap...

Hope it helps you.

Have a nice day!

0 Kudos
Reply

699 Views
_Leo_
NXP TechSupport
NXP TechSupport

Hi,

Thank you so much for your interest in our products and for using our community.

Each eMIOS channel allows just one of the following ICU modes:

ICU_MODE_SIGNAL_EDGE_DETECT
ICU_MODE_EDGE_COUNTER
ICU_MODE_SIGNAL_MEASUREMENT
ICU_MODE_TIMESTAMP

And your seems that your application needs two ICU modes.

What comes to my mind is that you could route the external signal to be measured to a pin configured as trgmux_inX. And then, route its trgmux ouput to a two eMIOS channels. One performing ICU_MODE_SIGNAL_MEASUREMENT and the other one performing
ICU_MODE_EDGE_COUNTER.

Hope it helps you.

Have a nice day!

0 Kudos
Reply