ftm_pwm_s32k148 example not working on board

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

ftm_pwm_s32k148 example not working on board

ソリューションへジャンプ
7,822件の閲覧回数
Kallappa
Contributor III

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.

0 件の賞賛
返信
1 解決策
7,647件の閲覧回数
Kallappa
Contributor III

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 

元の投稿で解決策を見る

0 件の賞賛
返信
20 返答(返信)
7,807件の閲覧回数
Senlent
NXP TechSupport
NXP TechSupport

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

Senlent_0-1630564900615.png

Senlent_1-1630565054202.png

 

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.

 

0 件の賞賛
返信
7,803件の閲覧回数
Kallappa
Contributor III

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.

0 件の賞賛
返信
7,790件の閲覧回数
Senlent
NXP TechSupport
NXP TechSupport

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.

0 件の賞賛
返信
7,795件の閲覧回数
Senlent
NXP TechSupport
NXP TechSupport

Hi@Kallappa

I think this example works normally, maybe because the delay time is too short.

try this.

Senlent_0-1630567299965.png

 

 

0 件の賞賛
返信
7,785件の閲覧回数
Kallappa
Contributor III

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

0 件の賞賛
返信
7,778件の閲覧回数
Senlent
NXP TechSupport
NXP TechSupport

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.

 

0 件の賞賛
返信
7,772件の閲覧回数
Kallappa
Contributor III

ohh,
if possible can you please share the project?

0 件の賞賛
返信
7,768件の閲覧回数
Senlent
NXP TechSupport
NXP TechSupport

Hi@Kallappa

        This is the official routine, do I need to send it again?

Senlent_0-1630570280709.png

 

0 件の賞賛
返信
7,753件の閲覧回数
Kallappa
Contributor III

yes please,
because this code is tested on the S32k148EVAL so i will check once on my board the same code.

0 件の賞賛
返信
7,740件の閲覧回数
Senlent
NXP TechSupport
NXP TechSupport

Hi@Kallappa

     see the attachments.

BR!

     Jim.

0 件の賞賛
返信
7,734件の閲覧回数
Kallappa
Contributor III

Hello I try to open the project in my IDE but it is showing the error related to SDK PFA for the same,
I am really new to this things please let me know how should I proceed in this and how I can update my SDK to yours one ,


0 件の賞賛
返信
7,727件の閲覧回数
Kallappa
Contributor III

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

 

0 件の賞賛
返信
7,709件の閲覧回数
Senlent
NXP TechSupport
NXP TechSupport

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.
-------------------------------------------------------------------------------

0 件の賞賛
返信
7,698件の閲覧回数
Kallappa
Contributor III

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

0 件の賞賛
返信
7,683件の閲覧回数
Senlent
NXP TechSupport
NXP TechSupport

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,

0 件の賞賛
返信
7,678件の閲覧回数
Kallappa
Contributor III

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,

0 件の賞賛
返信
7,669件の閲覧回数
Senlent
NXP TechSupport
NXP TechSupport

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.

Senlent_0-1630907161781.png

This is all I know, if you still have questions about this, you can post a new questions in the community.

BR!

      Jim,

0 件の賞賛
返信
7,666件の閲覧回数
Kallappa
Contributor III

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 ?

0 件の賞賛
返信
7,660件の閲覧回数
Senlent
NXP TechSupport
NXP TechSupport

Hi@Kallappa

Step1.add channel 2

Senlent_0-1630913871158.png

Step2.

Senlent_1-1630913929855.png

BR!

       Jim,

 

0 件の賞賛
返信
7,648件の閲覧回数
Kallappa
Contributor III

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 

0 件の賞賛
返信