Does the 55 pin(PIO0_4) of the LPC55S28JBD64 have PWM capability?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Does the 55 pin(PIO0_4) of the LPC55S28JBD64 have PWM capability?

跳至解决方案
489 次查看
JJ3
Contributor I

At present, I need three PWM signals to control RGB LED. The 53(PIO0_3), 55(PIO0_4) and 58(PIO0_19) pins of LPC55S28 have been selected as the PWM output signal pins. Is this method feasible?

I see the specification of the 55 pin only support input mode PWM, 58 pin only support output mode, these two pins can control RGB lights at the same time?

 

0 项奖励
回复
1 解答
430 次查看
Harry_Zhang
NXP Employee
NXP Employee

Hi @JJ3 

Your approach to using CTIMER0 to generate PWM signals on the specified pins should generally work. However, there are a few considerations to ensure proper operation and avoid conflicts:
1. Pin Multiplexing: Ensure the pins are correctly configured for their respective functions. Pin 55 (PIO0_4) needs to be set as GPIO if you’re synchronizing it manually with the CTIMER0 output on pin 60 (CTIMER0_MATCH0).
2. PWM Synchronization: Manually toggling GPIO based on CTIMER output can work, but there might be timing discrepancies. If exact synchronization is crucial, consider using hardware synchronization features or ensuring your toggling logic is fast and consistent.
3. PWM Configuration: Ensure each CTIMER match output is correctly configured to avoid conflicts. Verify the match register values and ensure the timer and GPIO setup do not interfere with each other.

Hope this will help you.

BR

Hang

在原帖中查看解决方案

0 项奖励
回复
3 回复数
462 次查看
Harry_Zhang
NXP Employee
NXP Employee

Hi @JJ3 

The specification you mentioned indicates that the 55th pin (PIO0_4) supports input mode PWM, and the 58th pin (PIO0_19) supports output mode PWM.

To control an RGB LED using PWM signals, you would typically need at least three pins with PWM output capabilities.

So these two pins can not control RGB lights at the same time.

Hope this will help you.

BR

Hang

0 项奖励
回复
455 次查看
JJ3
Contributor I
Hi Hang,
Now I'm trying to turn on at pin 60 (CTIMER0_MATCH0) as a PWM signal and then sync with GPIO output at pin 55 so I can use three PWM channels at the same time. Will the other two 53 pins (CTIMER0_MATCH1) and 58 pins (CTIMER0_MATCH2) affect the GPIO output of 55 pins? Here's my code for that


void ctimer0_init(void)
{
ctimer_config_t config;
uint32_t srcClock_Hz;
CLOCK_AttachClk(kFRO_HF_to_CTIMER0);

srcClock_Hz = CTIMER0_CLK_FREQ;
CTIMER_GetDefaultConfig(&config);
timerClock = srcClock_Hz / (config.prescale + 1);

CTIMER_Init(CTIMER0, &config);

CTIMER_RegisterCallBack(CTIMER0, &ctimer_callback[0], kCTIMER_SingleCallback); //kCTIMER_MultipleCallback kCTIMER_SingleCallback
/* Get the PWM period match value and pulse width match value of 2Khz PWM signal */
CTIMER_GetPwmPeriodValue(PWM_FRQ, dutyCycle, timerClock);
CTIMER_SetupPwmPeriod(CTIMER0, CTIMER0_MAT0_PWM_PERIOD_CHANNEL, CTIMER0_MAT0_OUT, g_pwmPeriod, g_pulsePeriod, true);
CTIMER_SetupPwmPeriod(CTIMER0, CTIMER0_MAT0_PWM_PERIOD_CHANNEL, CTIMER0_MAT1_OUT, g_pwmPeriod, g_pulsePeriod, true);
CTIMER_SetupPwmPeriod(CTIMER0, CTIMER0_MAT0_PWM_PERIOD_CHANNEL, CTIMER0_MAT2_OUT, g_pwmPeriod, g_pulsePeriod, true);
pwm_set_duty(global_bright_rgb);
CTIMER_StartTimer(CTIMER0);
}
if (CTIMER_GetOutputMatchStatus(CTIMER0, CTIMER0_MAT0_OUT))
{
bsp_led_off(LED_B);
}
else
{
bsp_led_on(LED_B);
}
void pwm_match_callback(uint32_t flags)
{
(void) flags;
if (times_ms >0)
{
times_ms--;
}
}
0 项奖励
回复
431 次查看
Harry_Zhang
NXP Employee
NXP Employee

Hi @JJ3 

Your approach to using CTIMER0 to generate PWM signals on the specified pins should generally work. However, there are a few considerations to ensure proper operation and avoid conflicts:
1. Pin Multiplexing: Ensure the pins are correctly configured for their respective functions. Pin 55 (PIO0_4) needs to be set as GPIO if you’re synchronizing it manually with the CTIMER0 output on pin 60 (CTIMER0_MATCH0).
2. PWM Synchronization: Manually toggling GPIO based on CTIMER output can work, but there might be timing discrepancies. If exact synchronization is crucial, consider using hardware synchronization features or ensuring your toggling logic is fast and consistent.
3. PWM Configuration: Ensure each CTIMER match output is correctly configured to avoid conflicts. Verify the match register values and ensure the timer and GPIO setup do not interfere with each other.

Hope this will help you.

BR

Hang

0 项奖励
回复