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.

CCS/TMS320F28335: ADC Interrupt and CPU Timer 0 interrupt not working together in same code

Part Number: TMS320F28335
Other Parts Discussed in Thread: C2000WARE

Tool/software: Code Composer Studio

Hi,

I am trying to use ADC interrupt and CPU Timer 0 interrupt in same code. I toggled one LED in CPU Timer 0 ISR to check whether the interrupt loop is executed or not.

when I tried to flash the code  the timer ISR was not executed. When I executed code in Debug mode putting breakpoint in Timer ISR then the ISR is executed.

I am not understanding where the problem is. Is there interrupt interdependency between ADC and Timer 0.

Kindly help with same. the basic code that I am debugging is taken from C2000 Ware adc_soc) example  code.

Thanks ,

Namita

  • No there is no dependency. Any number of interrupts can be enabled at the same time, as long as they are handled correctly. It appears your code works from flash, but not from RAM. The golden rule when booting stand-alone (i.e. from Flash) is to ensure that the program does not require anything pre-loaded/initialized in RAM for it to function. Any initialized data in RAM should be coming from flash and the runtime C libraries will take care of this before program reaches main(). Inspect your map file for all the sections that are being loaded into RAM and see if there are initialized locations for program to function. If yes, then they need to be moved to flash into a .cinit section. Similar to the RAMFUNCS sections for which the main code does a memcpy(), which is for any function that need to be run from RAM, there will be a copy for the initialized data as well. The following post gives more insights: https://e2e.ti.com/support/microcontrollers/c2000/f/171/p/655030/2408221#2408221  

     

     

  • Hi Hareesh,

    Thanks for your support.

    Actually  I am integrating couple of things in my code for example (ADC, DMA, TIMER Interrupt and

    sineAnalyzerWithPowerMeas digital power library functions ). When I tried to comment the portion of functions for sineAnalyzerWithPowerMeas the Timer interrupt is working fine even after flashing the code and in debug mode as well. But if I call some functions in main code the timer interrupt does not work. 

    Below are the mentioned functions that I am calling from main and those functions definitions are written in separate file with name  sineAnalyzerWithPowerMeas.c and sineAnalyzerWithPowerMeas.h.

    ////////////////////////////////////////////////////snip of main code////////////////////////////

    sineAnalyzerWithPowerMeas_init(&sine_mains);

    sine_mains.sampleFreq = (float32)(ISR_CONTROL_FREQUENCY);

    sine_mains.threshold = (float32)(0.00);

    sine_mains.nSamplesMax=ISR_CONTROL_FREQUENCY/UNIVERSAL_GRID_MIN_FREQ;

    sine_mains.nSamplesMin=0;

    sine_mains.emaFilterMultiplier=2.0/ISR_CONTROL_FREQUENCY;

    sine_mains.nSamples=0;

    sine_mains.nSamplesMax=MAX_SAMPLE;

     

    // while(1) loop In main code 

     

    for(;;)

    {

    if(rmsflag==1)

    {

    sine_mains.v = ((float)Voltage1[sine_mains.nSamples]*3/4095)-0.5;

     

    sineAnalyzerWithPowerMeas_calc(&sine_mains);

     

     

     

     

    rmsflag=0;

    }

     

    }

    }

    This functions are basically used for sine wave measurements like(average, RMS of current and voltages).

    I am not understanding why timer interrupt is not working if  I use above functions in main code. Is there any problem with initialization. Please help with the same.

    Thanks,

    Namita

     

  • Namita,

    debugging the logic flow of your code is not something we can support through the forum. Please take time to understand and debug. 

    If you need reference examples where this module is used see. 

    C:\ti\C2000Ware_DigitalPower_SDK_1_03_00_00\solutions\tidm_1007\f28004x\ccs

    C:\ti\C2000Ware_DigitalPower_SDK_1_03_00_00\solutions\tidm_02002\f28004x\ccs

    C:\ti\C2000Ware_DigitalPower_SDK_1_03_00_00\solutions\tidm_hv_1ph_dcac\f28004x\ccs\gridconnectedinvlclfltr

    The module documentation is here

    file:///C:/ti/C2000Ware_DigitalPower_SDK_1_03_00_00/docs/html/dplib_html/group___p_o_w_e_r___m_e_a_s___s_i_n_e___a_n_a_l_y_z_e_r.html