Reply by Jim Webb February 19, 20092009-02-19
Hi Chirag,
Of course you are right about dividing the encoder count by pole pairs not poles, my mistake.
Our diagram is based closely on the TI reference. Just today we have run the VisSim PMSM diagram on an 8 pole PMSM motor (100 watt Tamagawa) on the F2808 with a DMC 550 inverter and there is exact agreement between driving ramp and encoder, and close agreement with a Sliding Mode Observer position estimator driven by phase current measurements and PWM voltage.
I have enclosed a screen shot to show better. We are using monitor buffers to acquire encoder, ramp, SMO Pos, and phase current at the 20 kHz sample rate. The buffers are plotted in a digital scope in the VisSim environment as shown in the screen shot.

The eQEP hardware can reset the encoder count on index pulse, which is how we have configured it. That is why it is synced to the driving ramp so well.
VisSim will use the CCS compiler to compile from the VisSim environment, and you can download to RAM directly from VisSim. You can also burn to flash from CCS if you want to. VisSim gives you a compile dialog option to choose between targeting RAM and flash.
Can you send a screen shot of the encoder wave form you are seeing that is incorrect?

_____________________________________
Reply by ruim...@yahoo.com February 18, 20092009-02-18
Hi,

I used the project BLDC Motor Control (PMSM3_4) of Texas Instruments and i had the same problems with incremental encoder when i selected a Level 3.
I made same tests that if the encoder reads and so on. But i verified the registers that the value keeping increase and didn´t reset the value for 0.
In my case, the resolution of encoder (Line encoder) is 500 and when it turn one revolution of shaft (360 mechanical degress), the DSP count 2000 impulses = Chanel A (500 *2) + Channel B (500*2).
To determine the electric angle of the rotor, i need know the position of shaft and number of poles. The position of shaft is determined by 3 signals: Channel A, Channel B and Index QEP(1 impulse per revolution).
I solved my problem when i found that my encoder have only 2 signals Channel A and Channel B.

I don´t know if i explained well.
If not, just saying.

Regards,
Ruimac
Hi, I am trying to run an incremental encoder based motor from F2812 using PMSM3_4.(reference code). I am able to run the motor upto build level 3. But when I am trying to match the encoder angle against the ramp generated angle, its not matching. but i am moving the shaft by hand and reading the angle, then i get correct angle.that means whenever i am trying to read angle in 20KHz ISR for PWM generation, i found a sudden dip in measured angle, if i watch it on CCS graph window. Has anybody worked with similar kind of setup? can anybody help me out?
>
>_____________________________________

_____________________________________
Reply by kvai...@gmail.com February 17, 20092009-02-17
thanx for the feedback. i agree there is difference between encoder angle and electrical angle.we can get electrical angle by multiplying mechanical angle by no. of pole pairs (not poles.). if you go through sample code by TI, there are build levels. upto build level 3, ramp generated angle is used and in level 3, regulation of Id and Iq axis currents is done. i am done upto this stage. I build level 4, we are comparing angle generated by ramp against the actual electrical angle. both should match.Rightnow there is no question of home referencing. so i am basically ignoring index pulse, and hence no offset has been added in the timer counts. I have got 1024 line encoder, so my counter resets afetr 4096. if i am moving the shaft by hand, i am able to read the electrical angle properly as i mentioned earlier. That time ISR of 20KHz is not in picture. So i basically wanted to confirm,whether somebody has worked on similar kind of setup.
also i am trying on vsim as suggested by you. but it will take some time to get used to vsim. can i compile the code generated by vsim in CCS and burn it in DSP? or vsim can compile the code of its own?

_____________________________________
Reply by Jim Webb February 16, 20092009-02-16
Hi Chirag,
There is a difference between encoder angle and electrical angle. Your encoder will go from 0 to max counts for 1 full rotation of the shaft.
But one full ramp sweep of the commanded angle results in moving one pole. Your motor has at least two poles and probably four. If it is a 4-pole motor, you will need 4 full ramp sweeps of park/inverse park angles to generate one full encoder mechanical sweep.
The 20kHz ISR is converting the mechanical angle to electrical angle for use by park/inv park.

You might try our software, VisSim/ECD, which allows you to create digital motor control diagrams similar to the pmsm3_4_28xx.pdf
The diagrams can be used to generated efficient code that supports 20kHz sampling on F28xx targets. It comes with sample diagrams for PMSM sensored and sensorless FOC. You can download a two month trial from here: www.vissim.com/downloads/demos.html
After you install, open the diagram from menu item VisSim/DSP > Examples > Digital Motor Control > PMSM31_B3
Click the right mouse on the "PMSM Control" block and look for "Encoder to Elec Angle" block. Right click that block and you will see the calculation to convert from encoder ticks to electrical angle based on pole count.
Note that this diagram is set up for the F280x, but can be easily altered to support the F281x by replacing the ADC, QEP and PWM blocks with F281x equivalents.

_____________________________________
Reply by chirag jagadish February 15, 20092009-02-15
if u see a sudden dip then sually the problem would be registeroverflowing.
ensure that you use a bigger data type to store the value.
-Chirag
--- On Fri, 13/2/09, k...@gmail.com wrote:

From: k...@gmail.com
Subject: [c28x] BLDC Motor Control
To: c...
Date: Friday, 13 February, 2009, 12:38 PM

Hi, I am trying to run an incremental encoder based motor from F2812 using PMSM3_4.(reference code). I am able to run the motor upto build level 3. But when I am trying to match the encoder angle against the ramp generated angle, its not matching. but i am moving the shaft by hand and reading the angle, then i get correct angle.that means whenever i am trying to read angle in 20KHz ISR for PWM generation, i found a sudden dip in measured angle, if i watch it on CCS graph window. Has anybody worked with similar kind of setup? can anybody help me out?

_____________________________________
Reply by kvai...@gmail.com February 13, 20092009-02-13
Hi, I am trying to run an incremental encoder based motor from F2812 using PMSM3_4.(reference code). I am able to run the motor upto build level 3. But when I am trying to match the encoder angle against the ramp generated angle, its not matching. but i am moving the shaft by hand and reading the angle, then i get correct angle.that means whenever i am trying to read angle in 20KHz ISR for PWM generation, i found a sudden dip in measured angle, if i watch it on CCS graph window. Has anybody worked with similar kind of setup? can anybody help me out?

_____________________________________