Timer and PWM are not running simultenoulsy in LPC845

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

Timer and PWM are not running simultenoulsy in LPC845

1,127 Views
angiey0017
Contributor III

Hi,

I'm using LPC845M301JBD64 MCU, and used Ctimer_match_interrupt sample code

to generate 1hz interrupt and works fine,

Now we need PWM that generates lower frequency say 1hz and should be varied,

so used the sample code of sctimer_16_bit counter and sctimer_multi_state_pwm,

but not able to generate lower frequency , getting in higher frequency in  khz only,

kindly suggest me to get the lower frequency in the above sample codes.

We can get the lower frequency using Ctimer_match sample code,

but we already using it for timer interrupt.

Since LPC845 as only one 32-bit timer, here I require 2 timer interrupt,

one for timer, and one for PWM both using interrupt, and should run simultaneously,

And is it possible to generate 2 PWM's with different frequency at the same time.?

Please clarify with the above queries.

Thank you

Labels (1)
4 Replies

972 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Angley,

Regarding your questions, do you need multiple timer interrupts with Hz level frequency or need both timer interrupt and PWM signals?

If you just need mutiple timer interrupts with Hz level frequency, you can use CTimer module to generate ONE interrupt, use MRT module to generate at most 4 interrupts with Hz level frequency. The MRT is simple to use.

If you do want to generate PWM signal with Hz level frequency, I think it is okay, but you have to use 32 bits counting mode rather than 16 bits counting code to generate Hz level PWM signals and use MRT or Ctimer to generate interrupts.

The SDK package has MRT examples and PWM examples.

Hope it can help you

BR

XiangJun Rong

0 Kudos

972 Views
angiey0017
Contributor III

Thanks for the response sir.

I need both timer interrupt and PWM signals,

Used 32 bit Ctimer for timer interrupt and getting 1hz frequency,

but for PWM require lower frequency from 0.5hz to 15hz,

so in 16bit sctimer PWM not able to get so less frequency..

On Tue, Jun 18, 2019 at 8:50 AM xiangjun.rong <admin@community.nxp.com>

0 Kudos

972 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

You have to use 32 bit counting mode by setting the UNIFY bit in SCT configuration register. Because you use frequency from 0.5Hz to 15Hz, if you use the SDK package for example the following function to set up period, it appears that you have to modify the function yourself, because 0.5Hz is a float rather than uint32_t.

BR

XiangJun rong

status_t SCTIMER_SetupPwm(SCT_Type *base,
                          const sctimer_pwm_signal_param_t *pwmParams,
                          sctimer_pwm_mode_t mode,
                          uint32_t pwmFreq_Hz,
                          uint32_t srcClock_Hz,
                          uint32_t *event)

972 Views
angiey0017
Contributor III

Ok thank you, will implement this and check again.

On Tue, Jun 18, 2019 at 1:16 PM xiangjun.rong <admin@community.nxp.com>

0 Kudos