element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
BeagleBoard
  • Products
  • Dev Tools
  • Single-Board Computers
  • BeagleBoard
  • More
  • Cancel
BeagleBoard
Blog BBB - High speed data acquisition and web-based UI
  • Blog
  • Forum
  • Documents
  • Quiz
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join BeagleBoard to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: shabaz
  • Date Created: 4 Aug 2013 1:17 AM Date Created
  • Views 13368 views
  • Likes 7 likes
  • Comments 93 comments
  • test
  • beaglebone_black
  • bbb
  • texas_intruments
  • measurement
  • bb_black
  • beagle_bone_black
Related
Recommended

BBB - High speed data acquisition and web-based UI

shabaz
shabaz
4 Aug 2013

Introduction

This was a fun yet initially challenging experiment, to find a convenient way to read in data at a reasonably high speed on a BeagleBone Black. This photo shows the results from a mobile, showing a couple of sampled waveforms (100kHz and 1MHz sinewaves in this case).

image

This was another capture of the same signals on a PC (this is an older picture with a x10 probe so the amplitude is a little low in the photo - it should fill the screen).

image

 

What does it do?

In its current state, it grabs analog data from an ADC, and dumps it into memory on the BBB, ready to be displayed or further processed. It could be used for gathering analog information from sensors, CCDs or other data acquisition use-cases. To be reasonably useful, the desire was for it to support 20Mbytes/sec of data or more. It does achieve this, but it is for further study to find higher speed methods.

 

How does it work?

A few different ways were considered. The initial approach was using an FTDI device (USB interface). However the method described here just feeds data directly into the on-chip 200MHz PRU that is part of the Beaglebone’s AM3359 chip. Other methods are possible too.

It was also desired to have an external clock, so that the data could be sampled at a determinable jitter, so that it could be useful for frequency analysis, or maybe Software Defined Radio (SDR).                                                           

The overall approach that was taken is outlined here.                                                                                                                                                                                  

image

The analog signal was amplified and fed into a high-speed ADC (A parallel bus ADC is needed in order to achieve high throughput).

A pre-built amp+ADC board was used from KNJN (note: in my opinion it is not a good choice, because it is closed source; there are no circuit diagrams for it so it is hard to modify it, the datasheet is sparse and also it is expensive; better to construct one up manually).

A linux application (called adc_app in the diagram) was used to kick off the PRU code which reads in data and dumps to shared memory. Once complete, the adc_app stores it in a .csv format file.

I wanted to try out Node.js ever since a recent blog post, so some very basic code is used to create a HTTP server.  The real-time comms between the browser and web server is achieved using Socket.IO which is a way of passing arbitrary data.

A photo of the overall system:

image

A bit more detail:

image

The underside was more untidy!

image

 

ADC Detail

As mentioned, a ready-built amplifier and ADC board was used. The on-board oscillator was disabled, so that an external one could be fed in. I needed a clock of 20MHz or less, but I only had a 32MHz oscillator at hand and didn't want to wait (and the local Maplin store doesn’t sell any 3.3V-compatible logic to divide by two!) and I’m not entirely sure how long the shared memory write takes, and I did experience lost samples with the 32MHz oscillator. I plan on trying frequencies in the range 14MHz-20MHz to find the upper limit for missing no samples; for further study!

Note that some ADCs will have specific requirements related to the clock and duty cycle.

The ADC on this particular board was ADC08200 but an ADC08100 or ADC08060 could have been used at lower cost).

 

Buffers

These were extremely important for two reasons. One reason is that the pins to the BBB that I wished to use need to be isolated during power-up, because they are used for selecting the boot method. If there was any unusual level on the pins upon power-up then the BBB will not boot from the eMMC. So, a tri-state buffer is needed.

The other reason is that there is a fair bit of capacitance and it is highly likely that the ADC may not be able to directly drive the pins at high speed. I actually came across this problem while trying to connect a camera to the BBB. I struggled for days without realising that the camera could not support the load. So, the buffers are likely to be essential for most designs using the pins that were selected. I used a 74LVC244A device as a buffer.

Note that the clock also needs a buffer, unless significant jitter is acceptable. No tri-state is required here, so I used a MC74VHC1GT50.

 

PRU code

