Skip to main content
Graduate II
April 27, 2024
Question

Nucleo board 64 F070 Crystal output Problem

  • April 27, 2024
  • 6 replies
  • 2150 views

Hi 'I am using STM32 Nulceo Board Nucleo-F070RB .

I tried some projects but the output of the project is not as expected ,shows some wrong calculation out .

So I checked everything ,And found out the Crystal frequancy is not correct .

I checked the Master Clock Output But here i am not getting the clock frequency ,

May i get the accurate frequency there ?

I  tried the internal HSI also But nothing gain 

 

When I select HSI is 8MHZ i am getting in MCO out is 1.724KHz  is it board problem ?

what wrong i am with ,   

please help me 

    This topic has been closed for replies.

    6 replies

    Super User
    April 27, 2024

    Hi,

    >And found out the Crystal frequancy is not correct

    How you know ? 

    +

    Show your clock tree , so i can see something ... !

    Graduate II
    April 27, 2024

    Screenshot 2024-04-27 at 9.09.37 PM.png

    see the clock tree I am checking on logic 2 logic analyzer 

    Super User
    April 27, 2024

    Ok, you want the cpu run at only 8 MHz ? why ?

    +

    >HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_8); // this pin is used as output signal

    This is just toggle the pin in software - has nothing to do with any timer !

     

    MCO is set to HSI - not pllclk .

    ------------

    so for 40MHz set clock tree:

    AScha3_0-1714234408649.png

    +

    To do some timer output, set any output active : or all ->

    AScha3_1-1714236333906.png

    here my setting, as example:

    AScha3_2-1714236390687.png

     

     

    Graduate II
    April 27, 2024

    When I try TIM1 to generate a siganl 

    Here Timer Clk is 8MHZ no prescalar 

    ARR is 1 

    so it will be the half of the signal will be timer output ie,4Mhz but here i am getting 11.08 khz 

    void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)

    { if (htim->Instance == TIM1)

    HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_8); // this pin is used as output signal 

     

    } }

     

    Screenshot 2024-04-27 at 9.26.11 PM.png

     

    at diffrent ARR value nothing happen 11.08khz is the out .is this cub ide bug ? or what is the problem ?

    Graduate II
    April 28, 2024

    Hi 

    I think Nuleao Board is faulty , when i just try a single channel PWM 

    TIM15->CCR1 = 50;

    HAL_TIM_PWM_Start(&htim15,TIM_CHANNEL_1);

    it dosent shows the 50 duty cycle square wave . 

    shows some of 30 % off and 70% On 

    :slightly_frowning_face:

    Super User
    April 28, 2024

    Hi,

    >TIM15->CCR1 = 50;

    and what you set : Counter Period (AutoReload Register)  ?

    Graduate II
    April 28, 2024

    I set the value of duty cycle to 50%

    Super User
    April 28, 2024

    There is no "xx%" setting.

    If you want 50% , at CCR1 = 50 , you have to set  the Counter Period  to 100 cycles (100 - 1  = 99 , in ARR register , Counter Period (AutoReload Register)).

    Did you ?

    Graduate II
    April 28, 2024

    The Counter Period decide is the full period of the timer output ? isnt it ?

     

    Super User
    April 28, 2024

    Right. ARR -> full period. (+ 1 , because period starts with "0" . )

    so set ARR 200 , CCRx 50 -> get 25% on, 75% off PWM . (ARR 199 , to be exact, to count 200 ticks )