cancel
Showing results for 
Search instead for 
Did you mean: 

How to calculate Tim3 value for 192 KHz and 84MHz clock

Robmar
Senior III

Using Tim3 with 84MHz clock, and need an 192 KHz trigger, for 96 KHz the prescaler is 875-1, clearly half that is a fraction, the calculators mentioned on line no longer work, is there a solution?

6 REPLIES 6
AScha.3
Chief III

84M / 874 = 96,11 so...

84M / 437 = 192,22 - 0,1% from 192 . nobody can hear this , so whats the problem?

If you feel a post has answered your question, please click "Accept as Solution".

Which STM32?

No perfect soution for these numbers. You can dither, but it depends on application if that is acceptable.

If this is auto application, you should've started with a different crystal.

JW

LCE
Principal

Which STM32 are you using? Maybe you can do something with the PLL?

Or - also depending on the STM32 - use another input for timer clock / the extra I2S clock input.

Otherwise I agree to the above, especially: choose another crystal.

gbm
Lead III

Wrong question. The correct one should be: how to get 192 kHz on my microcontroller. The answer is simple - set the main clock to be a multiple of 192 kHz, like 72 MHz. (72000000 / 192000 = 375).

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice

Haha yes sure, if only life was so simple. ​Commercial applications use the lowest cost MCU because business is competitive, our application is real-time, so we can't afford to degrade performance that much, but thanks

gbm
Lead III

20% is not much. It doesn't look like a good practice to rely on just 20% performance difference in an application.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice