simplefoc / Arduino-FOC

Arduino FOC for BLDC and Stepper motors - Arduino Based Field Oriented Control Algorithm Library
https://docs.simplefoc.com
MIT License
2.03k stars 521 forks source link

STM32F1 Adc calibration #327

Closed Candas1 closed 11 months ago

Candas1 commented 11 months ago

Adding ADC calibration for STM32F1.

Before: RAM: [= ] 9.0% (used 4444 bytes from 49152 bytes) Flash: [=== ] 26.6% (used 69712 bytes from 262144 bytes)

offset_ia = 1.574506 offset_ib = 1.566360

After: RAM: [= ] 9.0% (used 4444 bytes from 49152 bytes) Flash: [=== ] 26.8% (used 70208 bytes from 262144 bytes)

offset_ia = 1.630240 offset_ib = 1.623240

Slightly increases memory usage because of the use of an additional hal function, but should make all the adc measurements closer to reality. The only risk I see are:

runger1101001 commented 11 months ago

I will merge it, the STM32 tests like it :-)