FRDMKL02Z configure synchronized PWM and ADC

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

FRDMKL02Z configure synchronized PWM and ADC

410 Views
albt
Contributor II

Hi everyone,

I'm new in the discussion forums, and of course I apologise in advance, in case I don't do it right.

 

First of all, I'm working with the FRDMKL02Z kit, and nowadays I'm using IAR as development tool.

I want to generate a PWM signal (100 Hz and 10% duty cycle), and I realised that there is a similar freescale example using the TPM module. This freescale example works fine with the preconfigured frequency of 120 Khz, but it does not work fine when the frequency is changed to 100 Hz (in this case a 555 Hz signal is sourced).

These are my questions:

  1. Is it possible to generate a 100 Hz (and 10% duty cycle) signal with this module? if yes, how could we configure it?
  2. Only one more thing, we would like to acquire a sensor signal only when the previous signal is high, do you have any suggestions? is it possible to synchronize the TPM signal with the ADC?

Thanks in advance.

Labels (1)
0 Kudos
1 Reply

248 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Andree,

1. Yes, it can generate a 100 Hz signal . which freescale example do you mentioned ?

If you install KDS IDE, you can create one PE project ,then you can easily configure the PWM frequency to 100hz :

pastedImage_0.png

2. About your this question "acquire a sensor signal only when the previous signal is high", do you want

capture the high signal ? You can use the capture mode of Timer:

pastedImage_1.png

You can also use one GPIO input interrupt function. If i misunderstand your meaning , please tell me .

About the synchronize the TPM signal with the ADC ,  how about in the TPM interrupt start the ADC .

Hope it helps


Have a great day,
Alice

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos