KL03 Control PWM output directly with comparator

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

KL03 Control PWM output directly with comparator

1,522 Views
andrejnastran
Contributor II

Hello,

I'm using MKL03Z32VFK4 MCU. Is there way to control turn OFF/ON PWM signal (timer) directly with comparator output. The idea is to regulate boost DC DC converter and would be great if it works without CPU usage.

example: If voltage < 4V PWM turns ON and if voltage > 4V PWM turns OFF.

Is there way to set registers to connect comparator output to turn off timer/PWM if voltage is to high?

dc dc boost converter

Here is sample how I would like to set the MCU. Here is used PWM shut-down feature and you could use comparator output directly to shut down the PWM output.

STM32 PWM shut-down feature

Thanks for answers,

Andrej

0 Kudos
5 Replies

839 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Andrej Nastran,

    KL03 is the 3.3V chip, not the 4V chip, so it can't judge 4V directly.

   But KL03 have the CMP component, it is the comparator, and can according input voltage determined the output signal.

  I think, at first, you need to use the resistor to divider the 4V to the range of 3.3V, then use the KL03's CMP to realize your function, it's not complicate.

Wish it helps you!

Have a great day,
Kerry

 

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

0 Kudos

839 Views
andrejnastran
Contributor II

Thanks Kerry,

I know about resistor divider, there is no problem with HW. My main question is: Can I control PWM output to boost converter directly with comparator output or I must handle it with MCU (interrupts/loop etc..)

Since this happens million times per seconds it will use all cpu time.

Can comparator shutdown timer module / PWM output?

Is the correct way to set registers of TPMx_CONF[TRGSEL]  to CMP0 output?

Thanks :smileyhappy:

0 Kudos

839 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Andrej Nastran,

   If your input wave which already meet your PWM demand, then you just need to use the comparator to judge the voltage to output the High level or the Low level, then You don't need to control it in the MCU after you initialize the comparator, because this comparator it the hardware module in the MCU.

    But if you want to change the input wave, and need to do other things, you need to use the other MCU code, just depend on your application.

     Of course the comparator can shutdown the output, but you need to control the code.

    Do you still need to use TPM? If you use the TPM, it can out put the PWM directly, you don't need to use the CMP to generate the PWM by judging the input voltage level.  There are the different question, but from the boost topology, you can use the TPM send the PWM to the MOSFET directly, I don't know why you need to judge the 4V, then use the comparator.

Wish it helps you!

If you still have questions about it, please kindly let me know!


Have a great day,
Kerry

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

0 Kudos

839 Views
andrejnastran
Contributor II

Hi Kerry,


well, I think you misunderstood me. What are you saing is possile to use with buck converter (comparator only).


Here I must use TPM to generate like 200 kHz swiching frequency to increase voltage. Then I must use comparator to "check" the voltage when it reaches desired output voltage. If it rises to much, I should disable the TPM and then enable when falls again. So I have "stable" output voltage.

signals.png

Here is visible how comparator turn high and then PWM turns on to charge capacitor to 3,6 V. So we have pretty stable 3.6 V ouput.  If I do it with SW that consumes a lot of MCU time.

So there is no HW conection possible between comparator and TPM module?

I see that I could just trigger the TPM with comparator: with this register: TPMx_CONF[TRGSEL]  to CMP0  at page 34 KL03 reference

Thank you.

0 Kudos

839 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Nastran,

    CMP and TPM module have the internal connect, just like the table 2-10 in reference manual:

pastedImage_1.png

    It connect CMP0_OUT to the TPM input channel.


Have a great day,
Kerry

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

0 Kudos