SimpleFOC Shield 2.0.4 Current Sense

Hi all, this is more of a FYI and an update to hopefully help someone else!
I’m running a STM32 NUCLEO-F411RE with an Aliexpress SimpleFOC Shield 2.0.4 working great in voltage mode but for the life of me couldn’t get the inline current sense working under FOC current mode! (All I got was erratic motor behavior, and or very loud PWM noise). It seemed so straight forward, and yet no luck. Even after reading all of the community posts on inverting phases, swapping A0 and A2 in the top setup line nothing seemed to work! If you are having trouble then I recommend putting in the (_NC) for phase C this seemed to do the trick for me and I just left the current sense alignment to do all the magic work it does, after this addition I couldn’t make it not work!

InlineCurrentSense current_sense  = InlineCurrentSense(0.01, 50, A0, A2, _NC);

It would be great to see if someone else has discovered the same thing, then update the webpage to reflect this.

Thanks again!

Hi Zerpoint, thanks for reporting it!

Have you tried the code from the dev branch of the library? There have been some bug-fixes related to the current sensing recently…

Hi Runger, good call, I just tried the dev branch with and without the _NC with no luck, same results as master. Happy to test again if you happen to be working on inline sense in the future.

I’m sorry to hear it.

Another suggestion that comes to mind is that you could use the Low-Side current sensing class instead. There is no reason the low side sensing class can’t be used also with inline sensors, and this class has a different way of using the ADCs. Perhaps this can help.

Other than this, I am out of ideas for the moment…