2014-04-27 11:07 PM
Hi,
I developed my project with stm32F0discovery and is OK. Now, I load my project to our board (final product) and I have a problem with timers and systick. For example: tim14 is set to operate 1 msec, instead I see that operates 6 msec by oscilloscope. I have the same situation with systick. I read that it's strange. Our board operates with HSI and hasn't HSE, instead when I debug with stm32F0discovery I have seen that HSE is set.Can you help me??? thanks2014-04-28 12:57 AM
For example: tim14 is set to operate 1 msec, instead I see that operates 6 msec by oscilloscope...
6 x 8 = 48 Obviously, your target board is running on the HSI clock, defaulting to 8 MHz, instead of the PLL-generated 48MHz. The system_stm32f0xx.c file usually contains the code to setup the system clock. In your case, it (incorrectly) assumes an external quartz (or the MCO from the STLink) as clock source. Either change your init code, or use a configuration tool to generate specific initialization code for your board. The CubeMX software package is supposed to contain such a tool.
2015-04-28 04:21 AM
Hello members,
I have a STM32F0xx-DISCOVERY board and I would like to get 1 microsec timer from systick. My code:void Config_Systick()
{
RCC_ClocksTypeDef RCC_Clocks;
RCC_GetClocksFreq(&RCC_Clocks);
SysTick_Config(RCC_Clocks.HCLK_Frequency/1000); // SysTick interrupt set 1ms
}
So this code gives me 1 millisecond interrupt. But I would like to get 1 microsec. I divided with 10000. It was good a got 100 microsec. After I divided with 100000. It was ok. i got 10 microsec interrupt. But whan I divided 1000000 for 1 microsecond interrupt the program did not run. Please help me to write a correct systick interrupt program for 1 microsec. Best regards,JS.2015-04-28 04:30 AM
Look, getting a 1 microsecond (1 MHz) interrupt simply isn't a practical goal, try to think of a better way to solve whatever problem you have.
If you need to place signals with this accuracy, use hardware, ie a TIM output If you need delays with microsecond, or sub microsecond, accuracy then use a free running TIM, or other 32-bit clock running at the processor frequency, and measure/delta against that.2015-04-28 04:44 AM
Dear Clive1,
Thank you for your quick answer. I am a beginner.... and I solved my 1 microsecond timing wiht softver. But I would like to set the MCU clock for 1 microsecond delay with systick wothout any softver. So I could not set the other clock. So it is why I would like to ask in this question. I thought to set clock simple.... bot not to me.Best regards,SJ2015-04-28 07:17 AM
Ok, but think about it in this context, an IRQ doing nothing (enter/return) is going to take several dozen machine cycles, you try to do that a million times a second, and pretty soon you've eaten practically all the available cycles the CPU has to offer.
You can program a TIM to tick at 1 MHz, or at the CPU rate.2015-04-28 12:01 PM
Dear Clive1,
Thank you for your suggest. I will try to use the TIM for exactly 1 microsecond timing as you wrote me.I would like to say that this forim is very helpful. Thaks very much for it.Best regards,JS.