Thanks! it was what i’ve done, by double check the port of the MCU that you suggest, i’ve found the error and was a typo here in the board_vesc_6.h that i’ve created:
Now the currentSense.driverAlign() give me sometimes 1 and another one 2 so still i don’t know why this behaviour but now i’m pretty sure about the configuration and i’ve putted as you suggest me, current_sense.skip_align = true;
The motor in the TorqueControlType::foc_current modality it’s very noisy, but i’m confident that is due to the PID values.
Going back to the good advice of @runger i’ve re-started from the velocity_openloop and in this modality by using the voltage limit instead of the resistance (even at very low current) the motor absorb a lot of current, by sending a target it can spin untill 10 rad/s (very low) and then it stuck.
Also this modality the motor sound little “strange” like a stepper motor and if i touch the flange i can feel some vibration. So i’m ever more convinced that this behavior is caracteristic of the SimpleFOC algorithms and not due to the PID tuning.
By a step forward, using the Hall sensors and the TorqueControlType::voltage i can reach very high speed and still the “strange” behaviour still hold. But apart that i’m really happy about the SimpleFOC library, very fast and easy implementations! it is suitable for the actual requirements of the project.
I think that maybe this strange behaviour appear with those type of motor (very low resistance and high torque and low pole pairs!) and i’m curious to test a smaller one to see if this theory it is true.
In fact i found lot of videos with small motors but no one with motors for skateboard like in VESC firmware.
I hope to have an oscilloscope as far as possible to undestand what is going on the three phases and if this jerk is related to some disturbances.