2041 views|1 replies

8

Posts

3

Resources
The OP
 

PMSM3-4 routine problem [Copy link]

 I would like to ask you guys about the current sampling problem in TI's routine program. The program is as follows. The red part below, after XORing with 0x8000, generates a number between 0x8000--0x7FF0. However, after this processing, it seems to be directly converted into a value between IQ (-1) ~ IQ (1). So how do you solve the current? Why is there no current value written in the program, and it is directly converted into a value between IQ (-1) ~ IQ (1)? I want to reverse solve the current, how should I deal with it? #include "DSP281x_Device.h" #include "f281xileg.h" #define CPU_CLOCK_SPEED 6.6667L // for a 150MHz CPU clock speed #define ADC_usDELAY 5000L #define DELAY_US(A) DSP28x_usDelay(((((long double) A * 1000.0L) / (long double)CPU_CLOCK_SPEED) - 9.0L) / 5.0L) extern void DSP28x_usDelay(unsigned long Count); void F281X_ileg2_drv_init(ILEG2MEAS *p) { DELAY_US(ADC_usDELAY); AdcRegs.ADCTRL1.all = ADC_RESET_FLAG; // Reset the ADC Module asm(" NOP "); asm(" NOP "); AdcRegs.ADCTRL3.bit.ADCBGRFDN = 0x3; // Power up bandgap/reference circuitry DELAY_US(ADC_usDELAY); // Delay before powering up rest of ADC AdcRegs.ADCTRL3.bit.ADCPWDN = 1; // Power up rest of ADC AdcRegs.ADCTRL3.bit.ADCCLKPS = 6; // Set up ADCTRL3 register DELAY_US(ADC_usDELAY); AdcRegs.ADCTRL1.all = ADCTRL1_INIT_STATE_ILEG2; // Set up ADCTRL1 register AdcRegs.ADCTRL2.all = ADCTRL2_INIT_STATE_ILEG2; // Set up ADCTRL2 register AdcRegs.ADCMAXCONV.bit.MAX_CONV1 = 1; // Specify two conversions AdcRegs.ADCCHSELSEQ1.all = p->ChSelect; // Configure channel selection EvaRegs.GPTCONA.bit.T1TOADC = 1; // Set up EV Trigger with Timer1 UF } void F281X_ileg2_drv_read(ILEG2MEAS *p) { int16 DatQ15; int32 Tmp; // Wait until ADC conversion is completed while (AdcRegs.ADCST.bit.SEQ1_BSY == 1) {}; DatQ15 = AdcRegs.ADCRESULT0^0x8000; // Convert raw result to Q15 (bipolar signal) Tmp = (int32)p->ImeasAGain*(int32)DatQ15; // Tmp = gain*dat => Q28 = Q13*Q15 p->ImeasA = (int16)(Tmp>>13); // Convert Q28 to Q15 p->ImeasA += p->ImeasAOffset; // Add offset p->ImeasA *= -1; // Positive direction, current flows to motor DatQ15 = AdcRegs.ADCRESULT1^0x8000; // Convert raw result to Q15 (bipolar signal) Tmp = (int32)p->ImeasBGain*(int32)DatQ15; // Tmp = gain*dat => Q28 = Q13*Q15 p->ImeasB = (int16)(Tmp>>13); // Convert Q28 to Q15 p->ImeasB += p->ImeasBOffset; // Add offset p->ImeasB *= -1; // Positive direction, current flows to motor p->ImeasC = -(p->ImeasA + p->ImeasB); // Compute phase-c current AdcRegs.ADCTRL2.all |= 0x4040;                 // Reset the sequence

}            

This post is from TI Technology Forum
 

8

Posts

3

Resources
2
 
Could you please explain the conversion mechanism of this program? Without giving the current base value, it is directly converted into the per-unit value. So how can I calculate the current value based on the per-unit value? At present, I think the current loop sampling is not correct.
This post is from TI Technology Forum
 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list