Interfacing BBB with Windows Computer

Hello everyone.

I’m pursuing a college project which requires the use of a single board computer. I have worked with Arduino ATMEGA2560 on my computer with OS Windows 7. I’m new to BBB. I have read the “Getting Started with BBB” on its website. Gone through the wiki page that instructs how to install a distro of Ubuntu on BBB. But I still have some major questions about BBB interfacing with my computer. The questions are:

1- BBB comes shipped with default linux distro installed on it, that is Angstrom. My computer has OS Windows 7. How can I create an interface between BBB and my computer? If I want to control BBB from my PC as I did with Arduino - which was plug & play?

2- I want to work in C++ with my BBB. Does that require IDE? Any software that I need to install on my PC?

3- Does my computer need to have Angstrom too or it can work with BBB (Angstrom) and its own OS as Windows 7?

4-If I am to switch to another OS for the BBB, should I shift to Ubuntu? Or Angstrom will work fine?

My requirements for this project are high speed processing and memory storage which the arduino can not provide.

If you can please answer the questions or direct me to some links for further reading. I’d really appreciate it.

Thanks.

The question is, what you plan to do exactly. There is e.g. a nice process control software available at http://openapc.com/ which is also available for BBB/Ubuntu ARMHF.

With this software you shoukld be able to set up a project that “interfaces” between host PC and BBB.

Right now the basic plan is to

-control my Input and Output pins on BBB

-generate PWM for a DC motor

by programming in c++ using my window 7 computer. I have understood the interfacing. This link was very useful:
http://inspire.logicsupply.com/p/beaglebone-getting-started_3.html

But now my questions:
-how to do programming in c++

  • choice of library to use. Also, do I require Cloud9 IDE?

Cloud9 is JavaScript only.

For C++ just install the GNU compilers (execute on BBB)

sudo apt-get install build-essential

The best library for fast and easy GPIO and PWM is libpruio.

Thank you.

What about BlackLib? There is a library for BBB to access its GIOP and generate PWM etc?

Plus is this an efficient way to code in the long run?

I shall be working on my Windows computer and pursuing cross-compiling for my Angstrom BBB using Eclipse IDE (in c++). I have checked some tutorials out and they seem complex as to access pins or to make the BBB do something. Is it because of using a non-linux machine?

Should I shift to a a linux computer for this project? We are looking
• to control a motor
• generate PWM
• access GIOP
• perform lengthy calculations etc.

IS there a reason your sticking with angstrom ?
Debian seems to be the default choice and most updated linux for the BBB.
Robert Nelson is pushing full steam ahead on debian for us all.

you might want to just install linux and a toolchain in a VM on your
windows box

I read that BBB is shipped with Angstrom. And I only have to update the Angstrom if I want to but even without it, I can connect it to my PC and using PuTTy, make a connection between the two.

But I’ll have to install Debian on my own for the BBB, no?

Okay, if I do install Linux on my windows using VM, which distro? The same that is on my BBB? And then there will be no need of cross-compiling? (Once I am done with the project can I uninstall that distro from my computer - that was just a bonus question. :smiley: )

Finally, is the programming different in cross-complaining than it is when using Linux using VM on my windows? And I thought you required toolchain when you’re cross-compiling?

I dont think that angstrom is being updated for the BBB anymore
Debian is what is currently shipping with all the boards i have got.

I would install debian in a VM and get a ARM toolchain installed
https://groups.google.com/forum/#!topic/beagleboard/h0axz1Jgv6U

I neither use a cross-compiling tool chain nor Eclipse IDE (too bloated).

My PC runs Xubuntu (LINUX). The BBB runs Debian (LINUX kernel 3.8.13-bone37) and is connected over LAN. I host the source files on the BBB (SD card) and load them over the LAN in to Geany IDE (on PC), writing back over LAN as well. Then I compile on the BBB with a native compiler, controlled by an SSH connection. Testing over SSH as well.

Blacklib is a wrapper around the sysfs features (for easier access) and therefor much slower than libpruio, which operates the hardware directly (and in realtime for ADC samples).

Should I shift to a a linux computer for this project? We are looking
• to control a motor
• generate PWM
• access GIOP
• perform lengthy calculations etc.

