Page 1 of 1

HSI Factory Calibration Value

Posted: Wed Jul 28, 2021 3:10 am
by hobbya
I normally upload codes via SWD but until recently when I attempted DFU uploading on STM32F4, I noticed the process was not reliable. I have 3 boards but not all of them could be recognized as ST bootloader. Even for the same board which was ok, the success rate was not 100%.

A quick search tells me the problem is due to the limitation of the HSI accuracy in deriving the HSE. ST application notes also recommend to use a lower HSE say 4 to 8MHz for better reliability. However most Blackpills come with 25MHz HSE which is embarrassing for those who prefer DFU uploading. Moreover the factory calibrated HSI is temperature dependent and will also drift after soldering.

The user is able to trim the HSI by adding an offset to the factory calibrated value but this is only possible after your code is loaded and running.

My question is: are we able to alter the factory calibrated value so that it achieves the expected accuracy upon reset?

Re: HSI Factory Calibration Value

Posted: Sat Jul 31, 2021 3:40 am
by hobbya
I used MCO to capture the HSI of my blackpill's and to my surprise:
HSI = 15.95MHz => DFU bootloader not recognized
HSI = 15.88MHz => DFU bootloader recognized

I am not going to mess with DFU bootloader further. I will always live with SWD uploading.

Re: HSI Factory Calibration Value

Posted: Sat Jul 31, 2021 6:08 pm
by dannyf
That level of sensitivity seemed extreme.

If you want you can play with the calibration register until mco has the right frequency. But then hsi is temperature sensitive.

I have used hsi for iart (to 19.2k) without much problem.