CMP peripheral usage issues

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

CMP peripheral usage issues

Jump to solution
845 Views
Baraku
Contributor I

Hello,

I'm pretty new to this, so bear with me.
the following actions are from an example I have, and I'm trying to verify this against the datasheet, however I haven't found any resemblance .

I'm using mk10dn512M10 (this model does not appear in the catalog, which I'm having hard time finding any documentation for this model.

where I'm trying to use the CMP peripheral to compare between :
1. a pin on my MCU which connected to a battery
2. reference voltage from DAC

I configured the DAC to send output voltage on DAC output (3v) which is said to be connected to CMP1 input internally. 

using this template:

    // Configure the CMP1 input pin

    // Assuming the pin is on Port C, adjust accordingly for other ports

    PORTC_PCR[cmpInputPin] = PORT_PCR_MUX(7); // Set the pin as the CMP1 input

    // Configure CMP1

    CMP1_CR0 = CMP_CR0_FILTER_CNT(0x00); // Adjust filter count if needed

    CMP1_CR1 = CMP_CR1_EN_MASK | CMP_CR1_OPE_MASK | CMP_CR1_PMODE_MASK; // Enable the comparator, set high-speed mode

    CMP1_MUXCR = (CMP1_MUXCR & ~CMP_MUXCR_PSEL_MASK) | CMP_MUXCR_PSEL(cmpInputPin); // Set the CMP1 positive input to the specified pin

 

I tried to read the CMP with :

if (CMP1_SCR & CMP_SCR_COUT_MASK)


but I don't seem to have any change occuring at the CMP COUT.

I would appreciate help in understanding what is a general flow of the CMP peripheral as well.

 

thank you.

 

0 Kudos
Reply
1 Solution
791 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

I'm glad to hear it's resolved.
1. click Select Development Board
2. input MK10DN512VLQ10 at Search for Hardware
3. select MK10DN512xxx10
4. click Build MCUXpresso SDK v2.0.0

View solution in original post

3 Replies
827 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi 

mk10dn512M10 seems not a correct part number. Do you mean MK10DN512VLQ10 or MK10DN512ZVLQ10?

If you are using MK10DN512VLQ10 (no ‘Z’ character: PRODUCTION mask set), please download SDK_2_2_0_MK10DN512xxx10.zip. And you can test twrk60d100m_driver_examples_cmp_interrupt and twrk60d100m_driver_examples_cmp_polling examples.

If you are using MK10DN512ZVLQ10(‘Z’ character: INITIAL Production mask set), please refer to the answer in silicon revision for K20 family


Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

797 Views
Baraku
Contributor I

Hi Robin,

thank you for the assistance.

to be honest I managed to solve this one myself, and can use the CMP on my board.

I still would like to view the example you offered, however the link you sent (for the zip file) just leads me to the welcome screen ( https://mcuxpresso.nxp.com/en/welcome
can't seem to find the specific file you mentioned via the search either, it would just let me to select filters there, not sure where do I find the actual examples/files.

thanks again.

0 Kudos
Reply
792 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

I'm glad to hear it's resolved.
1. click Select Development Board
2. input MK10DN512VLQ10 at Search for Hardware
3. select MK10DN512xxx10
4. click Build MCUXpresso SDK v2.0.0