This is a follow up to my previous question about scaling. After a day of looking into this I'm still confused, but I'm pretty sure it's scaling. I have a non-zero value for u_dq.d but a zero value for u_ab.alpha when in the align_start state and the PWM stays at 50%.
- phase_current_range_ma is 3125 (-3.125A=0V, 0A=2.5Vref, 3.125A=5V)
- dc_bus_voltage_range_mv is 25000 (0V=2.5Vref, 25V=5V)
- All ADCS are set to sign-extend.
- ASAC bit shift is set to shift left by 10.
When I go into align_start I set i_dq_desired.d to about 100mA. My current rail is 3.125A, the value I see for i_dq_desired is d=262136 i=0 (262136/(0x7FFFFF/3.125)=.098). So that is OK.
The value I see for u_dq is the same (262136). I'm confused about that, since looking in the eTPU code the comments for the PMSMVC_PID_OFF case say:
/* u_dq.d = i_dq_desired.d / 4; */
/* u_dq.q = i_dq_desired.q / 4; */
so I expect u_dq.d to be 262136/4=65534. Is the /4 to convert from 1.23 to 3.21 format?
In either case, I have a non-zero u_dq.d. In the PMSMVC_PID_OFF case the eTPU code goes directly to PMSMVC_INV_PARK_TRANSFORMATION. This does:
MC_TRAN_PARK_INV(u_ab, u_dq, sin_cos);
/* u_ab values contain quarters of the actual values (format 3.21) */
Since we're stationary MC_TRAN_PARK_INV should be a form of identity transform. The position is zero, theta = *p_qd_pc * encoder_scale is zero as well, and the output should be the input value times 1 in fract24 1.23 format. Is that correct? I assume the call converted it back to 3.21 format.
In desperation to see something happen I disabled reading the bus rail and set it to zero, assuming the ripple eliminator would see the values above the bus rail and return +/- 1. Sure enough, when I go into the align_start state it slams to a fixed position. So something is screwy with my units.