9 years, 10 months ago.

can you set a timer using nanoseconds?

can the timer be set to use nanoseconds

Question relating to:

Affordable and flexible platform to ease prototyping using a STM32F401RET6 microcontroller.
posted by sam white 06 May 2014

1 Answer

9 years, 10 months ago.

If you directly use the hardware I assume you can get timers to run at full clock speed (84MHz). Although I don't have the nucleo platform myself, on some platforms they only reach half the clock speed. But really nanosecond resolution? No.

For sure you should be using input capture pins with timers if you want such resolution (and then i mean sub-microsecond, you aren't going to reach nanosecond resolution with a microcontroller), and the mbed lib does not support that, so you have to program it yourself.

Erik...thanks for the reply...any recommendations on how to set a timer for 63.5us

posted by sam white 06 May 2014

Microseconds? Does it really need to be 63.5? If 64 or 63 is fine just use regular mbed timer libs. Otherwise you will need to dive in to the ST code files and datasheets to figure out how to manually set the timers. I don't have one, so can't help you with it.

posted by Erik - 06 May 2014