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
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.
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:
3)Click Run, check signal:
Yellow: GPIO
Green: PWM.
Also you can change "pwmConfig.reloadLogic " to other configurations, observe result.
BR
Alice
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?
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
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)
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);
}
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.