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/LAUNCHXL-F28069M: ECap to trigger ADC SOC

Part Number: LAUNCHXL-F28069M

Tool/software: Code Composer Studio

Hi Everyone, This is Mike.

I want to ask if it is possible to trigger a Start Of Conversion with the ECap module.

Is it about  to refresh some data in the interrupt __int ECap1 ... ?

Is it about to get some registers high or low at the AdcRegs?

I have written this code to measure frequency, it has some error (0.01Hz) But I think it is ok for me. This is just the frecuencia function and I want to use it to trigger the Adc in order to avoid the distortion because  of the circular buffer and the CMPA and the TBPRD values at the EPwm registers, (Those have been a headache to me)

Thanks for all your support

void frecuencia(void)
   {
       EALLOW;                                     //Emulación de registros
       SysCtrlRegs.PCLKCR1.bit.ECAP1ENCLK = 1;     // SYSCLKOUT para habilitar eCAP1
       // Se inicia el módulo ECAP para medir el periodo y el ancho de pulso de una señal.
       ECap1Regs.ECEINT.all = 0;                   // Deshabilita todas las interrupciones del módulo eCAP
       ECap1Regs.ECCTL1.bit.CAPLDEN = 0;           // Deshabilita la carga de los resultados de captura
       ECap1Regs.ECCTL2.bit.TSCTRSTOP = 0;         // Detiene el contador
       ECap1Regs.TSCTR = 0;                        // Limpia el contador
       ECap1Regs.CTRPHS = 0;                       // Limpia el registro de contador de fase
       ECap1Regs.ECCTL2.bit.CAP_APWM = 0;          // Modo Captura
       ECap1Regs.ECCTL2.bit.SWSYNC = 0;            // Sincronización forzada del contador por software, sincroniza todas las bases de tiempo del ECAP
       ECap1Regs.ECCTL2.bit.SYNCO_SEL = 10;        // Syncin = Syncout, requerido por SWSYNC
       ECap1Regs.ECCTL2.bit.SYNCI_EN = 0;          // Deshabilita sincronización de entrada
       ECap1Regs.ECCTL2.bit.TSCTRSTOP = 1;         // Time Stamp Counter free-running
       ECap1Regs.ECCTL2.bit.REARM = 0;             // No Re-arme (Re-arme ->arma una secuencia de captura predeterminada)
       ECap1Regs.ECCTL2.bit.STOP_WRAP = 11;        // Toma 4 capturas en modo continuo
       ECap1Regs.ECCTL2.bit.CONT_ONESHT = 0;       // Operando en modo continuo
       ECap1Regs.ECCTL1.bit.FREE_SOFT= 11;         // Time Stamp Counter no es afectado por le emulación suspendida
       ECap1Regs.ECCTL1.bit.PRESCALE = 00000;      // Dividido entre 1
       ECap1Regs.ECCTL1.bit.CAPLDEN = 1;           // Habilita los registros de carga CAP1-4 en un evento
       ECap1Regs.ECCTL1.bit.CTRRST4 = 0;           // Sin reset en la primera captura
       ECap1Regs.ECCTL1.bit.CAP4POL = 1;           // Captura en el ascenso de la señal
       ECap1Regs.ECCTL1.bit.CTRRST3 = 0;           // Sin reset en la segunda captura
       ECap1Regs.ECCTL1.bit.CAP3POL = 0;           // Captura en el descenso de la señal
       ECap1Regs.ECCTL1.bit.CTRRST2 = 0;           // Sin reset en la tercera captura
       ECap1Regs.ECCTL1.bit.CAP2POL = 1;           // Captura en el ascenso de la señal
       ECap1Regs.ECCTL1.bit.CTRRST1 = 0;           // Sin reset en la cuarta captura
       ECap1Regs.ECCTL1.bit.CAP1POL = 0;           // Captura en el descenso de la señal
       ECap1Regs.ECEINT.all = 0x0008;              // Habilita las interrupciones
       PieCtrlRegs.PIEIER4.bit.INTx1 = 1;          // Habilita la interrupción de ECAP1_INT en PIE grupo 4
       IER |= 0x0008;                              // Habilita INT4 en IER para habilitar el grupo 4 del bloque de interrupciones
       EINT;
       ERTM;
       //GpioCtrlRegs.GPACTRL.all  = 0x00000000;
       GpioCtrlRegs.GPAMUX2.bit.GPIO24 = 1;        // GPIO 24 Configurador para captura de pulsos
       GpioCtrlRegs.GPADIR.bit.GPIO24 = 0;         // GPIO 24 como entrada
       //GpioCtrlRegs.GPAPUD.bit.GPIO24 = 0;         // Pull-up habilitado para GPIO24
       EDIS;
   }