• 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 » Stellaris® ARM® Microcontrollers » Stellaris® ARM® LM3S Microcontrollers Forum » ADC problem
Share
Stellaris® ARM® Microcontrollers
  • Forum
Options
  • Subscribe via RSS

ADC problem

ADC problem

This question is answered
Felipe Freitas
Posted by Felipe Freitas
on Aug 08 2012 20:32 PM
Prodigy30 points

Hello,

I am using the developement kit eki-lm3s8962

I am trying to configure the ADC to read a single sample but it's not working.

I need to read the ADC value in the same time of the encoder so i'm using a timer interrupt handler, and in every interrupt i read the value of ADC and encoder.

I configure the ADC like this:

SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC);
ADCSequenceConfigure(ADC_BASE, 0, ADC_TRIGGER_ALWAYS, 0);
ADCSequenceStepConfigure(ADC_BASE, 0, 0, ADC_CTL_CH0 | ADC_CTL_END);
ADCSequenceEnable(ADC_BASE, 0);

In the interrupt handler i read the value of ADC directly from ADC_SSFIFO0_R (the "ADCSequenceDataGet(ADC_BASE, 0, &ulValue);" doesn't work)

The program apparently works fine but i'm reading the ADC value from  8 past samples, for example

Real sample = [  1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0]

i'm reading = [X X X X X X X X 1 2 3 4 5 6 7 8 9 0 1 2 3]

Someone can help me?

Best regards,

Felipe

lm3s8962 ADC
Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • Jonathan Guy
    Posted by Jonathan Guy
    on Aug 09 2012 09:23 AM
    Expert5700 points

    Hi Felipe,

    If I understand your configuration correctly, then the result you're seeing is expected (except for the bit about ADCSequenceDataGet(..) not working).

    Sample Sequencer 0 has an 8 deep FIFO.  If the ADC is free-running, then when your timer interrupt occurs (assuming it's interval is > 8 X the ADC interval), then you'll need to read 8 results from the FIFO to get to the most-recent conversion result.  Presumably the most recent ADC result is the one you want since it aligns to the Timer event.

    Try switching to Sample sequencer 3 which has a 1 deep FIFO.

    Jonathan Guy

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Felipe Freitas
    Posted by Felipe Freitas
    on Aug 13 2012 08:54 AM
    Verified Answer
    Verified by Felipe Freitas
    Prodigy30 points

    Hi Jonathan,

    You understood what was happening,  

    About  use the SS 3, was my first test but in the future i will need to use another SS.

    I think i unterstand the FIFO now, and doing some tests i think i solve the problem

    I am reading the ADC_SSFIFO0_R 8 times and only storing de last one.

    I will make some tests but i think it's working now.

    Thank you for your attention,

    Felipe

    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