Shifting to LINUX is always a good idea.

What do you mean by ‘control a motor’? AC, DC, stepper, …?
What do you mean by ‘perform lengthy calculations’? Which input (digital QEP or analog sensor)? (libpruio will have QEP support in next version.)

Can’t say I agree with “shifting to Linux is always a good idea”. I can not speak for any other OS( non Linux ), but can say that you can use Windows to even cross compile for the beaglebone black using Windows, if you wish. Generally though you’ll see a lot of people basing Windows, but I’d submit the reason why this bashing happens is because these people have no clue how to use Windows properly. Just like any other OS out there, you need to learn how to use it in order to use it well. As like any other OS, it too is not perfect( Non are ).

With the above said, My main systems are Windows, but my dev machines all run Debian i386 except for one. The dev machine I use most does not even use X ( command line only ), while the only system I have that runs X, uses Lubuntu 14.10. The cool thing about Lubuntu, is that you can install a gcc cross compiler for the BBB through APT. This is to say, by using the standard repos.

Mostly in Windows I only write code, in my own Text editor of choice, Then, I compile natively on the beagelbone black. I feel most comfortable / productive in Windows when writing code using the tools I am most familiar with. SO I would submit to you, use what makes you feel most comfortable. You will however at minimum need a Linux VM if you wish to cross compile the kernel. Which personally is the only thing I’ve used a cross compile toolchain for. As I run Debian on my dev machines for this, and several other reasons.

TJF,

Thank you for your input. I do realize that my goals seem a bit ambiguous right now in reference to BBB, it is because I have a little difficulty understanding how it works. Having used the Arduino, I forget it is not as easy as to write the code in an Arduino software and simply burn it to the board that is connected to my PC using the USB cable.

My project is based on Brain Computer Interface: a headset will extract brain signals from a user, those signals shall be amplified, filtered, extracted and finally classified. These signals will then determine one out of the two movements to be performed on a robotic gripper having (at the moment) two fingers and a thumb.

Previously, this project was done using offline data. Ours require processing those signals in real time.

My senior who pursued this project using Arduino Uno told me when I asked about:

- what is the microcontroller used for
The arduino was connected to a SD card shield that used SPI communication to transfer data from the card to the controller. The card had a file with the EEG raw data on it in form of a text file.
- what was the input to your Arduino?
A text file with eeg raw data.
- what was the output?
A signal on a port that ran h-bridges. (h-bridge logic)
(Yes, controlling a DC motor)

And thank you for your response William Hermans.

I have some questions.
-When I am using a windows machine and I need to write a code for a Linux machine, I require cross-compiling?

-What is your recommended choice for a text editor on a windows machine?

-You said you compile your code natively on the BBB, what does that mean? You mean uploading/burning the code?

-Finally you mentioned, “you wish to cross compile the kernel”, can you please elaborate that?

(Sorry about lack of knowledge of Linux & its code-compilation procedures. I have been studying them but it helps a great deal to ask people who have used it.)

And thank you for your response William Hermans.

I have some questions.
-When I am using a windows machine and I need to write a code for a Linux machine, I require cross-compiling?

No. I recommend cross compiling the kernel on a PC however. The reason is simple. It would take days to compile the kernel natively. Also, the person( Robert C Nelson ) who “maintains” the current shipped images for the beaglebone blacks ( among many other devices / boards ) has excellent instructions on how to set this up. https://eewiki.net/display/linuxonarm/BeagleBone+Black

So for instance Most of the applications a single developer will write, will take mere seconds to compile natively on the Beaglebone black. Then some larger project such as say Nodejs, will take 30-60 minutes to compile natively. In the above Nodejs case you need to weight your options while considering cross compiling. Are you very familiar with gcc toolchains, and setting up a cross compile toolchain, or would you have to spend days, weeks, or possibly months to figure this out ? In my own case, I know how to setup gcc to a point, but figured my time would best be served just doing native compiling, and moving on to my next hurdle - if any.

Anyway, I could go on for days about the various aspects of how, when, or why ( or even why not ) to cross compile. So, I’ll just leave it at this for now and wait for specific questions.

-What is your recommended choice for a text editor on a windows machine?

