2011-04-29 01:43 PM
Frequency Divider with TIM3 and 50% duty cycle
2011-05-17 05:33 AM
For an external source on TIM3 check the TIM3_ETR (PD2) pin, configuring external clock source mode 2.
You'd have to look at RM0008, and see if you can trace your way through the clock paths and settings to get it into the CK_PSC. You might be able to get it to clock on both edges.2011-05-17 05:33 AM
You could run the STM32 from your 15 MHz external oscillator instead of the 8 MHz typical HSE. I honestly haven't thought about if you can use an external source as a timebase to the counter, only looked at measuring external frequencies.
PLL x4, 15 * 4 = 60 MHz CPU (75 not likely viable, 67.5 might be depending on your prescaler/period, ie Prescaler = 0, Period = (N * 4.5) - 1) Prescaler, Period and Pulse are 16-bit Prescaler = 4 - 1; // Div 4 (ie get back to 15 MHz from the PLL clock) Period = N - 1; 50% Duty PWM, Pulse = (Period + 1) / 2 or N / 22011-05-17 05:33 AM
I was considering clocking the STM32 with the frequency I need but I am not sure of its impact on other operations. Also, I have not determined the exact frequency I need yet (15MHZ was just an example) but I know it will not be an interger fraction of 72MHZ. I thought that clock dviding was a standard application for a microcontroller as it is referenced in many spec sheets (like the Hitex STM32 Insiders Guide section 5.1.4.1). But I have not found an code examples.
2011-05-17 05:33 AM
You can use anything from 4-16 MHz to suit your needs, and then set up the PLL to get you as close to 72 MHz, or whatever frequency works for you. The peripherals really don't care, the baud rate on the serial port has a fractional divider so you can get fairly low % error figures. In fact there are crystals that get you to lower errors. Classically the use of video rate crystals NTSC/PAL target specific markets.
Set the flash wait states based on frequency 0 for 0-24 MHz, 1 for 24-48 MHz, and 2 for 48-72 MHz One area of grief would be USB or CAN, which have very specific requirements. SPI is synchronous, so anything lower that the attached parts rated speed should be fine.2011-05-17 05:33 AM
I think the USB will give me problems if I clock the microcontroller with a specific frequency. The only settings for the USB clock in the software are the system clock running at 48MHz or system at 72MHz / 1.5 for 48 MHz. I suppose I could use another microcontroller just for the clock but this seems like overkill. Or perhaps a DDS with a quare wave output.