Skip to main content
jim_jones188
Associate II
September 2, 2016
Question

STM32F0 Comparator Output issue

  • September 2, 2016
  • 5 replies
  • 1210 views
Posted on September 02, 2016 at 19:53

I am unable to get any output from the COMP1 comparator on an STM32F072RB on any pin other than PA0. The datasheet ''STM32F072x8 STM32F072xB'' states on pg 41 that COMP1_OUT should be available on pins PA0 PA6 and PA11 through the alternate function channels.

I have tried developing my own code writing directly to the registers with CMSIS, and also modifying the low level examples (Examples_LL) from the STM32CubeF0 for the STM32F072RB-Nucleo. Specifically the ''COMP_CompareGpioVsVrefInt_OutputGpio'' example.

Has anyone ran into this issue or does anyone know a fix?
    This topic has been closed for replies.

    5 replies

    Walid FTITI_O
    Visitor II
    September 5, 2016
    Posted on September 05, 2016 at 13:40

    Hi jones.jim.002,

    I have made a quick test on the Nucelo-F072 using the example that you mentionned. All COMP_OUT pins works well and the example is OK. Just ensure the following:

    * For case PA6 as COMP_OUT pin :

    - Replace all ''LL_GPIO_PIN_0'' with ''LL_GPIO_PIN_6''

    * For case PA11 as COMP_OUT pin :

    -Replace all ''LL_GPIO_PIN_0'' with ''LL_GPIO_PIN_11''

    - Replace fucntion ''LL_GPIO_SetAFPin_0_7'' with ''LL_GPIO_SetAFPin_8_15''

    -Hannibal-

    jim_jones188
    Associate II
    September 6, 2016
    Posted on September 06, 2016 at 18:10

    Thank you for the response Hannibal.

    In the example listed I changed line 143 to:

     ''LL_GPIO_SetPinOutputType(GPIOA, LL_GPIO_PIN_11, LL_GPIO_OUTPUT_PUSHPULL);'',

    line 146 to:

    ''LL_GPIO_SetPinSpeed(GPIOA, LL_GPIO_PIN_11, LL_GPIO_SPEED_FREQ_VERY_HIGH);'',

    line 149 to:

    ''LL_GPIO_SetPinMode(GPIOA, LL_GPIO_PIN_11, LL_GPIO_MODE_ALTERNATE);,

    and line 150 to:

    ''LL_GPIO_SetAFPin_8_15(GPIOA, LL_GPIO_PIN_11, LL_GPIO_AF_7);''

    It still doesn't work for me and as when I change everything back to pin 0 it works correctly. Either I am missing something, or I have defective/damaged silicon because I get nothing for either pin 6 or pin 11.

    Walid FTITI_O
    Visitor II
    September 6, 2016
    Posted on September 06, 2016 at 18:26

    Hi,

    Don't forget to make change inside the while(1) like folllowing :

    if (LL_GPIO_IsInputPinSet(GPIOA, LL_GPIO_PIN_11) != 0)
    {
    LED_On();
    }
    else
    {
    LED_Off();
    }

    -Hannibal-

    jim_jones188
    Associate II
    September 6, 2016
    Posted on September 06, 2016 at 20:29

    I tried to change this as well. It still doesn't seem to work.

    Walid FTITI_O
    Visitor II
    September 22, 2016
    Posted on September 22, 2016 at 12:23

    Hi jones.jim.002,

    Are you testing that on the ready-to-use example of STM32Cube. If yes, you surely hardware issue , try to change the NUCLEO by other one and see.

    -Hannibal-