I recommend whatever you feel most comfortable with. Personally I prefer sublime text 3, as I also prefer dark themes while writing code( easier on the eyes ). Also you can use it as a simple editor, or use some of the more advanced features such as multi line editing ( at once ), or even use vim inside the editor. It’s called classic mode or something like. Anyway, this is more than just about the editor in this case as it has binaries for Linux, and I think OSX too. for Windows It is kind of hard to explain, but its part esthetics, part feeling “polished”, and generally my ability to get things done faster while working in Windows in this capacity. This would probably more of a subjective type thing. But having years ( well over 15 ) experience with Linux, and Windows, I prefer my desktops to be Windows, while most / all my server, and some of my workstation stuff to be done under Linux.

-You said you compile your code natively on the BBB, what does that mean? You mean uploading/burning the code?

This means you use the compiler(s), provided by the OS you’re using, on the hardware your using it on. In this case, you’d use the armhf versions of the gcc toolchain as provided through the Debian package manager APT. So as a simple example. You write the code in text format on a Windows machine, potentially. Then you move these files over to the Beaglebone black, where you then compile the code with whatever compiler you need to use. Some would argue this is bad practice as Windows versus Linux line breaks can be different. But if you know how to deal with this, there is no problem ( UTF-8 files )

-Finally you mentioned, “you wish to cross compile the kernel”, can you please elaborate that?

I’m not sure what you’re asking here. DO you not know what a kernel is ?

(Sorry about lack of knowledge of Linux & its code-compilation procedures. I have been studying them but it helps a great deal to ask people who have used it.)

Let me just say that it would probably behoove you to pick up a good book on gcc toolchains. Which is something I’ve yet to do, but I’ve been lucky enough to know people who do, and having the chance to pick their brains once in a while. I pretty much cut my teeth on the gcc toolchain for the MSP430 launchpad as provided by the Energia project. Essentially, I did not like the Energia ( wiring ) IDE but the gcc 4.6 toolchain binaries provided with it worked very well. Also, when the beglebone black first came out, we got two, and I knew nearly nothing about embedded Linux. It just took some time, reading, and trial + error to figure out many of the things I understand today.

One of the most memorable for me was reading through tons, and tons of uboot information. Trying to get NFS root working on our beaglebones. Until I finally understood enough to ask a decent question of Robert Nelson. Which he pointed me to a C header file that filled in all the blanks for me.

Anyway, the over all point is - If you’re willing / wanting to learn. Then you’re pretty much in the right place with the beagelbone black.

Some would argue this is bad practice as Windows versus Linux line breaks can be different. But if you know how to deal with this, there is no problem ( UTF-8 files )

Oh, and a good editor will ask you when you first set it up. What style line breaks you want to use. Unix, Windows, and I believe a third options I do not recall. Ofcourse, In this case, you’d wantto select UNIX style line breaks.

In case you’re unfamiliar with what line breaks are . . . it’s the “code sequence” editors / OSes use when you start a newline by using the enter key. Windows for instance uses ctrl + lf, where as I believe Linux just uses lf.

Yes, I use BBBs as standalone system. But I don’t connect a keyboard, mouse or screen. Instead I connect LAN and use the PC to control the BBB.

On LINUX it’s simple to remote control other systems over LAN. It doesn’t matter which version is installed on PC or BBB. (But when both versions are based on the same distribution, like Ubuntu is based on Debian, you need not understand different file systems.)

Don’t use cross-compiling at the beginning. You’ll face a bunch of additional pitfalls and it’s complicated to help you in case of any trouble. Just store, compile and test your software on the BBB (SD card).

Your project sounds interesting. Another user of libpruio made a low cost EKG system.

I learned

  • type: low speed controller with complex signal processing.
  • input: analog from Brain Computer Interface (number of channels?). What about the former mentioned ‘lengthy calculations’?
  • output: 1 PWM signal to a H-bridge.
    The BBB can sample up to 7 channels of ADC data (12 bit, 0V to 1V8). Further channels need additional hardware.

The BBB has up to 5 PWM output pins (0.5 Hz to 50 MHz).

The project seems to be doable.

BR