The PRU code uses shared memory for communication. I designated a single byte of shared memory to be used for commands. When run, the PRU sits in a loop waiting for the command to instruct it to begin the data capture.  PRU GPI mode is used which allows inputs to be read at the processor speed of 200MHz with no varying latency. Just a few instructions are needed to populate the data into shared memory. No attempt was made to pack the data, and 32-bits are used to store the 8-bit sample. This is not such a bad idea, because in future the ADC could be swapped out to a (say) 10-bit ADC with no code change on the PRU.

There are two PRUs in the AM3359. There are a total of 12 PRU GPI capable pins available that are connected to PRU 1 which are brought out to port 8 on the BBB. So, this means that realistically 10 or 11-bit is about the limit for high-speed parallel ADCs connected in this manner. Still, at (say) 16MHz clock, this would equate to 20Mbytes/sec of data for a 10-bit ADC.

EDIT: See comments section - on PRU0, all 16 pins are in theory available).

The pins used are shared with the HDMI interface; it proved necessary to disable the HDMI interface by recompiling the device tree file in the /boot folder (EDIT: See Brian's comment below for a better method to disable HDMI). Since I wished to display the data using a web browser, I have no issue with losing the HDMI.

Once the data has been captured (2000 samples in this example), the command byte is acknowledged, so that the Linux hosted application can know that the PRU has completed. The PRU now sits and waits for a new instruction from the Linux hosted application.

These were the pins used. They were used as D[0..7], CLK and a *EN signal for controlling the octal tri-state buffer.

image

 

Linux hosted application

The adc_app program is very simple (C code); it downloads the assembled code into PRU1 and executes it. The resultant data in shared memory is dumped to a text file and then the program exits.

 

Node.js application

The Node.js application creates a HTTP server (no need for apache!) and a Socket.IO connection. This sits and waits for a connection from any web browser. Once it receives a connection, it will send a handshake and then wait for a ‘capture’ command from the web browser. It then calls the adc_app program. Once complete, it opens the file of captured data and transmits it over the Socket.IO connection line-by-line. This is very inefficient, but it is proof-of-concept code that could really be optimised.

 

Web Page

The web page served up contains some small bits of code to handle the Socket.IO connection and send a ‘capture’ request when a button is clicked and to display the received data with a canvas element and pixel manipulation.

 

Summary

In conclusion, it is possible to read analog data with low jitter at fairly high speeds without any external FIFO or logic (beyond a simple buffer IC), while continuing to run Linux applications such as a web server. It is also nice that a web-based UI can be rapidly created using Node.js.

 

Note: It is still for further study how long captures can be sustained and read off by the Linux application without any data loss. If it can be sustained, then it could be useful for SDR applications just about, although a higher speed (and better ADC) would be preferable.

 

Note2: The waveforms used to test out the system were generated by the same BBB using a low-cost ‘direct digital synthesis’ (DDS) board. That’s a subject for a later date.

 

Using the code

Disable the HDMI as mentioned in the comments.

You may need to install Socket.IO. Type this to install it:

npm install socket.io

 

Create a development folder and then the attached code can be unzipped to (say) /home/root/development/adc.

 

make clean
make
cp BB-BONE-HSADC-00A0.dtbo /lib/firmware/
source install_hsadc_cape.sh
node index.js

Then, navigate to http://xx.xx.xx.xx:8081/index.html

 

If you want to make subsequent changes, there is a bug in the makefile, and you will need to issue 'make clean' before typing 'make' whenever any change is made in the C code.

If you just want to reassemble the PRU code, type 'make pru' (no need for 'make clean').

Attachments:
adc_v1.zip
  • Sign in to reply

Top Comments

  • Former Member
    Former Member over 12 years ago in reply to bwelsby +2
    Brian Welsby wrote: again are all the pins available? I'm beginning to wonder how long it's going to take for somebody here to decide they want a BBB with a few differences, take the available designs…
  • stanto
    stanto over 12 years ago in reply to morgaine +2
    These values sound very small. Perhaps I have misread but is this relevant ? https://groups.google.com/forum/m/#!topic/beagleboard/Gb6xL7V7Z00
  • morgaine
    morgaine over 12 years ago +1
    After your I2S audio DAC article, I was wondering when the ADC one would appear. In addition to SDR, I'm interested in ADC functionality for the multifunction instrument idea. Since you pointed out that…
  • morgaine
    morgaine over 12 years ago in reply to johnbeetem

    That's very interesting John, and indeed, I agree with pretty much everything you wrote there.

     

    However, I can't find anything remotely related to what I wrote in it, so I'm a bit bemused that you started it off with the statement "I disagree". image

     

    Despite the lack of any related points, I take your strong claim of disagreement to mean that you are happy with the status quo, namely:

     

    • Total dependency of alleged OSHW supporters on the whims of commercial board manufacturers.
    • Zero interoperability of board products supplied as "OSHW" except through USB and Ethernet.
    • The "OSHW" label effectively being used as a fiction because BGA is in practice out of bounds.
    • SBCs as just another piece of consumerism and with no possibility of upgrading, only repurchase.
    • OSHW supporters left outside of the computer design loop (unlike RepRap).  We are not worthy.

     

    If I understood your "I disagree" correctly, all I can say is, your bar isn't set very high. image

     

    Morgaine.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • johnbeetem
    johnbeetem over 12 years ago in reply to morgaine

    Morgaine Dinova wrote:

     

    I'm clear on what (I think) is in the long term interests of the OSHW community (which is a substantially different topic to the interests of general users, I know), and that is to depart from dependency on commercial board offerings altogether.

    I disagree with this.  There are some terrific commercial boards out there, especially BBB.  IMO the problem is that there's not an easy way for community members to get stable software, so you have Ångström on BBB as the default in spite of its problems.  If someone(s) were to step up to the plate and provide the support necessary for a good alternative, there would be a good alternative.  Unfortunately, too often the kind of people who know how do this -- the kind who think building a new Linux kernel is easy -- cannot understand why anyone wouldn't want to claw up that learning curve and don't see what the problem is.  Some have derogatory terms for people who only develop in user-land.  I've looked into the Linux kernel, and it's a very impressive mainframe kernel.  But there's no way I'd ever want to become an expert in it -- too many other interesting things to do.

     

    I see OS support as being critical for a successful SBC.  Would RasPi have gotten anywhere without a couple guys porting Debian for the fun of it -- if I understand the story accurately.  What would have happened if RasPi had been dependent on Fedora -- declared the first "official" OS for RasPi?  The idea that one can simply produce a piece of OSHW and "the community" will magically step up to the plate and support an OS is IMO naïve.  It happened with RasPi because it was clear from the beginning that a "US$25 GNU/Linux box" would be a hit, so it would be worth supporting, but it could very easily have not happened at all.

     

    So to me creating a new non-commercial OSHW board doesn't make sense unless there's a firm commitment to support the OS.  But that same firm commitment could be applied to a commercial OSHW board, so there's really no need for the non-commercial board.

    We really don't need capes on beagles, UEXT on Olimex boards, shields on Arduinos, and bespoke pinouts on pretty much all headers everywhere.  It creates no synergy.  If it weren't for USB and Ethernet, we'd be living in the electronics equivalent of the bad old days before nuts and bolts were standardized and all fastenings were incompatible --- namely before the dawn of the industrial revolution.  Compatibility for interoperation is crucial for synergy.

    Right!  It's terrible that these boards don't have an S-100 bus!  Or even ISA!  Or a NuBus!

     

    I jest, of course.  But they don't have PCI or PCIe either.  But remember, these SoCs are intended to be the only chip other than memory -- some manufacturers call them "MoCs": motherboards on chips.  The SoC/MoC was never intended to be the CPU for an expandable, PC-like system.  But the S-100 and ISA is only partly in jest: no matter what standard you implement, it will become obsolete PDQ unless it's Ethernet or USB.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • morgaine
    morgaine over 12 years ago in reply to Former Member

    Hah!  You agree on the symptoms, yet you want to continue with the problem that causes them! image

     

    Unfortunately, everyone thinks like you do, not along my lines at all, so I can't claim to have a viable idea when it has no buy-in.  Of course, it could be that it fails on a variety of grounds other than simple non-popularity, but we'll never know.

     

    I'm not expecting to convince anyone, but for what it's worth, lemme address your points. image

     

    selsinork wrote:

     

    I'll just say BGA... The practical reality being that bga's means commercial production. I think we touched on this subject before too.

     

    Sure, BGA is intractable for home construction, and yes, we've discussed it many many times before.  But there are at least three avenues for getting out of the rut:

     

    1. Don't use BGA devices.  Yes, I'm aware of how appallingly this would cut down our options, but nevertheless it is a way forward.  If the end result of this very big sacrifice gained us a platform on top of which massively interoperable computer systems could be built (maybe by combing many less powerful chips), we might be gaining overall from the initial sacrifice, especially if there is the possibility of #2 and/or #3.
    2. Convince manufacturers to make more non-BGA SoCs.  This of course will never happen unless the #1 above delivers a platform that has become sufficiently popular to attract the attention of the commercial sector.  Note that this is not pie in the sky --- Arduino is already such a platform.  Although it's not what I had in mind (it's missing many of the features needed to make it attractive to manufacturers of application processors), it establishes the principle of commercial vendors designing to a third-party standard.  I guess the entire PC ecosystem could be said to provide an even bigger example:  the manufacturers all designed to rather uninspiring standards just because they became ubiquitous and hence successful.
    3. Get small 3rd parties to put BGAs on headers as a commercial enterprise --- NOTE, this is not to produce computers, but only to overcome the BGA hurdle by changing the presentation form factor.  RepRap provides not an exact example of this, but an analogy of sorts --- the RepRap community produced their own 3D printer designs (think "computers") and created their own components like hot-ends and heated beds for them (think "SoCs"), and out of the blue small companies sprung up when they saw a market opportunity and started manufacturing hot-ends and heated beds to the RepRap spec.  Likewise, it's possible to envisage small companies mounting the dreaded BGAs for us, if they saw a ready market because appropriate designs already existed into which their products could be plugged.

     

    To be honest, I'm much less bothered about capes, UEXT and such like as long as the hw uses the normal linux interfaces.

     

    We cope with the situation of course (largely because it's the current norm), but we should be bothered by it because it forces us to treat each board brand as a separate entity --- there is no synergy between them.  If it weren't for Ethernet, we couldn't even combine a TI SoC for its PRUs and a Broadcom SoC for its graphics into any kind of computer system currently defined.  (Thank goodness for I2C/SPI at the primitive component level at least!)  We're not generally fussed by this situation, and few people consider this an actual problem (maybe I'm entirely alone in this), but I put this universal complacency down to nothing more than familiarity with the status quo.

     

    I'll just point out that people used to accept living in caves without fire too --- and they didn't even have an Internet feed! image  One has to be acutely aware of alternatives to dislike present options.

     

    Pinouts wise, as a tinkerer I'd prefer 0.1" connectors since they're easiest for me, but other than that even the board vendors end up at the mercy of the SoC using an akward layout or pinmuxing several wanted features onto the same set of pins, so I expect we can't win this one.

     

    If we remain dependent on commercial standards, you're entirely right, there is no escape from jumping whenever the manufacturers command us to jump.  But that was of course the primary reason why I suggested that the OSHW community could examine the possibility of turning that direct dependency into a less direct one in which we set our own interfacing standards, and commercial products are then adapted to serve those standards.

     

    Everyone wants their own little bit of 'value add' and will persist with that notion even when it drives customers away.

    And I want a pony, but that doesn't necessarily mean I'll get one. image

     

    Joking aside though, the SoC manufacturers only have the option of "adding value" in proprietary ways that create lock-in because they're designing whole computers and we're buying them.  If we designed our own computer infrastructure and only employed their SoCs within subsystems to standard interfaces, they would no longer wield that power.  And the small companies that would make SoC adapters for us (using the RepRap analogy) would be creating components that integrate according to our interfacing specs, so the lock-in shouldn't arise.

     

    Don't see that changing as long as the commercial side exists.

     

    The commercial side will always exist until we can make our own integrated circuits, sure, but the commercial side doesn't have to look like it does at present.  The structure of the commercial dependency can be changed, as I've been describing.  And I'm sure there are many more ways to change it to better suit the needs of the OSHW community.

     

    To a large extent, OSHW is at present little more than a token gesture except in the Arduino sphere where lots of redesigns are developed.  This is because, as far as Linux boards are concerned, our dependency on the commercial side is very strongly based on commercial manufacturers delivering complete computer boards to market, and then us merely ... (warning, swear word coming up) ... consuming them.  This falls far short of awesome.  We're not in control.

     

    All this is especially difficult because it requires a change of mindset, and that's always unpopular. image

     

    Morgaine.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Former Member
    Former Member over 12 years ago in reply to morgaine

    Morgaine Dinova wrote:

     

    I'm clear on what (I think) is in the long term interests of the OSHW community (which is a substantially different topic to the interests of general users, I know), and that is to depart from dependency on commercial board offerings altogether.

    I'll just say BGA... The practical reality being that bga's means commercial production. I think we touched on this subject before too..

    And it's even worse than that.  Even in those few cases (like BBB) where they produce true OSHW for us, it is still designed for their own benefit to provide customer lock-in, not for the benefit of the OSHW community which would find vendor-neutral interfaces far more to its advantage.

    That's a problem, especially when the lock-in is to something like angstrom image

     

    To be honest, I'm much less bothered about capes, UEXT and such like as long as the hw uses the normal linux interfaces. So i2c on /dev/i2c* SPI on /dev/spi* etc. That does require them to sensibly upstream their drivers though. Yes, that probably means I'm coming around to thinking stuff like capemgr is a bad idea.

    Pinouts wise, as a tinkerer I'd prefer 0.1" connectors since they're easiest for me, but other than that even the board vendors end up at the mercy of the SoC using an akward layout or pinmuxing several wanted features onto the same set of pins, so I expect we can't win this one.

     

    Everyone wants their own little bit of 'value add' and will persist with that notion even when it drives customers away. Don't see that changing as long as the commercial side exists. Luckily for us, there's choices and the RPi has reduced prices to the point we can almost consider them throwaway. Still, investing time in differing software interfaces and hardware pinout adapters is a burden on us in one form or another.

     

    Has another vendor of EOMA-68 boards appeared ?  From what I can tell, that Improv board I posted about previously is actually, somehow, rhombus-tech in disguise, or at least I've seen the guy from rhombus going on about it like it's his board. Not that you'd know that from looking at the rhombus website mind you. So, right now, I'm not convinced that it's not just another example of single-vendor lock-in.

    This thread http://lists.debian.org/debian-arm/2013/11/msg00213.html is quite interesting, particularly Richard Jones take on the Improv image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • morgaine
    morgaine over 12 years ago in reply to Former Member

    selsinork wrote:

     

    I'm unclear which model is in the long term interests of the users though.

     

    I'm clear on what (I think) is in the long term interests of the OSHW community (which is a substantially different topic to the interests of general users, I know), and that is to depart from dependency on commercial board offerings altogether.  We are too small a part of any commercial customer base to affect their product directions to any great extent, and so we will always be at a disadvantage as long as we maintain a relationship of subservient dependency on commercial decisions.

     

    And it's even worse than that.  Even in those few cases (like BBB) where they produce true OSHW for us, it is still designed for their own benefit to provide customer lock-in, not for the benefit of the OSHW community which would find vendor-neutral interfaces far more to its advantage.

     

    We really don't need capes on beagles, UEXT on Olimex boards, shields on Arduinos, and bespoke pinouts on pretty much all headers everywhere.  It creates no synergy.  If it weren't for USB and Ethernet, we'd be living in the electronics equivalent of the bad old days before nuts and bolts were standardized and all fastenings were incompatible --- namely before the dawn of the industrial revolution.  Compatibility for interoperation is crucial for synergy.

     

    Unfortunately the desire to define vendor-neutral OSHW systems is almost non-existent, with EOMA-68 seemingly being the only multi-vendor candidate so far.  And even there, although Rhombus-Tech seemed open to community involvement when defining that open standard, the community support never materialized and so they've become yet another company offering a "standard" that nobody else uses, same as EDM. (*)

     

    I'm not sure where all this is going, but I don't think it's heading in any powerful direction for OSHW at all.  The current direction is reasonable for corporate product lines, but a very weak and halfhearted one for us.

     

    Morgaine.

     

     

    (*) PS. And my own preference has near-zero support --- to use 10/100/1G/10G/100G Ethernet for all internal and external interconnect, the "digital wire" of all computing.  Full interoperability would finally arrive.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
<>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube