STM32F3 Comparator 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 :)
my.st.com/.../Flat.aspx
hi I want to compare two analog signals, the first signal is the DAC, and what injected into InvertingInput and the second is a signal that I recovered from another circuit. I configured the PA0 pin as output comp1. So when I put a higher signal to DAC analog signal, I would have a 1 in the output comp1 (PA0) but I have nothing. I apologize for my English is not my native language.thank you
Could you decribe the not working part more clearly? What do you expect it to do, what input signal is being used, what output is expected?
View all questions in Keil forum