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

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

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

ソリューションへジャンプ
488件の閲覧回数
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 解決策
429件の閲覧回数
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 返答(返信)
461件の閲覧回数
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 件の賞賛
返信
454件の閲覧回数
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 件の賞賛
返信
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 件の賞賛
返信