AnsweredAssumed Answered

ACM CS pin not working

Question asked by sijeo.philip@aydintech.com on Apr 1, 2013
Latest reply on May 9, 2013 by sijeo.philip@aydintech.com

Hi ,

In our application we are using AD7606 with SPORT1 interface with internal frame sync and ACLK of 12.5Mhz.. I am using DMA4 for collection of 32x8 samples i.e. 256 total number of samples..

EX_INTERRUPT_HANDLER(DMA4_ISR)
{
*pPORTFIO_TOGGLE = 0x8000;
*pDMA4_IRQ_STATUS = DMA_DONE;
ssync();
count =0;
DMA_Count++;

for(data_count=0; data_count<=BUFF_SIZE; data_count+=8)
{
Red_Input_Current[count] = ADC_Data[data_count]>>15;
Red_Input_Voltage[count] = ADC_Data[data_count+1]>>15;
Yellow_Input_Current[count] = ADC_Data[data_count+2]>>15;
Yellow_Input_Voltage[count] = ADC_Data[data_count+3]>>15;
Blue_Input_Current[count] = ADC_Data[data_count+4]>>15;
Blue_Input_Voltage[count] = ADC_Data[data_count+5]>>15;
Earth_Input_Current[count] = ADC_Data[data_count+6]>>15;
Earth_Input_Voltage[count] = ADC_Data[data_count+7]>>15;
count++;
if(count>FFT_SIZE)
count=0;
}

rfftrad4_fr16(Red_Input_Current, Temp_Data, R_Data_Current, Twiddle_Data, 1, FFT_SIZE, 1, 0);
rfftrad4_fr16(Red_Input_Voltage, Temp_Data, R_Data_Voltage, Twiddle_Data, 1, FFT_SIZE, 1, 0);
rfftrad4_fr16(Blue_Input_Current, Temp_Data, B_Data_Current, Twiddle_Data, 1, FFT_SIZE, 1, 0);
rfftrad4_fr16(Blue_Input_Voltage, Temp_Data, B_Data_Voltage, Twiddle_Data, 1, FFT_SIZE, 1, 0);
rfftrad4_fr16(Yellow_Input_Current, Temp_Data, Y_Data_Current, Twiddle_Data, 1, FFT_SIZE, 1, 0);
rfftrad4_fr16(Yellow_Input_Voltage, Temp_Data, Y_Data_Voltage, Twiddle_Data, 1, FFT_SIZE, 1, 0);
rfftrad4_fr16(Earth_Input_Current, Temp_Data, E_Data_Current, Twiddle_Data, 1, FFT_SIZE, 1, 0);
rfftrad4_fr16(Earth_Input_Voltage, Temp_Data, B_Data_Voltage, Twiddle_Data, 1, FFT_SIZE, 1, 0);

Red_Current_Mag = cartesian_fr16(R_Data_Current[1], &R_Current_Phase);
Red_Voltage_Mag = cartesian_fr16(R_Data_Voltage[1], &R_Voltage_Phase);
Yellow_Current_Mag = cartesian_fr16(Y_Data_Current[1], &Y_Current_Phase);
Yellow_Voltage_Mag = cartesian_fr16(Y_Data_Voltage[1], &Y_Voltage_Phase);
Blue_Current_Mag = cartesian_fr16(B_Data_Current[1], &B_Current_Phase);
Blue_Voltage_Mag = cartesian_fr16(B_Data_Voltage[1], &B_Voltage_Phase);
Earth_Current_Mag = cartesian_fr16(E_Data_Current[1], &E_Current_Phase);
Earth_Voltage_Mag = cartesian_fr16(E_Data_Voltage[1], &E_Voltage_Phase);

Red_Current_Value = fr16_to_float(Red_Current_Mag)*CURRENT_RATIO;
Yellow_Current_Value = fr16_to_float(Yellow_Current_Mag)*CURRENT_RATIO;
Blue_Current_Value = fr16_to_float(Blue_Current_Mag)*CURRENT_RATIO;
Earth_Current_Value = fr16_to_float(Earth_Current_Mag)*CURRENT_RATIO;
R_I_Phase_Value = fr16_to_float(R_Current_Phase);
Y_I_Phase_Value = fr16_to_float(Y_Current_Phase);
B_I_Phase_Value = fr16_to_float(B_Current_Phase);
E_I_Phase_Value = fr16_to_float(E_Current_Phase);
R_V_Phase_Value = fr16_to_float(R_Voltage_Phase);
Y_V_Phase_Value = fr16_to_float(Y_Voltage_Phase);
B_V_Phase_Value = fr16_to_float(B_Voltage_Phase);
E_V_Phase_Value = fr16_to_float(E_Voltage_Phase);
Red_Voltage_Value = fr16_to_float(Red_Voltage_Mag)*VOLTAGE_RATIO;
Yellow_Voltage_Value = fr16_to_float(Yellow_Voltage_Mag)*VOLTAGE_RATIO;
Blue_Voltage_Value = fr16_to_float(Blue_Voltage_Mag)*VOLTAGE_RATIO;
Earth_Voltage_Value = fr16_to_float(Earth_Voltage_Mag)*VOLTAGE_RATIO;

R_Phase_Value = R_V_Phase_Value - R_I_Phase_Value;
Y_Phase_Value = Y_V_Phase_Value - Y_I_Phase_Value;
B_Phase_Value = B_V_Phase_Value - B_I_Phase_Value;
E_Phase_Value = E_V_Phase_Value - E_I_Phase_Value;

 

 

/*RY_Voltage_Value = Yellow_Voltage_Value - Red_Voltage_Value;
BR_Voltage_Value = Red_Voltage_Value - Blue_Voltage_Value;
BY_Voltage_Value = Yellow_Voltage_Value - Blue_Voltage_Value;
RY_V_Phase_Value = Y_V_Phase_Value - R_V_Phase_Value;
BR_V_Phase_Value = R_V_Phase_Value - B_V_Phase_Value;
BY_V_Phase_Value = Y_V_Phase_Value - B_V_Phase_Value;

TA_Angle = BY_V_Phase_Value - R_I_Phase_Value;
TB_Angle = BR_V_Phase_Value - Y_I_Phase_Value;
TC_Angle = RY_V_Phase_Value - B_I_Phase_Value;
TORQUE_A = BY_Voltage_Value*Red_Current_Value*cosf(TA_Angle);
TORQUE_B = BR_Voltage_Value*Yellow_Current_Value*cosf(TB_Angle);
TORQUE_C = RY_Voltage_Value*Blue_Current_Value*cosf(TC_Angle);

Temp_R_Current += Red_Current_Value;
Temp_Y_Current += Yellow_Current_Value;
Temp_B_Current += Blue_Current_Value;
Temp_E_Current += Earth_Current_Value;
Temp_R_Voltage += Red_Voltage_Value;
Temp_Y_Voltage += Yellow_Voltage_Value;
Temp_B_Voltage += Blue_Voltage_Value;
Temp_E_Voltage += Earth_Voltage_Value;
if(DMA_Count ==25)
{
Measure_R_Current = Temp_R_Current/25;
Measure_R_Voltage = Temp_R_Voltage/25;
Measure_Y_Current = Temp_Y_Current/25;
Measure_Y_Voltage = Temp_Y_Voltage/25;
Measure_B_Current = Temp_B_Current/25;
    Measure_B_Voltage = Temp_B_Voltage/25;
    Measure_E_Current = Temp_E_Current/25;
    Measure_E_Voltage = Temp_E_Voltage/25;
    DMA_Count =0;
    show_measure_value=true;
}

PH_Current = MAX(Red_Current_Value,Yellow_Current_Value,Blue_Current_Value);
MAX_PH_Voltage = MAX(Red_Voltage_Value, Yellow_Voltage_Value, Blue_Voltage_Value);
MIN_PH_Voltage = MIN(Red_Voltage_Value, Yellow_Voltage_Value, Blue_Voltage_Value);
if(ph_current_setting==true)
{
if(PH_Current>=LO_CURRENT_THRESHOLD)
{lo_current_fault=true;
if(lo_current_fault==false)
{lo_trip_time = LO_SET_TIME();lo_trip_time *=1000;}
}
else
  {lo_current_fault=false;}
}

if(hiph_current_setting==true)
{
if(PH_Current>=HI_CURRENT_THRESHOLD)
{hi_current_fault=true;
if(hi_current_fault==false)
hi_trip_time = hi_set_delay*1000;}
else
  {hi_current_fault=false;}
}

if(earth_current_setting==true)
{
if(Earth_Current_Value >=ELO_CURRENT_THRESHOLD)
  {elo_current_fault=true;
   if(elo_current_fault==false) 
   {elo_trip_time = ELO_SET_TIME(); elo_trip_time *=1000;}
   }
  else
  {elo_current_fault=false;}
}
if(hie_current_setting==true)
{
if(Earth_Current_Value >=EHI_CURRENT_THRESHOLD)
{ ehi_current_fault=true;
if(ehi_current_fault==false)
ehi_trip_time = hie_set_delay*1000;}
else
  {ehi_current_fault=false;}
}
if(ov_setting==true)
{
if(MAX_PH_Voltage > MAX_PH_VOLTAGE_THRESHOLD)
{ov_voltage_fault=true;
  if(ov_voltage_fault==false)
  ov_trip_time = ov_set_delay;
}
else
{ov_voltage_fault=false;}
}
if(uv_setting==true)
{
if((MIN_PH_Voltage<MIN_PH_VOLTAGE_THRESHOLD)&&(MIN_PH_Voltage!=0))
{uv_voltage_fault=true;
if(uv_voltage_fault==false)
uv_trip_time = uv_set_delay;
}
else
{uv_voltage_fault=false;}
}

if((lo_current_fault)||(hi_current_fault)||(elo_current_fault)||(ehi_current_fault)||(ov_voltage_fault)||(uv_voltage_fault))
{fault = true; *pTIMER_ENABLE |= TIMEN3;}
else
{fault =false; *pTIMER_DISABLE |=TIMDIS3; *pPORTFIO_CLEAR= self_hand_trip_relay;lo_current_trip=false;
hi_current_trip=false; elo_current_trip=false; ehi_current_trip=false; ov_voltage_trip=false; uv_voltage_trip;}
*/
  }

 

when i comment off  the code as shown above the ACM works fine i.e. can see proper CS signals on the pin... but when the whole code is used my CS signal stops working... i am not sure what stops the CS from working when the code in the DMA4 ISR increased.. Please help to understand if somebody has faced the similar problem .. the execution time whole DMA4 ISR was measured to be less than 78.5 microseconds.. DMA ISR is set to occur at 20ms and CS is timed at every 625micro seconds

 

Thanks in Advance

Sijeo Philip

Outcomes