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.

F28335, ADC SOC triggered by CPU Timer

Other Parts Discussed in Thread: TMS320F28335


Hi all,

I am using the TMS320F28335 Delfino Experimental kit.

I want to use CPU Timer0 to trigger the SOC for ADC. I am using the ADC in Dual, simultaneous mode. The same program worked fine using PWM as SOC trigger but at this stage of my project, I am will be using all the 6 PWM as a result had to switch to CPU Timer0.

I tried the following commands to initialize SOC via software trigger but how do I assign the software trigger to be from CPU Timer0?

AdcRegs.ADCTRL2.bit.SOC_SEQ1 = 1 ;
AdcRegs.ADCTRL2.bit.SOC_SEQ2=1;

AdcRegs.ADCTRL2.bit.INT_ENA_SEQ1 = 1;
AdcRegs.ADCTRL2.bit.INT_ENA_SEQ2 = 1;

AdcRegs.ADCTRL2.bit.INT_MOD_SEQ1=1;
AdcRegs.ADCTRL2.bit.INT_MOD_SEQ2=1;

Best Regards,

Pankaj

  • To my previous setting I also have the ADCINT set to the CPU Timer0 ISR

    EALLOW;

    PieVectTable.TINT0 = &cpu_timer0_isr;

    PieVectTable.ADCINT= &cpu_timer0_isr; 

    EDIS;

    IER |= M_INT1;

    PieCtrlRegs.PIEIER1.bit.INTx7 = 1;
    PieCtrlRegs.PIEIER1.bit.INTx6 = 1; 

    EINT; // Enable Global interrupt INTM
    ERTM; 

  • Mr. Kadam,

    You want the code to reset and start the ADC sequence in your timer interrupt.  You want the code to handle the results of the ADC operation in the ADC interrupt.  They should be two separate functions.

    Regards,

    Bill

  • Dear Bill,
    From what you have suggested I wrote two different ISR, cpu_timer0_isr and adc_isr.
    I have configured the timer0 to 100us, as a result cpu_timer0_isr  is interrupted every 100us . In the cpu_timer0_isr  I need to write a code that will generate ADC SOC which will be handled by adc_isr, thus capturing and values. 
    On page 36 of SPRU812A , it says the SOC_SEQ1 can be triggered by software but it doesn't specifies how to assign Timer0 as the SOC.
    I have refereed to other controller as well the F28035 series, http://e2e.ti.com/support/microcontrollers/c2000/f/171/p/172041/635213.aspx#635213
    In the 4th post, written by Markus Tamas,  they have a command to set timer0 as SOC. While in my controller F28335 there is no such command.
    AnalogSysctrlRegs.TRIG1SEL.bit.TRIG1SEL   = 1;   // Trigger by CPU Time 0
    Is there a way I can similarly trigger SOC via cpu timer 0 in F28335?
    Best regards, 
    Pankaj Kadam 
  • Pankaj,

    So, to trigger a conversion by software, you literally have to write software to start the conversion.  For cascaded sequencing I use:

    AdcRegs.ADCTRL2.bit.RST_SEQ1 = 1;   // Reset SEQ1
    AdcRegs.ADCTRL2.bit.SOC_SEQ1 = 1;  // Start SEQ1

    For dual sequencers the code will be slightly different.  Put this code in your timer ISR and you should be all set.

    Regards,

    Bill

  • Dear Bill,

    I have 3 dual (i.e CONV9, CONV10, CONV11, total 6 ) signals that I have to simultaneous capture.

    Setting RST_SEQ1, (find attached) immediately resets sequencer to the initial CONV state.  If you see the description of RST_SEQ1 in SPRU812A, it says its waits for the trigger. Its not a trigger. 

    I still tried it but it didn't trigger the SOC. I also checked the ADCST register. The SEQ1 is initiated but SOC of ADC doesn't take place, as the control never goes to the adc_isr in which I have a breakpoint. 

    I am in-between trying the XINT2, I set the GPIOxINT2SEL register , set adc_isr to handel external interrupt  PIE group 5 and GPIOMUX register. Gave a 3.3V to GPIO31 as an external interrupt (similar to switching on a button) but the controller got disconnected from the IDE. I am just working on that how to give an external interrupt at the moment. 

    Any other hints will be helpful.

    Best Regards,

    Pankaj

  • Dear Bill,

    I was able to solve my problem of the SOC trigger, I had commented the PIE line for the interrupt while testing for other conditions. 

     PieCtrlRegs.PIEIER1.bit.INTx6 = 1; // ADCINT enable

    In the CPU_ISR I just wrote

     AdcRegs.ADCTRL2.bit.SOC_SEQ1 = 1 ;

    PieCtrlRegs.PIEACK.bit.ACK7 = 1;

    At the moment having trouble capturing the ADC values in Dual-Simultaneous mode. The code works fine for Sequential-Cascade mode. 

    Best Regards,

    Pankaj

  • For future reference, the final changes  in the code are:

    •  Interrupt void cpu_timer0_isr(void)  // ever 100us which in turn interrupts adc_isr

      {

      AdcRegs.ADCTRL2.bit.SOC_SEQ1 = 1 ; // Enable SOCA   from interrupt to start SEQ1

      AdcRegs.ADCTRL2.bit.SOC_SEQ2 = 1 ; 

     PieCtrlRegs.PIEACK.bit.ACK7 = 1;             // TINT0 ack

      }

     

    • In ADC_Intitialization() added following changes

     

       AdcRegs.ADCTRL2.bit.SOC_SEQ1 = 1 ; // Enable SOCA from interrupt to start SEQ1

       AdcRegs.ADCTRL2.bit.SOC_SEQ2 = 1;  // Software triggered SOC SEQ2 

       AdcRegs.ADCTRL2.bit.INT_ENA_SEQ1 = 1;  // Enable SEQ1 interrupt     

       AdcRegs.ADCTRL2.bit.INT_MOD_SEQ1=0; // 0: Interrupt every EOS

    Thank you for pointing me, in the right direction.

    Best Regards,

    Pankaj