This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ADC channel of Low-Volt. Multi-Axis PFC kit (pt. II)

The beginning of a story is here:

http://e2e.ti.com/support/microcontrollers/tms320c2000_32-bit_real-time_mcus/f/171/p/91493/356872.aspx#356872

 

The ADC configuration looks like that:

AdcRegs.ADCSOC5CTL.bit.CHSEL = 5;

AdcRegs.ADCSOC5CTL.bit.TRIGSEL = 5;

AdcRegs.ADCSOC5CTL.bit.ACQPS = 6;

Now the task is to configure the ADC channel #5 to be triggered by Timer0 interrupts rather than of EPWM1A ones.

Suppose, the value of AdcRegs.ADCSOC5CTL.bit.TRIGSEL should be corrected from =5 to something different?

 

Where to find the que?

Thanks.

  • Lucifer,

    The ADC Reference guide can be found at

    http://focus.ti.com/lit/ug/spruge5b/spruge5b.pdf

    you would need to specify the trigger source, look at the ADCSOCxCTL register description,

    obviously you would need to configure the trigger source appropriately to generate the trigger signal,

    -Manish Bhardwaj

  • Well, having reconfigured trigger source to be Timer0 (according to datasheet recommended):

    AdcRegs.ADCSOC5CTL.bit.TRIGSEL = 1;

    And putting code:

    Voltage =  _IQ15toIQ((AdcResult.ADCRESULT5<<3));

    adccounter++;

    into void A0(void) routine, it shows adccounter=3...12 or sometimes adccounter=1 (in Watch window) and Voltage only change 3...12 or ones, respectively.

    I.e. A0 routine only goes couple of time and then stops.

    Why?

     

    P.S.: When putting code

    Voltage =  _IQ15toIQ((AdcResult.ADCRESULT5<<3));

    adccounter++;

    into EPWM1A - driven ISR, everything goes as it should.

    (Having AdcRegs.ADCSOC5CTL.bit.TRIGSEL = 5; off course)


  • Lucifer,

    Did i not say configure the peripheral correctly? please read the system and timer guide and configure the timer for interrupts,

    If you are using the Main.c files from TI motor control projects please note it is not an interrupt driven state machine, it is just polling the time flag for overflow,

    Did you change it to timer inetrrupt?

    Not to be rude, but I would recommend trying to do some debug before posting at least. 

    -Manish Bhardwaj

     

  • Thanks, Manish, for attention, patience and for being so kind.

     

    Best wishes.

  • Well, having Timer0 routine declared and described:

    interrupt void Timer0_ISR(void);

    ...

    interrupt void Timer0_ISR(void)

    {

    ...

    }

    and including this interrupt into IVectorTable

    PieVectTable.TINT1 = &Timer0_ISR;

    Trying to initialize timers in main{}:

    InitCpuTimers();

    gives errors: 

    errors encountered during linking; "2xPM_Sensorless.out" not built

    unresolved symbol _InitCpuTimers, first referenced in ./2xPM_Sensorless.obj

    Can someone point the reason?

     

  • Now that Timer0 ISR works as it should, it is time to make a conclusion.

    To make ADC work syncronous to CPU-Timer-0, one should:

    1. Make sure that DSP2803x_CpuTimers.c is in project

    2. Add following code into 2xPM_Sensorless.c 

     

    // Declare prototype for timer interrupt subroutine

    interrupt void Timer0_ISR(void);

    void main (void)

    {

    // Adding according vector into table

    EALLOW;

    PieVectTable.TINT0 = &Timer0_ISR;

    EDIS;

    // Initialize and configure timer

    InitCpuTimers();

    ConfigCpuTimer(&CpuTimer0, 100, 1000);

    // Enable Timer0 interrupt

    IER |= M_INT1;

    // Start Timer0

    CpuTimer0Regs.TCR.bit.TSS = 0;

    }

    interrupt void Timer0_ISR(void)

    {

    // ISRoutine is here ...

    // Allow next interrupt

    PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;

    }

     

     

    That's it.