Inline current sensing issue

Hi all,

I am trying go implement the inline current sensing feature to my velocity control setup to have better current loop performance.

I have a weird problem, which might due to some stupid mistake I made in the setup, but would really appreciate if some one could help me out.

I started by using the “velocity_control” example from the SimpleFOC library. The code works fine, motor moves by the commands.

Then I followed the steps on the website to implement current sensing. I made sure the resistor value, gain, ADC pins and initialisation orders of the drive / motor / current_sensing are correct. But once I compiled the code and uploaded it, nothing happened. Not even a serial print message.

Finally I realised that even if I use the original velocity_control example, with an extra line at the beginning:

InlineCurrentSense current_sense = InlineCurrentSense(0.01f, 50.0f, A0, A2);

Then the code will not run.

Here is my hardware setup:
MCU: Nucleo-G431RB
Drive: SimpleFOC Shield V2.0.4 (current shut 0.01 ohm and gain 50, current sensing pins are A0 and A2 according to the soldering pads on the back of the board)
Motor: GM4108
Feedback device: AS5048A via SPI

Did I miss something perhaps?