Skip to main content
Associate III
October 8, 2025
Question

Can the STM32F103 perform a delay of 62 ns or 125 ns?

  • October 8, 2025
  • 5 replies
  • 486 views

Hi.
I'm not very familiar with STM32 yet.

Can STM32F103 delay up to 62ns or 125ns to raise GPIO and lower it again during that time interval?


Thank you :)

5 replies

gbm
Principal
October 8, 2025

No problem. Use TIMx hardware timer in PWM or one-pulse mode.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice
No_NameAuthor
Associate III
October 8, 2025

So, can the STM32F1 MCU do that without having to use the STM32G4 MCU, which has a higher clock speed?

gbm
Principal
October 8, 2025

The general-purpose timer of any STM32 can do it easily.

Software delays are impractical and non-reliable and as such should be avoided even if they are theoretically possible.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice
Ozone
Principal
October 8, 2025

This times correspond to 16MHz and 8MHz, which a F103 is surely capable to achieve with a timer.

However, you didn't tell us anything about the use case.
What is it used for, what accuracy is required, and what is the maximal allowed jitter ?

By the way, quartz oscillators are available with this frequency (16MHz), you could derive it directly from hardware.

No_NameAuthor
Associate III
October 8, 2025

So, using an additional 16 MHz oscillator will make it more precise?

 

Ozone
Principal
October 8, 2025

That depends.

Technical Moderator
October 8, 2025

Hello, @No_Name 
First, can you please specify the version of the product that you are using?
Based on the F103x8 and F103xB datasheet, the maximum frequency for GPIOs is set to 18 MHz. However, please note that some GPIOs have different maximum frequencies.

Gyessine

Gyessine_0-1759926253280.png

Gyessine_1-1759926387884.png

 

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
No_NameAuthor
Associate III
October 8, 2025

I am using an STM32F103C8T6 purchased from lcsc.com.

Andrew Neil
Super User
October 8, 2025

@No_Name wrote:

 STM32F103C8T6 purchased from lcsc.com.


Not an official Distributor - so beware of fakes.

List of Official Distributors here: https://www.st.com/content/st_com/en/contact-us.html

 

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
TDK
Super User
October 8, 2025

You can use a timer to do this, but you can't do this by directly controlling the GPIO. A timer can be set to give a pulse of any integer number of clock ticks.

"If you feel a post has answered your question, please click ""Accept as Solution""."
No_NameAuthor
Associate III
October 9, 2025

This is an example. I don't know how this can be correct and accurate. Screenshot 2025-10-09 110945.png