MCPWM

ESP_morris
Posts: 290
Joined: Wed Sep 05, 2018 6:23 am

Re: MCPWM

Postby ESP_morris » Mon Jun 20, 2022 4:34 am

chenyananee wrote:
Sun Jun 19, 2022 9:35 am
i have saw that the mcpwm module can't perceive the DFS.
i need to call the function of esp_pm_lock_acquire(ESP_PM_APB_FREQ_MAX) when i use the mcpwm module, and need to call the function of esp_pm_lock_release(ESP_PM_APB_FREQ_MAX) when i stop the pwm.
is it right?
yes, the application can create a pm lock, and acquire/release the lock when we start/stop the mcpwm timer.

chenyananee
Posts: 30
Joined: Sun Mar 21, 2021 9:35 am

Re: MCPWM

Postby chenyananee » Mon Jun 20, 2022 5:45 am

another question about the capture, see the picture for more details.

1.
how can i fix this issue with picture 1
2.
and i don't know the means about the value 10000,10000000000, this is from the example code.
i want to calculate the frequence about the input signal. i need the max value of the timer count and the clock frequence.
Attachments
frq.png
frq.png (27.88 KiB) Viewed 2506 times
cap.png
cap.png (42.37 KiB) Viewed 2506 times

chenyananee
Posts: 30
Joined: Sun Mar 21, 2021 9:35 am

Re: MCPWM

Postby chenyananee » Mon Jun 20, 2022 7:44 am

when i call the api(current_cap_val = mcpwm_capture_signal_get_value(MCPWM_UNIT_0, MCPWM_SELECT_CAP0);) from the capture interrupt function, thie issue will appear by high frequence.

chenyananee
Posts: 30
Joined: Sun Mar 21, 2021 9:35 am

Re: MCPWM

Postby chenyananee » Tue Jun 21, 2022 7:26 am

i have find the reason of the interrupt error.
and i don't call the api from the flash this issue can be fixed.such like this picture ...

just for the calculation of the frequency, the input signal is 1kHz but we can see the result is 875 form the terminal log. so there is something wrong with this formula.
Attachments
cap fix.png
cap fix.png (38.89 KiB) Viewed 2466 times

chenyananee
Posts: 30
Joined: Sun Mar 21, 2021 9:35 am

Re: MCPWM

Postby chenyananee » Tue Jun 21, 2022 7:47 am

maybe we can close this issue.
Attachments
cap ok.png
cap ok.png (33.28 KiB) Viewed 2457 times

chenyananee
Posts: 30
Joined: Sun Mar 21, 2021 9:35 am

Re: MCPWM

Postby chenyananee » Tue Jun 21, 2022 9:45 am

clock is the apb clock,and there is no prescale.
so the input frequency is apb_clk/Δ.
test is ok for 1k,500Hz and so on.
Attachments
frequency.png
frequency.png (26.44 KiB) Viewed 2446 times

Who is online

Users browsing this forum: No registered users and 65 guests