8 years, 5 months ago.

Nucleo F103 change frequency

Hi, how can i change the frequency to 72MHz (or to 48) to my STM32 nucleo F103? I have a project (function generator) and i must have output up to 200 kHz, so i am afraid any freq under 16 MHz don't work. Thank you very much.

2 Answers

8 years, 5 months ago.

The PWM can only generate digital signals with a varying frequency and duty cycle. You can use PWM to generate other waveforms by continuously modyfying the dutycycle and low-pass filtering the PWM output so that only the modulation remains. See here for an example.

Alternatively, you can use the analog output available on some mbed boards (note that the F103 does NOT have analog output pins, but only analog inputs), or you can use and external digital to analog converter (eg SPI interface) to create an analog output signal.

Accepted Answer
8 years, 5 months ago.

The basic frequency of the F103 is 64MHz. This is set in the HAL files in mbed. If you want to change this you need to include "mbed-src" instead of the mbed lib. There are a lot of posts on here about using mbed-src.

You should be able to generate this frequency using the PWM library as is. Have you tried using PWM?

I am begginer to the mbed and i don't know how the PWM can create the waveforms of sine, square and triangle.

Plus another problem, i can't use my analog pins as outputs...

posted by Ioannis Karaxalios 17 Nov 2015