1883220_en-US

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

1883220_en-US

1883220_en-US

The K344 uses polling to capture PWM duty cycles (emphasis: no interruptions)

I want to use 344MCU to capture a way of PWM duty cycle, it seems that only with interrupts + SAIC mode to achieve duty cycle capture, but I can not use interrupts. I figured out if I could configure two pins, one pin to capture the pulse width (IPWM mode) , the other pin to capture the pulse frequency (IPM mode) , then connect the two pins together and then connect the PWM waveform to be captured, ah, with the pulse width and pulse frequency to get the duty cycle.


What I don't understand is that if I connect the two pins of the MCU together, will the two pins interfere with each other while capturing the PWM signal?

Re: The K344 uses polling to capture PWM duty cycles (emphasis: no interruptions)

Sorry, I just noticed the message now. Here is the program provided by technical support, but it should still be the interrupt capture PWM duty cycle method. The actual implementation using polling can be seen in my solution below, which has been verified.

Re: The K344 uses polling to capture PWM duty cycles (emphasis: no interruptions)
I tested the example, found that the PWM cycle and duty cycle can be obtained under interruption conditions.
Afterwards, I regenerated the code and removed the interrupt enable and interrupt interface. In non interrupt situations, both the cycle and duty cycle were returned as 0.
In addition, I use IPWM and IPM to capture a PWM signal (two pins). IPWM obtains a high level, IPM obtains a cycle, and the duty cycle can be obtained without any interruption.I think this is the only way to obtain the PWM duty cycle without any interruption. Here is my approach:
1.Pin settings:
jiafeimao_0-1718154788174.png

2.Emios_Mcl_Ip:

jiafeimao_1-1718154899157.png

3.Emios_Icu:

jiafeimao_2-1718154991603.pngjiafeimao_3-1718155012661.pngjiafeimao_4-1718155035252.png
jiafeimao_5-1718155052081.png

4.demo init ipwm and ipm:

jiafeimao_6-1718155165895.png

5.demo get duty:

jiafeimao_9-1718155383270.png




Re: The K344 uses polling to capture PWM duty cycles (emphasis: no interruptions)

Hi

Have you already referred to S32K344_Example_Emios_Icu_IPWM_measurement_DS34_RTD_100_v2

If you want to use polling method instead of interrupt method, please poll the status via Emios_Icu_Ip_GetInputState before calling Emios_Icu_Ip_GetDutyCycleValues.

Since I don't know the S32K3 RTD version you are using, I sent you the S32K344_Example_Emios_Icu_IPWM_measurement_S32DS35_RTD400.zip through private message. It is recommended to modify it to the polling mode based on project. Sorry, I haven't had time to test the polling method for you because I have been dealing with a lot of cases recently. If you still can't implement it after the modification, please let me know.


Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

タグ(1)
評価なし
バージョン履歴
最終更新日:
‎11-21-2025 02:04 PM
更新者: