AnsweredAssumed Answered

STM32F3 Comparator

Question asked by amaini.rafik on Apr 30, 2014
Latest reply on May 3, 2014 by amaini.rafik
hello everyone 
I am a beginner in STM32F3 and I found a problem with the comparator. I have no compilation error but its not working. If anyone can help me I would be grateful

here is the code:
COMP_InitTypeDef  compp;
    GPIO_InitTypeDef  GPIO_Inite;
 
 
 
    RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE);
 
 
          GPIO_StructInit(&GPIO_Inite);
          GPIO_Inite.GPIO_Pin = GPIO_Pin_1;
          GPIO_Inite.GPIO_Mode = GPIO_Mode_AN;
 
          GPIO_Inite.GPIO_Speed = GPIO_Speed_50MHz; /* GPIO speed - has nothing to do with the timer timing */
          GPIO_Inite.GPIO_OType = GPIO_OType_PP; /* Push-pull */
          GPIO_Inite.GPIO_PuPd =  GPIO_PuPd_NOPULL; /* Setup pull-down resistors */
 
          GPIO_Init(GPIOA, &GPIO_Inite);
 
          GPIO_StructInit(&GPIO_Inite);
          GPIO_Inite.GPIO_Pin = GPIO_Pin_0;
          GPIO_Inite.GPIO_Mode = GPIO_Mode_AF;
          GPIO_Inite.GPIO_Speed = GPIO_Speed_50MHz; /* GPIO speed - has nothing to do with the timer timing */
          GPIO_Inite.GPIO_OType = GPIO_OType_PP; /* Push-pull */
          GPIO_Inite.GPIO_PuPd = GPIO_PuPd_NOPULL;; /* Setup pull-down resistors */
 
          GPIO_Init(GPIOA, &GPIO_Inite);
          GPIO_PinAFConfig(GPIOA,GPIO_PinSource0,GPIO_AF_2);
 
 
 
          RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
          COMP_DeInit(COMP_Selection_COMP1);
    compp.COMP_InvertingInput=COMP_InvertingInput_DAC1 ;
    compp.COMP_NonInvertingInput=COMP_NonInvertingInput_IO1  ;
    compp.COMP_Output=COMP_Output_None ;
    compp.COMP_BlankingSrce=COMP_BlankingSrce_None  ;
    compp.COMP_OutputPol=COMP_OutputPol_Inverted;
    compp.COMP_Hysteresis=COMP_Hysteresis_High;
    compp.COMP_Mode=COMP_Mode_HighSpeed;
 
    COMP_Init(COMP_Selection_COMP1,&compp);
    COMP_Cmd(COMP_Selection_COMP1, ENABLE);


thank you in advance :)

Outcomes