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.

CPU TIMER and ADC MODULE?

Just a noob question.

I am trying to combine both ADCINT2 and CPU1 interrupt in my program .Both  interrupts are re-mapped to  ISR functions.  I  initialize the ADC module and CPU timer by // SysCtrlRegs.PCLKCR0.bit.ADCENCLK = 1// and //SysCtrlRegs.PCLKCR3.bit.CPUTIMER1ENCLK=1;// However it  doesnot seem to be compatible. As an outcome only one interrupt is realized. Am I somewhere wrong?

  • I forgot to mention that I am using the f28027

  • Dionisis,

    Which interrupt is working and which is not?  Have you successfully gotten both interrupts to work independently? 

  • the ADC interrupt works when the " SysCtrlRegs.PCLKCR0.bit.ADCENCLK = 1" is inside the initialization function  :     

      void INTIALIZATIONADC(void)
    {
    #define ADC_usDELAY  2000L
    extern void DSP28x_usDelay(Uint32 Count);

    EALLOW;
            
           SysCtrlRegs.PCLKCR0.bit.ADCENCLK = 1;  // Enables the clock
            (*Device_cal)();
    EDIS;

    EALLOW;
        AdcRegs.ADCCTL1.bit.ADCBGPWD  = 1;      // Power ADC BG
        AdcRegs.ADCCTL1.bit.ADCREFPWD = 1;      // Power reference
        AdcRegs.ADCCTL1.bit.ADCPWDN   = 1;      // Power ADC
        AdcRegs.ADCCTL1.bit.ADCENABLE = 1;      // Enable ADC
        AdcRegs.ADCCTL1.bit.ADCREFSEL = 0;      // Select interal BG
    EDIS;

    DELAY_US(ADC_usDELAY);

    }

    . When I exclude the "       SysCtrlRegs.PCLKCR0.bit.ADCENCLK = 1;  // Enables the clock"

    from the function and write it to the main -->  ....SysCtrlRegs.PCLKCR0.bit.ADCENCLK = 1 

                                                                                        SysCtrlRegs.PCLKCR3.bit.CPUTIMER1ENCLK=1;

    then the CPU interrupt works.


  • I am reposting that since didnot get any replies.

    Just a noob question.
    I am using the f28027.
    In my program I am trying to combine both ADCINT2 and CPU1 interrupt in my program .Both  interrupts are re-mapped to  ISR functions.  I  initialize the ADC module and CPU timer by // SysCtrlRegs.PCLKCR0.bit.ADCENCLK = 1// and //SysCtrlRegs.PCLKCR3.bit.CPUTIMER1ENCLK=1;// However it  doesnot seem to be compatible. As an outcome only one interrupt is realized. Am I somewhere wrong?



    the ADC interrupt works when the " SysCtrlRegs.PCLKCR0.bit.ADCENCLK = 1" is inside the initialization function:      

      void INTIALIZATIONADC(void)
    {
    #define ADC_usDELAY  2000L
    extern void DSP28x_usDelay(Uint32 Count);

    EALLOW;
            
           SysCtrlRegs.PCLKCR0.bit.ADCENCLK = 1;  // Enables the clock
            (*Device_cal)();
    EDIS;

    EALLOW;
        AdcRegs.ADCCTL1.bit.ADCBGPWD  = 1;      // Power ADC BG
        AdcRegs.ADCCTL1.bit.ADCREFPWD = 1;      // Power reference
        AdcRegs.ADCCTL1.bit.ADCPWDN   = 1;      // Power ADC
        AdcRegs.ADCCTL1.bit.ADCENABLE = 1;      // Enable ADC
        AdcRegs.ADCCTL1.bit.ADCREFSEL = 0;      // Select interal BG
    EDIS;

    DELAY_US(ADC_usDELAY);

    }

    . When I exclude the "       SysCtrlRegs.PCLKCR0.bit.ADCENCLK = 1; "

    from the initialiazation function and write it to the main -->  .......................................//

                                                                                           SysCtrlRegs.PCLKCR0.bit.ADCENCLK = 1

                                                                                           SysCtrlRegs.PCLKCR3.bit.CPUTIMER1ENCLK=1;

                                                                                          INTIALIZATIONADC(void)

                                                                                                                         //

    then the CPU interrupt works.

    Both interrupts work independently.

  • coming back, the strange si that when I do not initiate the ADC conversion , thus excluding the

    AdcRegs.ADCSOCFRC1.bit.SOC0=1 ,

    then the CPU interrupt works properly even if the clock of ADC is enabled as it was supposed to do. So the conclusion is that propably there is somethink wrong with the remap of the interrupt function---> that is what I have used in my program :

      EALLOW;  
       PieVectTable.ADCINT2 = &adc_isr;
       PieVectTable.TINT1 = &cpu_timer1_isr;
       EDIS;  

    Any feedback appreciated