cmp

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

cmp

1,365 次查看
GaneshBhagwat
Contributor IV

Hi N,

I'm working on a project using the S32K358 and encountering challenges related to zero-crossing detection at 85kHz. I’m currently utilizing the LPCMP module in both of the following modes:

  • CMP_IP_FUNCTIONALMODE_CONTINUOUS
  • CMP_IP_FUNCTIONALMODE_SAMPLED_FILTERED_INT_CLK (with a delay of ~1µs)

Additionally, I’ve implemented the windowing functionality with the same sampled/filtered mode. As per the reference manual, windowing is particularly recommended for high-frequency zero-crossing detection, like in my case at 85kHz. However, this requires a window signal input via TRGMUX.

Current Setup:

  • I’m using eMIOS to generate the window signal.
  • However, the PWM from eMIOS is independently running and not synchronized with the input zero-crossing signal.
  • This lack of synchronization between the PWM window and the zero-crossing signal is causing challenges in reliable detection.

I'm currently testing with a square wave input just to observe the behavior and delay in zero-crossing, but my final application involves a more dynamic signal.

 

Questions:

  1. How can I synchronize the window signal with the input zero-crossing?
    The reference manual states that windowing should be synchronized with the signal for accurate detection at high frequencies like 85kHz. Is there a recommended method to achieve this synchronization, particularly between eMIOS PWM and the input signal?
  2. Is there a way to introduce a controlled delay (or phase shift) in the zero-crossing signal?
    I’m looking to possibly lag the signal to adjust the crossing point. Is there any way to achieve this via hardware settings or using internal delay features?
  3. Can the LPCMP be configured to use different reference voltages for rising and falling edges?
    Essentially, I want to differentiate the threshold for positive and negative transitions if possible.

 

Additional Context:

  • Signal frequency: 85kHz
  • Reference voltage: Approx. 2.7V, configured via DAC (value 126)

I’d appreciate any guidance or suggestions on how to implement a more deterministic and synchronized zero-crossing detection mechanism, possibly with edge-specific control and window alignment.

Thanks in advance!

@PetrS, I’d really appreciate your input on this if you have a moment.

0 项奖励
回复
4 回复数

1,353 次查看
GaneshBhagwat
Contributor IV
'dynamic signal' this is Sin Wave of 85KHz. But sometime its shape is not exact sin,thus mentioned like this
0 项奖励
回复

1,248 次查看
_Leo_
NXP TechSupport
NXP TechSupport

Sorry for the delay. We currently have a backlog of cases and we try to resolve them as soon as possible.

I see your other post:

https://community.nxp.com/t5/S32K/Routing-Comparator-LPCMP-Output-to-eMIOS-IPWM-Mode-for-Frequency/m...

Do you still need help in this one? Or do we focus in the aforementioned?

0 项奖励
回复

1,223 次查看
GaneshBhagwat
Contributor IV

Yes, this is a different issue from the one I posted earlier. I would still like to resolve the question here, as I am specifically looking to get the LPCMP working for switching based on the current waveform. I kindly request your support on this matter.

0 项奖励
回复

1,112 次查看
_Leo_
NXP TechSupport
NXP TechSupport

Hi again,

It is easily to synchronize window signal with the input zero-crossing in motor control applications because PWM signals for actuation can use the same time base as PWM for window signal and thus it is known the zero-crossing event. But in your particular case, the dynamic signal is external.

Hardware workaround (offloading the CPU) which comes to my mind is the following:

_Leo__0-1746152600381.png

You need to route your dynamic signal to two pins, one for CMP_0 and the other one for cmp1.

CMP_0 will perform Continuous mode to transform sine wave into an square wave. Then such signal is routed to LCU (though TRGMUX) to perform phase shift in order to serves as window signal of CMP_1 (again though TRGMUX). Finally CMP_1 should perform Windowed mode.

For the part in green from the diagram above you can refer to the attached example.

Such example generates a PWM signal in PTB16 (emios_0_ch_4_g) (in scope yellow signal). Receive the PWM signal in PTD15 (cmp0_in1) and replicates it in PTE3 (cmp0_out) (green signal). Then such signal is routed thought TRGMUX to PTA1 (trgmux_out0) (blue signal) and also it is routed to LCU in PTD3 (lcu0_out0) (purple signal), where PWM signal is phase shifted.

Connections required: PTB16 -> PTD15

S32DS 3.6 + RTD 5.0.0 (S32K3X4EVB-T172)

_Leo__1-1746152625408.png

Regarding the different threshold for positive and negative transitions, it is not possible.

Hope it helps you.

Have a nice day!

0 项奖励
回复