cancel
Showing results for 
Search instead for 
Did you mean: 

How to use COMP on STM32g431c8T6? I found it not work correctly. The pol is noninverted When INP(1.6V)<INM(2v),the out is high. Only INP=0, the out is low.

立张.1
Associate II

void Comp1Init(void)

{

Comp1GpioInit();

RCC -> APB2ENR |= 1;  //20230506

/////////////////////////////////////////////////////////

COMP1 -> CSR |= 3 << 19;//TIM3 OC3 Banking of CSA p739

///////////////////////////////////////////////////////////

COMP1 -> CSR |= 0 << 8;//PA1 -> COMP1+//

///////////////////////////////////////////20230512

COMP1 -> CSR |= 4 << 4; //DAC3CH1-> COMP1-

 COMP1 -> CSR |= 3 << 2;//high speed

 COMP1 -> CSR |=1; //20230506 EN

}

0 REPLIES 0