In RM48L952 foc project for the DRV8301 motor kit, foc period (T) is set as 0.00005in sys_main.h, which is then multiplied by 2490000 (vCNT_SCALE, not sure what it is but it seems it makes the pwm period 125 inside the het code and triggers the adc at half the period) to set the pwm periods. However, when I debug the code, rtiBenchmarkTime (the time it takes for the DRV_run function to run) shows as 0.00018 (about 18 us). Since the period, T, is used to estimate the speed too (speed_fr module), it needs to be very accurate, but it seems it is far off. I tried to set T as 0.0002 but the code didn't work. I think ADC conversion being complete triggers the DRV_run. Is there a way to use an accurate time difference, T, at the speed_fr module and also, is it possible to change the period and/or trigger the controller via an rti counter?
Thanks