So stm32duino’s analogRead funciton will by default return value in between 0 and 1024 so that is why the default resolution is 1024. So it is not a mistake
However you can modify this using the function analogReadResolution(12) and set it to 12 bit. If you do this make sure to change the _ADC_RESOLUTION as well.
i was referring to an old version of the library, since still i have to port all the stuff into the 2.2.2. In fact into the 2.2.2. there’s more configuration file and indeed the stm32f4 one, where it was fixed with 4096!
For me the 2.2.2 seems solve most of the instability problems that i have experienced with previous version (even if the voltage mode still cannot be usable at all with this setup).
a quick question! the iq current should be match more or less with the current supplied with my power supply?
Really useful and interesting! So I guess we can fall back to an H-bridge configuration because of the fact that in BLDC motors only two phases are fed at a time (instead of three in the case of PMSM). From there on we can see that we have a step down converter and so it becomes clear why the phasic current is higher than the driver input current.
So in the latest version of simplefoc where KV was introduced, should be possible to calculate the back EMF (or using the inductance value) and then from the a-b-c currents roughly estimate the driver input current?
however, I still don’t understand why by setting 20 gain for inline current sense like in the VESC firmware and listed on the datasheet, it gives me the wrong current value. It seems that both (VESC and SimpleFOC) have the same conversion factor and ADC resolution right now.
Is there any way to assign the gain value correctly?
Hi @luzz94 ,
This topic is probably too old for you. But just checking if you got this to work by chance? I happen to use the same current sense amplifier (AD8418) and struggling to get it running correctly. Lot of vibrations.