This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Unable to generate Comparator output on LM4F232H5QC

Hi All

I am unable to get the Comparator working on the new Stellaris ARM Cortex. The following code was used to enable the same. Is there any other setting that I need to take care? or is is pre-production bug?

Thanks in advance. 

//COMP Int
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_COMP0);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_COMP1);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_COMP2);
ROM_GPIOPinConfigure(GPIO_PF0_C0O);
ROM_GPIOPinConfigure(GPIO_PF1_C1O);
ROM_GPIOPinConfigure(GPIO_PF2_C2O);
ROM_GPIOPinTypeComparator(GPIO_PORTC_BASE, GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7);
ROM_GPIOPinTypeComparator(GPIO_PORTG_BASE, GPIO_PIN_6 | GPIO_PIN_7);
ROM_GPIOPinTypeComparator(GPIO_PORTF_BASE, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2);
ROM_ComparatorConfigure(COMP_BASE, 0, COMP_TRIG_NONE | COMP_INT_RISE | COMP_ASRCP_PIN | COMP_OUTPUT_NORMAL);
ROM_ComparatorConfigure(COMP_BASE, 1, COMP_TRIG_NONE | COMP_INT_RISE | COMP_ASRCP_PIN | COMP_OUTPUT_NORMAL);
ROM_ComparatorConfigure(COMP_BASE, 2, COMP_TRIG_NONE | COMP_INT_RISE | COMP_ASRCP_PIN | COMP_OUTPUT_NORMAL);
ROM_ComparatorIntEnable(COMP_BASE, 0);
ROM_ComparatorIntEnable(COMP_BASE, 1);
ROM_ComparatorIntEnable(COMP_BASE, 2);
ROM_IntEnable(INT_COMP0);
ROM_IntEnable(INT_COMP1);
ROM_IntEnable(INT_COMP2);

-regards

KLG

  • Indeed - PF0 on the new M4F defaults into a special mode - and must be "unlocked" to enable its re-purpose - as you seek.  Fear not - procedure is explained w/in the MCU's datasheet - wise always to "RTFM."  You should know that our group - several months back - chose this exact pin for its comparator function - my report here exceeds the theoretical - we've actually re-purposed PF0 and use it in its comparator output mode.

    Ours is a 64 pin M4F - am concerned by your code's use of three comparators - wouldn't it be safer/easier/faster to bring up one comparator at a time?  (especially during checkout/verification - we think so - KISS)

    As always - quicker scan thru most recent errata is wise - often this errata provides the most current info on your chip.