• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Microcontrollers » MSP430™ Microcontrollers » MSP430 Ultra-Low Power 16-bit Microcontroller Forum » Repeat sequence ADC DMA MSP430G2553
Share
MSP430™ Microcontrollers
  • Forum
  • Announcements
  • E2E Wiki
Options
  • Subscribe via RSS
MSP430 Resources
  • MSP430 Product Folder
  • MSP-EXP430G2 - MSP430 LaunchPad Value Line Development kit
  • MSP430 Getting Started Guide
  • MSP430 Microcontroller Projects
  • More Resources >
  • Forums

    Repeat sequence ADC DMA MSP430G2553

    This question is not answered
    Aamir Ali
    Posted by Aamir Ali
    on Apr 05 2012 07:26 AM
    Expert2115 points

    I have a task:

    1. Sample 4 channels (a0-a3) by adc using DMA.

    2. Go In sleep mode until it sample all four. (how to know dma has completed sampling channles & put results in RAM variables for accessing)

    3. Do some task by accessing those variables, do other task also.

    4. Go to sleep mode again.

    5. Go to step 1.

    Now I have questions 4 it:

    1. best is to use repeat sequence of channels or sequence of channel.

    2. when does dma completes its task, how does we can know it -> ADC interrupt flag?

    3. it says DMA should be synchronized with mclk. So how to do it.

    4. any example showing the above task.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    All Replies
    • Aamir Ali
      Posted by Aamir Ali
      on Apr 10 2012 04:29 AM
      Expert2115 points

      any help regarding this................

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Jens-Michael Gross
      Posted by Jens-Michael Gross
      on Apr 10 2012 07:14 AM
      Guru139900 points

      The 2253 does not have (general purpose) DMA. It does have, however, the DTC for the ADC10, which serves as a purpose-limited DMA.
      When using DTC, keep in mind that a data transfer to ram requires MCLK active. So entering LPM1 or below, which will deactivate the DCO, requires some startup time before MCLK can be activated for the transfer. You shouldn't go below LMP0 except if the distance between two samples is significantly longer than the MCLK startup time.

      Now about your questions:

      1. it depends. You want to wakeup from LPM once a sequence is done. Normally, the ADC10 sets ADC10IFG once a conversion is done. If ADC10IE is also set, your ADC10 ISR will be called, waking teh CPU from LPM if required.

      If the DTC is used, an interrupt is generated after a block transfer is competed. So your ISR is called after the four values are written to ram. If you are sure that wakeup and also handlign the four values can be done faster than the completion of th enext conversion, you canuse repeat sequence of channels. If you're not fast enough, the DTC will overwrite the last sequence in ram while you're still workign on it. Then you should use single sequence of channels mode and restart the ADC when you're done. However, this will increase the time between the last sample of one sequence and the first sample of the next sequence. Probably not an issue.

      2. see 1. Once DTC is done, ADC10IFG is set. If DTC is used, the ADC10 will not generate ADC10IFG for every individual conversion. (well, the ADC10 will generate the signal, but it is forwarded to the DTC internally then)

      3. not 'should', but 'is'. For a DMA transfer, MCLK is used. The clock cycle is used for DMA and not for the CPU. However, in LPM, MCLK is off, so it needs to be reactivated first (done automatically), and in LPM1 and deeper, this might mean reactivating the DCO, with some delay. Worst case, the ADC10 will have the next result before the transfer is done. Which dumps the unwritten last value then.

      _____________________________________
      Before posting bug reports or ask for help, do at least quick scan over this article. It applies to any kind of problem reporting. On any forum. And/or look here.
      If you cannot discuss your problem in the public, feel free to start a private conversation: click on my name and then 'start conversation'. But please do so only if you really cannot do it in a public thread, as I usually read all threads. And I prefer to answer where others can profit from it (or contribute to it) too.

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Aamir Ali
      Posted by Aamir Ali
      on Apr 16 2012 03:23 AM
      Expert2115 points

      I HAVE WRITE CODE FOR FOLLOWING TASK. iS IT RIGHT METHOD.

      1. SAMPLE A3 TO A0 WITH dma & dtc. PUT VALUES TO RAM ADDRESS 200H-207H.

      2. gO TO SLEEP UNTIL CONVERSION COMPLETE

      3. WORK WITH THESE VALUES.

      4. GO TO SLEEP MODE.

      5. WAKE UP & GO TO STEP 1.

      (ABOVE STEPS WILL OCCUR IN 2 SEC EACH INCLUDING SLEEP. & WILL BE IN FIELD FOR 3 MONTH CONTINUOUSLY. IS IT RIGHT WAY)

      void main(void)
      {

          
          ADC10CTL0 = SREF_1 + ADC10SHT_3 + ADC10SR + MSC + ADC10IE;                // ADC10CTL SETTINGS
          ADC10CTL1 = INCH_3  + ADC10SSEL_3 + CONSEQ_3;            // Repeat CHANNEL FROM A3 TO A0
          ADC10AE0 |= 0x0F;                         
            ADC10DTC1 = 0x04;                         // 4 CONVERSION conversions SO THAT RESULT INTO 0X200-0X207h

          for(;;)
          {  
                ADC10CTL0 |= (ADC10ON + REFON);    //turn on ADC
              __delay_cycles(40);             //settling time 30us for reference buffer
                                          // extra time 10us  in case of variations
              get_adc_value(); 


          __bis_SR_register(CPUOFF + GIE);        // LPM0, ADC10_ISR will force exit
          _NOP();
                                   

              ADC10CTL0 &= ~(ADC10ON + REFON);             //turn off adc module

           do_some_other_task();
          }

      }

      void get_adc_value(void)
      {
          ADC10CTL0 &= ~ENC;
          while (ADC10CTL1 & BUSY);               // Wait if ADC10 core is active
          ADC10SA = 0x0200;                        // Data buffer start

         ADC10CTL0 |= ENC + ADC10SC;             // Sampling and conversion start
         
      }


      #pragma vector=ADC10_VECTOR
      __interrupt void ADC10_ISR(void)
      {
        __bic_SR_register_on_exit(CPUOFF);        // Clear CPUOFF bit from 0(SR)
      }


      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Aamir Ali
      Posted by Aamir Ali
      on Apr 20 2012 01:29 AM
      Expert2115 points

      any help abt dis

      I want 2 reduce power consumption to minimum with Vcc=2.5V min. Is this best method with MSP430G2553 or other methods can be done to reduce power.

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Aamir Ali
      Posted by Aamir Ali
      on Apr 24 2012 04:12 AM
      Expert2115 points

      any help abt dis.............

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Jens-Michael Gross
      Posted by Jens-Michael Gross
      on Apr 30 2012 08:39 AM
      Guru139900 points

      Aamir Ali
              ADC10CTL0 &= ~(ADC10ON + REFON);             //turn off adc module

      You should clear ENC too. You actually cannot clear ADC10ON if ENC is set.
      However, unless the additional current is an issue, you should simply leave ADC10ON and REFON set (note that the reference needs some settling time after being switched on).

      Besides this, well, the code look sgood, so why do yoou ask? Compile it and try it. And check the results. And if something is not as you expect, tell us what you expected and what you unexpectedly observed instead. The we might be able to see what's going wrong. Please don't abuse this forum as a preventative code validator. :)

      _____________________________________
      Before posting bug reports or ask for help, do at least quick scan over this article. It applies to any kind of problem reporting. On any forum. And/or look here.
      If you cannot discuss your problem in the public, feel free to start a private conversation: click on my name and then 'start conversation'. But please do so only if you really cannot do it in a public thread, as I usually read all threads. And I prefer to answer where others can profit from it (or contribute to it) too.

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    TI E2E™ Community
    • Support Forums
    • Blogs
    • Videos
    • Groups
    • Site Support & Feedback
    • Settings
    TI E2E™ Community Groups
    • TI University Program
    • Make the Switch
    • Microcontroller Projects
    • Motor Drive & Control
    Other Communities
    • Deyisupport
    • Designsomething.org
    • beagleboard.org
    • TI on Element 14
    • TI on TechXchangeSM
    Other Technical & Support Resources
    • WEBENCH® Design Center
    • Product Information Centers
    • Technical Documents
    • TI Design Network
    • TI Technical Articles
    • TI Training

    All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

    Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

    Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
    TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

    TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
    embedded processors, along with software, tools and the industry’s largest sales/support staff.

    © Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
    Trademarks | Privacy Policy | Terms of Use