LPC5536 PMW register update issue

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC5536 PMW register update issue

1,404 Views
jimmyli
Contributor IV

Hi,

      We are developing a project by LPC3336, a question shown below.

      Hope you can help to check and fix.

     1>LPC5536 PMW0 SM0 configuration

attachment1_pwm config.png

 

      2>Question

           "Immediate"  can't take effect soon when set LDOK ( LDMOD is set to 1), we can't find the reason.

 

      Thanks very much.

 

Labels (1)
0 Kudos
10 Replies

1,250 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello,

I tested on my side, when set 

pwmConfig.reloadLogic = kPWM_ReloadImmediate;

The reload value can take effect immediately.

I used the project you send to me, and just change gpio on my side. Full speed run can not analysis it,

use breakpoint and step debug.

1) Set a breakpoint at 

 

2) After run at here, click step over:

Alice_Yang_2-1687846522352.png

 

Alice_Yang_1-1687846493367.png

 

3)Click Run, check signal:

Alice_Yang_3-1687846573998.png

Yellow: GPIO

Green: PWM.

 

Also you can change "pwmConfig.reloadLogic " to other configurations, observe result.

 

BR

Alice

 

 

 

 

0 Kudos

1,206 Views
明省徐
Contributor I

Hi,Alice_Yang:

    I test again in EVK board,but result is not except. result show in picture, Also use the project.

   

0 Kudos

1,245 Views
明省徐
Contributor I

Hello,Alice_Yang

  I followed your steps, but the results were not as expected and were the same as the pictures I uploaded when I asked questions.

The mcu I tested is LPC5536, Can you share what your MCU is?

 

0 Kudos

1,386 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @jimmyli 

1) Please check register SM0CTRL, whether set LDMOD to 1.

2)Test with SDK demo "PWM", default  configuration is 

/* Use full cycle reload */
pwmConfig.reloadLogic = kPWM_ReloadPwmFullCycle;

change it to " kPWM_ReloadImmediate", check whether  "Immediate"   take effect, also can compare the difference between two configurations.

 

BR

Alice

0 Kudos

1,363 Views
明省徐
Contributor I

Hi, Alice_Yang:

    I Test with SDK demo "PWM", default  configuration,change reloadLogic to kPWM_ReloadImmediate.

/* Use kPWM_ReloadImmediate reload */
pwmConfig.reloadLogic = kPWM_ReloadImmediate;

And check  LDMOD is 1.

But when i change pwm duty, the duty is not change Immediate.

 

My test code  is as follows:(pwm frequent is 10khz)

Spoiler
Config change:
pwmConfig.reloadLogic = kPWM_ReloadImmediate;
/* PWM A & PWM B form a complementary PWM pair */
pwmConfig.pairOperation = kPWM_ComplementaryPwmA;
pwmConfig.enableDebugMode = true;

infinite loop:

while (1U)
{
    /* Delay at least 100 PWM periods. */
    SDK_DelayAtLeastUs((1000000U / APP_DEFAULT_PWM_FREQUENCE) * 100, SDK_DEVICE_MAXIMUM_CPU_CLOCK_FREQUENCY);

    Test_IO_Val_Set(1);

    if(test_AC_duty == 100){
      test_AC_duty = 0;
      PWM_UpdatePwmDutycycle(BOARD_PWM_BASEADDR, kPWM_Module_0, kPWM_PwmA, kPWM_SignedCenterAligned, test_AC_duty);
      PWM_SetPwmLdok(BOARD_PWM_BASEADDR, kPWM_Control_Module_0, true);
    }
    else{
      test_AC_duty = 100;
      PWM_UpdatePwmDutycycle(BOARD_PWM_BASEADDR, kPWM_Module_0, kPWM_PwmA, kPWM_SignedCenterAligned, test_AC_duty);
      PWM_SetPwmLdok(BOARD_PWM_BASEADDR, kPWM_Control_Module_0, true);
    }

    Test_IO_Val_Set(0);

}


 

0 Kudos

1,308 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @明省徐 

 

Could you please send the whole project, thanks.

 

BR

Alice

0 Kudos

1,291 Views
明省徐
Contributor I

Hi, Alice_Yang:

    this is the project.

0 Kudos

1,319 Views
jimmyli
Contributor IV

Hi Alice,

     Per replyed by xu mingsheng,  I can't find another way to fix this problem.

     Can you help to check again ?

 

     This problem will impact the PWM out from LPC5536, and lead to the project be pending.

     Thanks very much.

0 Kudos

1,306 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @jimmyli 

What about the result picture on your side? Is the same with 明省徐 ?

 

BR

Alice

0 Kudos

1,380 Views
jimmyli
Contributor IV

Hi Alice,

      Thanks very much.

      I will try again.

0 Kudos