Hi Chris,
The ID process works great. your recommendations worked.Now, since my motor reaches only half of the rated speed, then starts making strange "squeaking" noises, I would like to understand a couple of things.
1. While running in CTRL_runOnLine_User , I see that the reference for Id is the following:
refValue = TRAJ_getIntValue(obj->trajHandle_Id) + CTRL_getId_ref_pu(handle);
can you please explain what does the trajectory is doing there and how it is related to controlling the Id current ? I saw that you're running some trajectory at the end of the ISR, in CTRL_setup.
2. Where do you run the trajectory for the speed (I tired searching for trajHandle_spd , but seems no one is updating it, only reading from it...)
3. What are you compensating for in CTRL_angleDelayComp ? why are you considering the sign in that function, if the angle is between 0..1 ?
4. I tried running the control with floating point enabled. I started form lab 2d, and actually observed different behavior than in lab 2c. In the transition between rated-flux state and Ls, there were some speed oscillations, which did not exist in lab 2c...
5. Trying for investigate further on the floating point, I saw that you're using optimization level 2. This thing I don't really like, since I'm not a compiler expert, and I expect my code to run as I write it... Changing the optimization to "none", suddenly I realized that the code is running much much slower, about half the speed (instead of about 20us, it takes about 45 us for the ISR), which is a lot ! I've tested this with a scope and GPIO toggling.
However, the speed oscillations in the ID process stopped !
Could it be that the optimization does something to floating point code ?