Hi,
I'm working with the imxrt117x and 'm trying to run a simple PWM on output PWM(A,2) with this code:
```
Hi Edwin, thx for helping me out!
no I had PWM2 configured.. however I discovered that when I turned off the debug mode the PWM was then working. But still, I do not get the frequency value that I wish.. didn't figure out why yet...
Thx,
Isaac
Hi @illy777,
Thanks for the clarification. what frequency are you expecting and what are you seeing? How are you measuring the results?
Hi I was expecting to get the frequency I configured, I wanted to have 10kHz... For the exact value, if thisis important, i should make another test.
I was measuring thrugh an oscilloscope with 200kHz band width, what should be enough for the measurement. I was measuring against ground.
Hi @illy777,
The function you should be debugging is "PWM_SetupPwm()", as this is where the PWM registers are set to a specific frequency and duty cycle. Are you seeing the correct values loaded here? Of not, what are the values you are seeing? Also, what is the source clock frequency you are using?
BR,
Edwin.
Hi @illy777,
I believe the issue lies on the pin that you are initializing.
Your code sets up Module FLEXPWM2, Sub-Module 2, channel A.
This, because you are using "BOARD_PWM_BASEADDR", which is defined as PWM1:
/* The PWM base address */
#define BOARD_PWM_BASEADDR PWM1
However, the pin you are using is for the FLEXPWM2 module, rather than FLEXPWM1. You can see its name makes reference to Module PWM2, Submodule 2, Channel A: "IOMUXC_GPIO_AD_28_FLEXPWM2_PWM2_A"
The pin you should set-up for the configuration you are using is GPIO_AD_04 (or GPIO_EMC_B1_27):
BR,
Edwin.