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.

Configuring ADC interrupts in TI RTOS

Other Parts Discussed in Thread: CONTROLSUITE, SYSBIOS

Hi TI RTOS community,

I am looking to modify the 'kitchen sink' demo projects to have ADC functionality.  Currently, I have incorporated the Include folders, c files and header files used in the ADC_SOC example code for the F28M35H52C1 microcontroller- however, despite the fact that I included the same include folders in the project, there are hundreds of errors.  Some are unresolved symbols (as if i did not provide the include folders), some state that the PIE vector table is causing a memory overlap.

I am guessing that the header and c files included in the ADC_SOC example are very general purpose, and perhaps are causing these errors?  Are there any known issues with RTOS and ADC functionality? Should I just try to initialize the ADC interrupt in the C28 project without any of the GPIO/ISR/ADC .c and .h files?

Any suggestions are appreciated,
Thank you,
Josh

  • Josh,

    are you using the M3 or ARM side (demo_m3 or demo_c28)?

    Can you post the error log? Which version of TI-RTOS are you using?

    joshua ivaldi said:
    I am guessing that the header and c files included in the ADC_SOC example are very general purpose, and perhaps are causing these errors?  Are there any known issues with RTOS and ADC functionality? Should I just try to initialize the ADC interrupt in the C28 project without any of the GPIO/ISR/ADC .c and .h files?

    We haven't tried to integrate C28 peripherals into TI-RTOS examples just yet and I don't know if any known problems with the ADC. I'd suggest to reference the ADC Control Suite example and add the code into a single TI-RTOS Task first. Note that when it comes to interrupts and the PIE you need to use SYS/BIOS' Hwi APIs.

  • Hey Tom,

    Thanks for the response.  I'll give you my current attempts  so far:

    1.  I sent the number '20' to the temperatureF message sent from the C28 and M3.  This obviously just displays a 20 on the graph.


    2. http://processors.wiki.ti.com/index.php/SYS/BIOS_and_controlSUITE_ADC_Example  I followed this as closely as possible and tried to get rid of errors.  F28M36x_Headers_BIOS.cmd is currently not in the build.  I copied and pasted the ADC interrupt code into the C28's demo.c file and put adcResult as the value sent from the C28 to the M3.  The website shows a constant '0' on the graph, meaning that the ADC interrupt must not be happening.

    3. Put a '20' back in place of the message with all of the ADC code and settings, and the graph displays correctly.  The issue is clearly that ADC interrupts are not occurring.  There are some warnings indicative of this:

    Description    Resource    Path    Location    Type
    #10247-D creating output section "Adc1RegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    Description    Resource    Path    Location    Type
    #10247-D creating output section "Adc1ResultFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem


    The list goes on for 67 warnings of everything related to ADC stuff.  Another warning I was seeing previously was the location of the PIEvect in page 1 of the .cmd file.  Do you think these issues can be fixed by changing the location of these things in memory?  I've never had errors/warnings like this before.

  • Josh,

    I just took a shot at adding C28 headers to the c28 demo. I've attached it with this post. You should be able to just import it into CCS and modify the "Path Variables" (screenshots below) to match your version of Control Suite. I just added a few things and made sure they compile and build. I did not however test this example for its functionality.

    These are the things I did to get this to work.

    • Added the C28 BIOS command linker file. The cmd file is in the same directory as the nonBIOS header file.You should be able to just add it, as long as the sections don't overlap you won't have any problems linking.
    • Added in the project properties a "Path Variable" under "Linked Resources". Note, you'll have to update this with the version of control suite you want to use.

    • Added the C2000 #include search paths as needed by the ADC_SOC project into the demo_c28 project and the source files.

     2744.c28headers_c28demo.zip

  • Hi Tom,

    I've matched my linked resources and includes to yours- but the 67 warnings still remain.  All of these ADC components just do not have specified sections.



    Description    Resource    Path    Location    Type
    #10247-D creating output section "SysCtrlRegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "SpiaRegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "XIntruptRegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "RAMErrRegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "PieVectTableFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "SciaRegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "RAMRegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "NmiIntruptRegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "McbspaRegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "PieVectTableCopyFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "PieCtrlRegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "HWBistRegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "GpioTripRegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "M3PllRegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "I2caRegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "Adc2ResultFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "Adc2RegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "AdcResultFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "AdcRegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "Comp1RegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "AnalogSysctrlRegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "Comp3RegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "Comp2RegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "Comp5RegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "Comp4RegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "CpuTimer0RegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "Comp6RegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "CpuTimer2RegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "CpuTimer1RegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "CsmRegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "CsmPwlFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    This project contains unresolved buildable linked resources. It might not build as expected.    demo_F28M35H52C1_TMS320C28XX        project    Problems
    #10247-D creating output section "Adc1RegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "Adc1ResultFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "EQep2RegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "EQep1RegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "EPwm9RegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "EPwm8RegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "FlashEccRegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "FlashCtrlRegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "EcslPwlFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "EQep3RegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "GpioG1CtrlRegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "GpioDataRegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "GpioCtrlRegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "FlashExeOnlyFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "GpioG2DataRegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "GpioG2CtrlRegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "GpioG1TripRegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "GpioG1DataRegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #552-D variable "temp" was set but never used    F28M35x_SysCtrl.c    /demo_F28M35H52C1_TMS320C28XX    line 346    C/C++ Problem
    #10247-D creating output section "DmaRegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "ECap1RegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "CtoMIpcRegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "DevEmuRegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "ECap4RegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "ECap5RegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "ECap2RegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "ECap3RegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "EPwm2RegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "EPwm3RegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "ECap6RegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "EPwm1RegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "EPwm6RegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "EPwm7RegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "EPwm4RegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem
    #10247-D creating output section "EPwm5RegsFile" without a SECTIONS specification    demo_F28M35H52C1_TMS320C28XX             C/C++ Problem

    What do you think?

    Josh

  • Josh, can you post your project?

  • Hi Tom,

    I actually got it to work!  I did not notice that the BIOS_start() command was before the ADC initialization because my code was a little messy from copy pasting things in.  The method described by the link i posted earlier does work correctly, I think

    Thank you,
    Josh

  • Hi Joshua,
    Please describe your solution a little closer, I also try to implement ADC in the RTOS demo, but always missing information and i I do not know to get it.


    my demo_c28.cfg

    var ti_sysbios_family_c28_Hwi0Params = new ti_sysbios_family_c28_Hwi.Params();
    ti_sysbios_family_c28_Hwi0Params.instance.name = "ADC";
    Program.global.ADC = ti_sysbios_family_c28_Hwi.create(4, "&adc1_isr", ti_sysbios_family_c28_Hwi0Params);

    The IRQ-Number (4, ..) i don´t know if 4 or 64 is the right Number and how the ADC-INT is corresponding too that number ?!


    my demo_C28.c


    * ======== main ========
    */
    Int main(Int argc, Char* argv[])
    {
    // Interrupts that are used in this example are re-mapped to
    // ISR functions found within this file.
    EALLOW; // This is needed to write to EALLOW protected register
    PieVectTable.ADCINT1 = &adc1_isr;
    EDIS; // This is needed to disable write to EALLOW protected registers

    Adc1Regs.INTSEL1N2.bit.INT1SEL = 0; // setup EOC0 to trigger ADCINT1
    // to fire
    Adc1Regs.ADCSOC0CTL.bit.CHSEL = 0; // set SOC0 channel select to
    // ADC1A0
    Adc1Regs.ADCSOC1CTL.bit.CHSEL = 2; // set SOC1 channel select to
    // ADC1A2
    AnalogSysctrlRegs.TRIG1SEL.all = 5; // Assigning EPWM1SOCA to
    // ADC TRIGGER 1 of the ADC module
    Adc1Regs.ADCSOC0CTL.bit.TRIGSEL = 5; // Set SOC0 start trigger to
    // ADC Trigger 1(EPWM1 SOCA) of the
    // adc
    Adc1Regs.ADCSOC1CTL.bit.TRIGSEL = 5; // set SOC1 start trigger to
    // ADC Trigger 1(EPWM1 SOCA) of the
    // adc
    Adc1Regs.ADCSOC0CTL.bit.ACQPS = 6; // set SOC0 S/H Window to 7 ADC
    // Clock Cycles, (6 ACQPS plus
    // 1)
    Adc1Regs.ADCSOC1CTL.bit.ACQPS = 6; // set SOC1 S/H Window to 7 ADC
    // Clock Cycles, (6 ACQPS plus

    BIOS_start();

    return (0);
    }



    __interrupt void adc1_isr(void)
    {
    Voltage1[ConversionCount] = Adc1Result.ADCRESULT0;
    Voltage2[ConversionCount] = Adc1Result.ADCRESULT1;

    // If 20 conversions have been logged, start over
    if(ConversionCount == 9)
    {
    ConversionCount = 0;
    }
    else ConversionCount++;

    Adc1Regs.ADCINTFLGCLR.bit.ADCINT1 = 1; //Clear ADCINT1 flag reinitialize
    // for next SOC
    PieCtrlRegs.PIEACK.all = PIEACK_GROUP1; // Acknowledge interrupt to PIE

    return;
    }





    the EALLOW; // This is needed to write to EALLOW protected register
    PieVectTable.ADCINT1 = &adc1_isr;
    EDIS; // This is needed to disable write to EALLOW protected registers

    section I did not get to run and that's why I wanted to try to register these things in demo_c28.cmd , but I also missing info

    can you please help me