Willam Hermans, thanks for very thorough response. I have to dig in deep for the terms and study about gcc tool chains, cross-compiling kernels and natively compiling on the BBB before I can ask any more specific questions. Your answers have been a great help. Much appreciated.

I have one last question about the example you gave of compiling the code on BBB after transferring it from the Windows computer in a text file. How do you transfer this file - say through LAN or serial connection, once it is transferred, how are you compiling it? I’m confused about who is controlling the compilation of the code on the BBB - your desktop, correct?

TJF, I am going to stick with a Linux desktop computer to connect with my BBB. You’re right. The Windows interfacing with the Linux device it a bit complicated right now. Once I get the hang of it, I guess I experiment with other OS. I searched alot on the internet - maybe not enough - but when I look for BBB tutorials, most of them assume that the PC that the BBB is interfacing with is a Linux machine. How come? I mean, is it a general recommendation?

So it’s alright to go forward with a Angstrom BBB interfacing with a Ubuntu desktop computer. I’m thinking, not pursuing Virtual Machine but installing only one OS on the desktop. Does VM perform the job as well, though?

:smiley: The lengthy calculations refer to feature extraction of the signals obtained through EEG data. And after feature extraction, applying a classifier on them. There needs to be alot of reading and studying on that. But thanks for giving me the heads up! i think I know somewhat where I am headed.

Just a note. Angstrom does not get the tender loving care that debian
gets on the BBB

you may want to update your BBB to the most recent debian version

> I have one last question about the example you gave of compiling the code on BBB after transferring it from the Windows computer in a text file. How do you transfer this file - say through LAN or serial connection, once it is transferred, how are you compiling it? I’m confused about who is controlling the compilation of the code on the BBB - your desktop, correct?

No. Natively means in this case the beaglebone would be compiling the code. Example:

  1. Code written on any type of system - We’ll assume x86 PC, running Linux, OSX, or Windows. External hardware / operating system does not really matter, as the code is just a plain text file, using a specific extension based on which language you’re writing code for.
  2. You then move the file to the target - In this case, the beaglebone black.
  3. Once the source file(s) are on the target, you then compile the source file(s) ( code ) into a binary executable the target can execute.

I do believe you can transfer files between systems using serial, however I have never really looked into this as I have had no need ( yet ). I use ethernet, and there are many different ways to use ethernet to transfer files between systems. Mainly for this situation, I use Samba http://en.wikipedia.org/wiki/Samba_%28software%29 , But I also use NFS http://en.wikipedia.org/wiki/Network_File_System , and sometimes sshfs http://en.wikipedia.org/wiki/SSHFS

In the case of Windows<->Linux Samba , on the Windows side, you can mount the Linux Samba share on a Windows machine as it were a local drive. That is to say, you can use it as if it were local storage. So long as you have Samba configured correctly, and both machines are running at the time.

My setup is rather complex for a beginner to understand, but in a nutshell, I run a Linux machine that hosts the root file system for the beaglebone black. This is what I use NFS for. This same Linux machine also runs a Samba share of this top level root file system directory. Where then my Windows machine picks up the share, and uses it as local storage.

So then, I actually have several NFS shares for various builds / purposes. “Production”, and development as two examples. But using these two examples, allows me to develop binaries from my development share, to be used on the production share. The immediate benefit of this is that I can keep my “production” image as small and minimal as possible. While still having the ability to compile code natively. This is where sometimes sshfs comes in handy, Mostly though I use sshfs when I introduce yet another Linux system into the mix . . . Certainly you could “get away with” only using two systems. However I do have method to my “madness”. Mostly, I like to keep my dev systems separate, from the other systems I use.

Don’t worry if you do not under stand everything I explained above. Time with Linux will eventually teach you everything you’d ever want to know.

Mehreen,

Instead of running a virtual machine, or only one OS on a single computer. You can also dual boot. This is to say, you can have Linux, and Windows running on the same machine. But only one OS can run at the same time. Anyway, Ubuntu has a very well implemented “side-by-side” install setup. At least it worked very well for me. Take note though, I do not usually have much good to say about Ubuntu . . . and for my own purposes / preferences I actually prefer Lubuntu. Which is actually just Ubuntu using LXDE as a Windows manager instead of that Unity garbage.

Anyway, it may be something worth looking into.