Oscilloscope with Stellaris® LM4F120 LaunchPad Evaluation Kit

@September 14, 2014 – 19:06

Way back I bought couple of Stellaris® LM4F120 LaunchPad Evaluation Kits. Did some experimental stuff to learn it. After that one of it settled in my junk box and other one I am using as logic analyser using OLS (Please see here and here for more details).

Few weeks back I wanted to measure(in fact, monitor) current consumption of my other project, Remote controlled LED ceiling light. As I have ACS712 thought of using it, but my regular current meter is not accurate enough to measure such a small current(voltage) changes. And more over, current consumption is not static it varies depend on in which pattern I am driving my LEDS. So wanted to check with an oscilloscope to look how it behaves. I wanted to see both digital driving signals and analog signal with sync so that I can understand when current consumption is low and when it is high.

As my LaunchPad is sleeping, wanted to wake it up as it has ADC with 12-bit resolution which is good enough in my case. And it has USB device mode support as well. But do not want to write entire UI application for an Oscilloscope as it require lot of time and skills.

So, did some search on internet. Luckily saw this blog NJC’s LaunchScope (A LaunchPad Oscilloscope). This project used a another library(Berstein’s library) for real time waveform display. This is what I am looking for. The main application reads data from MSP430(An another LaunchPad) and sends to Berstein’s library. Even though I am using different LaunchPad. This was written mainly for MSP430 LaunchPad, but mine is different. So, I have downloaded source code and modified computer application as I want to implement Burst mode as well. And LaunchPad side implemented fresh program by following same design as NJC’s LaunchScope. Thats it, basic functions are done and is up and running.

NJC’s application has continuous mode which reads ADC results over serial port(UART) continuously and add to Oscilloscope view. This application has test capability to test throughput.

Test results

  • Tested with my MSP 430 LaunchPad over UART with 9600 baud. I could achieve 6.28 kbps throughput.
  • Tested with Stellaris LaunchPad over UART with 128000 baud. I could achieve 95.06 kbps throughput.

As the ADC sampling speed is limited by this throughput this speed is very less when compared to what Stellaris launcPad can do. So, USB is the way to go. But as USB is not as straight forward as serial tried with another approach until I get it working with USB. That is “Burst Mode”. In this mode host will request for data, LaunchPad will first captures ADC samples and stores in its own buffer(internal SRAM) then once it captures sufficient data then it transfer data to host. As in this mode, first captures complete data and then transfers the ADC capture speed will not affect by UART throughput. But the major limitation is with LaunchPad’s internal buffer which limits the Memory Depth. With single trace I could choose ~6Kpts as memory depth. But, with dual/triple trace this will become problem as it cannot accommodate more data with limited internal memory Memory Depth will be decreased. For example for dual trace it will decrease to ~3kpts(for each trace) from 6Kpts. To overcome this internal buffer limitation or throughput, moving to USB is the only solution. Does anybody has any other better solution? Please suggest.

Source code

Source code consists of two parts. One is computer application and another one is LaunchPad. The computer application was written in C#. As I never worked on C#, thought of writing my own computer application in VC++/VB, as I am very much comfortable with them. But again that requires lot of time, so, to save time started learning and C# 🙂

In no time I could download the C# computer application, setup development environment, and started modifying existing code to suite as per my requirements. It looks very easy.

Computer application

Without burst mode it will be same as NJC’c and can be downloaded from his blog – NJC’s LaunchScope (A LaunchPad Oscilloscope).

– With burst mode – will upload to GutHub soon.

LaunchPad source code

is on GitHub and is available here.

@September 20, 2014 – 01:33

Dual trace is implemented with both burst mode and continuous mode.

Results

First peek is with 200Hz, and subsequent peeks are 2KHz. PC is used to generate sample wave form using in built stereo sound card with Sine wave in one channel and Square wave in another channel. Only +ve half cycle is captured due to limitation in ADC. Need to try with ADC with full cycle.

  • ADC Sampling:1MSPS
  • Mode: burst mode
  • Memory depth: ~15.7Kpts (Shared by both the channels)
  • Channels: Two

Oscilloscope Screenshot 01

@September 25??, 2014 – 23:51

Full cycle (+ve and -ve) trace capture is done. This is done by using external circuit which is used to adjust the offset of -ve cycle. Will post picture.

@October 11, 2014 – 23:15

USB mode implementation is done. Burst mode and continuous burst mode both are working perfectly. Could achieve throughput of around 800 kbps.

To be done

  • Triple trace
  • Full cycle(+ve and -ve) capture – Done.
Advertisements

6 thoughts on “Oscilloscope with Stellaris® LM4F120 LaunchPad Evaluation Kit

  1. Just bought myself a Stellaris® LM4F120 LaunchPad and i am very keen in learning to program an oscilloscope! Hope i can do it!

  2. Hello Harischandra,
    Excellent job on your success to get the USB mode working with a excellent throughput. I am really interested in your project. Would you be sharing your code any time soon?
    Regards

  3. Hi, i apreciate Your work. Is there any chance for .bin file compiled for Stellaris Launchpad? I’m fighting with compiler for 10 hours and none of compiled by Code Composer Studio files work with my Launchpad.

    • Hi Michal, Unfortunately I do not have any binary at the moment as from more than a year I have not done any thing to this. What error you are facing, may be I will try to help on that. Did you tried with any other sample code and did it worked?

  4. Hello Harischandra,

    Thanks for sharing very usefull project. I have been working to make an oscilloscope using stellaris launchpad. But I have some issue. I don’t understand that we storage 1M sample in one second but we can send 115200 bit in one second. If we don’t send all data, why do we measure at 1Mbps?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s