MCUXpresso IDE v11.4.1 [Build 6260] [2021-09-15]
SDK_2.x_MIMXRT1160-EVK: Version 2.1.0
EVK1160 PCB
I am currently trying to setup CMP3, which would be configured as so:
In my peripheral config tool I believe I have it setup correctly:
I also made sure to setup the pins:
/*
* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
BOARD_InitPins:
- options: {callFromInitBoot: 'true', coreID: cm7, enableClock: 'true'}
- pin_list:
- {pin_num: K17, peripheral: CMP3, signal: 'IN, 3', pin_signal: GPIO_AD_30}
- {pin_num: J17, peripheral: CMP3, signal: 'IN, 4', pin_signal: GPIO_AD_31}
- {pin_num: L16, peripheral: CMP3, signal: OUT, pin_signal: GPIO_AD_19, pull_up_down_config: Pull_Up}
* BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS ***********
*/
So at this point I expected the comparator to be functional. I have 3.3V at K17 (non-inverting input) and the DAC ref down as low as it will go. But I don't see L16 go high. Is there any additional setup needed for the comparator to work?
解決済! 解決策の投稿を見る。
So to actually see the change state of any ACMP output pin you need to set the output as a pullup or it wont work. Is there any documentation that would explain why that is? As that is very confusing and based on the GPIO pad configuration it shouldn't need to be pulled up.
So to actually see the change state of any ACMP output pin you need to set the output as a pullup or it wont work. Is there any documentation that would explain why that is? As that is very confusing and based on the GPIO pad configuration it shouldn't need to be pulled up.
Hi @User1956 ,
Sorry for my later reply because of Chinese Spring Festival.
Could you please tell me why you need to use R14 if you are using ACMP3? Do you mean the demo code?
If yes, the R14 is GPIO_AD_01, it is the ACMP1_IN2 pin.
As the SDK demo code is using:
#define DEMO_ACMP_MINUS_INPUT 2U
So, the demo code using r14:
But, to your ACMP3, you need to select the related input pin:
Now, your main issues is the ACMP3 no output in the output pin, right?
Please give me more details about your issues, then I will find time to help you to test it.
Best Regards,
Kerry
Hi @User1956 ,
Please run this code SDK code for the ACMP at first:
SDK_2_11_0_MIMXRT1160-EVK\boards\evkmimxrt1160\driver_examples\acmp\polling\cm7
Whether it works or not?
Then, use your own CFG code, in the main, also use the printf:
while (true)
{
GETCHAR();
statusFlags = ACMP_GetStatusFlags(DEMO_ACMP_BASEADDR);
/* Check the comparison result. */
if ((kACMP_OutputAssertEventFlag == (statusFlags & kACMP_OutputAssertEventFlag)))
{
PRINTF("The analog input is LOWER than DAC output\r\n");
}
else if ((kACMP_OutputAssertEventFlag != (statusFlags & kACMP_OutputAssertEventFlag)))
{
PRINTF("The analog input is HIGHER than DAC output\r\n");
}
else
{
/* The input state has no change. */
}
}
About the GPIO_AD_19 L16 , do you configure the pinmux?
This is the ALT1, you need to configure the pinmux, select the pin as the ACMP3_OUT
IOMUXC_SetPinMux(
IOMUXC_GPIO_AD_19_ACMP3_OUT,
0U);
Then test it again.
Wish it helps you!
Best Regards,
Kerry
Any additional thoughts to my follow up?
Hello Kerry,
So I tried the example that you recommended and yes, it seems to work as described. But it actually has me much more confused as pin R14 (pin for the voltage signal) is not linked to any CMP peripheral. In fact the pinmux does not even show that pin set as anything in the examples pinmux and yet it somehow works.
Also, yes, i enabled the output to GPIO_AD_19 L16.
So how does this example apply to what I am doing as I am using an actual comparator in the Processor and the example seems like it is just a logical comparator with no configuration setup?