cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G0 Output Compare formula (NUCLEO-G071RB)

Karan 123
Senior

Hi,

I have NUCLEO-G071RB board . How to calculate 1KHz frequency with STM32G071 Output compare ?

My System Clock frequency is 64 MHz .

0693W000007BXkMQAW.png 

0693W000007BXkWQAW.png 

--

Karan

20 REPLIES 20
  // GPIOx_MODER - 2 bits per pin
#define GPIO_Mode_In                         0x00  // GPIO Input Mode
#define GPIO_Mode_Out                        0x01  // GPIO Output Mode
#define GPIO_Mode_AlternateFunction          0x02  // GPIO Alternate function Mode
#define GPIO_Mode_AF                         GPIO_Mode_AlternateFunction
#define GPIO_Mode_Analog                     0x03  // GPIO Analog Mode
 
GPIOB->MODER =  (GPIOB->MODER & ~(0 
   | GPIO_MODER_MODE6
)) |  (0 
   | (GPIO_Mode_Out * GPIO_MODER_MODE6_0)
);