2024-04-27 07:24 AM - edited 2024-04-27 08:30 AM
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
2024-04-27 07:59 AM
Hi,
>And found out the Crystal frequancy is not correct
How you know ?
+
Show your clock tree , so i can see something ... !
2024-04-27 08:42 AM
see the clock tree I am checking on logic 2 logic analyzer
2024-04-27 09:01 AM - edited 2024-04-27 09:27 AM
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
} }
at diffrent ARR value nothing happen 11.08khz is the out .is this cub ide bug ? or what is the problem ?
2024-04-27 09:46 AM
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:
+
To do some timer output, set any output active : or all ->
here my setting, as example:
2024-04-27 09:16 PM
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:
2024-04-27 10:53 PM
Hi,
>TIM15->CCR1 = 50;
and what you set : Counter Period (AutoReload Register) ?
2024-04-27 11:08 PM
I set the value of duty cycle to 50%
2024-04-27 11:19 PM
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 ?
2024-04-27 11:35 PM - edited 2024-04-27 11:36 PM
The Counter Period decide is the full period of the timer output ? isnt it ?