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.
- 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 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.
– 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.
Dual trace is implemented with both burst mode and continuous mode.
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
@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.
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.