Skip to main content
MHelg.1
Associate II
January 22, 2021
Question

Hi. I have a STM32F3Discovery card. I use STM32CubeIDE. Clock 36MHz, Prescale 3600, Counter Period 1000 and **** 500. How come that i get a 10Hz, 3.14V and 100ms signal on my oscilloscope?

  • January 22, 2021
  • 2 replies
  • 853 views

..

This topic has been closed for replies.

2 replies

Tesla DeLorean
Guru
January 22, 2021

I don't really understand the question

(36000000 / 3600) / 1000 = 10 ?

Prescaler = 3600-1

Period = 1000-1

Duty = 500

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
MHelg.1
MHelg.1Author
Associate II
January 23, 2021

Hi.

Sorry, the question was not so clear.

From PA15 on my card i want to generate a 50Hz 20ms PWM signal. I set it up using STM32CubeIDE.

HCLK = 36MHz. And i have calculated using this formula:

Fpwm = Fclk / (ARR+1)(PSC+1) ==> 50Hz = 36*10^6 / (65535+1)(PSC+1) ==> PSC = 10

If i then set Prescaler = 10-1, Period = 1000-1 and Duty = 500

According to your calculation that will give me (36*10^6/10) / 1000 = 3600 Hz and not the 50Hz i wanted?

waclawek.jan
Super User
January 24, 2021

This is the drawback of using "libraries" and clicking environment, they use different terminology than the Reference Manual, causing confusion.

ARR is the register into which goes parameter you call Period.

JW