Hello Team,
I want to generate the PWM for that I am referring to the example code as I mentioned in the subject but that example is not working on the board,
I followed the steps which are given to run the example on board.
let me know any configuration I need to do or is there any other example code is there that I can refer to for the PWM Generation,
Board: S32k148 EVAL
Thanks,
kallappa.
Solved! Go to Solution.
Hello @Senlent ,
Thanks a lot for you and @nxpcommunity great support,
it's done now I am able to get the PWM Signals,
one que is how to get the data from the exiting onboard potentiometer, as duty cycle input.
Regards,
Kallappa
Hi@Kallappa
Can you try to test the PWM output pins of the MCU, as shown in the figure below.
If you are using ftm_pwm_s32k148 example, please measure PTE21.
ftm_pwm_s32k142-PWM
There was a similar problem before.
If it still doesn't work, please let me know and I will test the example of S32K148EVB.
BR!
Jim.
Hello,
Thanks for your quick response,
Currently, I don't have the Oscilloscope to check the waveform but I checked on the multimeter it is showing some values like 348 while duty cycle uint16_t dutyCycle = 0xFFF; On pin .but as per the example DOC, the LED from the Board should glow right RED LED. it is not glowing.
I tested the ftm_pwm_s32k142 routine and it worked fine. The configuration steps of ftm_pwm_s32k148 and ftm_pwm_s32k142 are similar, there is nothing special. If you have an oscilloscope, the problem is easy to locate.
BR!
Jim.
I think this example works normally, maybe because the delay time is too short.
try this.
I think one parameter is missed in a function called UpdatePWMChannel
I used like below
while(1)
{
dutyCycle++;
if (dutyCycle >= 0x8000)
dutyCycle = 0;
FTM_DRV_UpdatePwmChannel(INST_FLEXTIMER1, 1U, FTM_PWM_UPDATE_IN_DUTY_CYCLE, dutyCycle, 0U, true);
delayCycles(0xFFFU);
}
But the problem is still the same.
the LED is not able to Glow.
Can you please once check at your side then it will be really helpful.
Once again thanks for this quick response.
regards,
Kallappa
Hi@Kallappa
I tested ftm_pwm_s32k148 and the example I just modified on S32K148EVB. Both worked normally. In the first example, the LED flashes, and the second example LED gradually turns on and then goes off.
Below are my IDE information。
S32 Design Studio for ARM:Version:2018,R1,
SDK:3.0
BR.
Jim.
ohh,
if possible can you please share the project?
Hi@Kallappa
This is the official routine, do I need to send it again?
yes please,
because this code is tested on the S32k148EVAL so i will check once on my board the same code.
Thanks, @Senlent ,
The issue is with a version of the SDK and the IDE version, now i am able to run the example.
I have one query, I saw this example is based on the Delay can we avoid it any how ?
Regards,
Kallappa
Hi@Kallappa
the parameter "dutyCycle" is used for changing PWM duty, so blocking delayCyclyes(0x2FFU) will not have special effects, but the brightness change of the LED is invisible to the naked eye.
BR!
Jim,
-------------------------------------------------------------------------------
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.
-------------------------------------------------------------------------------
Hello @Senlent ,
ok,
but I can see the PWM i.e Ton as per the Duty cycle but Toff is generated by the Delay right ?
if yes then how we can avoid the use delay function,
is there any way to generate the Toff time with the existing example.or timer-based we need to generate?
please let me know is there any way ?
thanks,
Kallappa
Hi@Kallappa
PWM Duty 0% - > dutyCycle = 0;
PWM Duty 100% -> dutyCycle = 0x8000;
nothing to do with Delay function.
you can try set dutyCycle = 0x4000,it means PWM Duty = 50%.
BR!
Jim,
Hello @Senlent ,
yes absolutely, but somehow the delay is creating the problem in the PWM wave, PFA for the same
1. I put the duty cycle 50 % i.e 0x4000 with delay the waveform is showing properly on pin 21.
2. I put the same duty cycle and the change the delay is affecting the waveform.
PFA for Both scenarios,
Hi@Kallappa
Ok, I understand what you mean, this does have an impact, because you update too fast. Under normal circumstances, when we change the PWM duty cycle, we need some delay time (I have not tested how much is needed, but I have tried to call it once in 1ms in the PID algorithm)。
You can try to use this function, this may update faster, but it should also require a little delay time.
This is all I know, if you still have questions about this, you can post a new questions in the community.
BR!
Jim,
ok , got it,
how to read the two duty cycles on two different pins for ex:
1: FTM PWM channel 1 PTE21 (50 % Duty Cycle)
2: FTM PWM channel 2 PTE22 (20 % Duty Cycle)
For Case two I added one more channel and I configured for a 20 % Duty Cycle,
and I check on the pin but I am not getting data, it will route the data to pin 22 via processor expert code generation processes, or do we need to route it explicitly? or I am only missing something ?
Hi@Kallappa
Step1.add channel 2
Step2.
BR!
Jim,
Hello @Senlent ,
Thanks a lot for you and @nxpcommunity great support,
it's done now I am able to get the PWM Signals,
one que is how to get the data from the exiting onboard potentiometer, as duty cycle input.
Regards,
Kallappa