beaglebone black PWM

hi everyone,

i’m working with BBB rev C for my final year project , i want to controle a 3 step by step motors of a 3 axis cartesien robot, i didn’t come to a solution to set up a cross compiler for my BBB , i tried Eclipse and NetBeans but it didn’t work , can u help me to program the BBB ?? the " Master " want a C program that can generate a PWM , and he wants to controle the robot using a LabWindows/CVI human-machine interface , that’s another problem for me , i’m stocked , please need help

On Thu, 14 Apr 2016 01:56:50 -0700 (PDT), Brainiac
<wadi.benrhouma91@gmail.com> declaimed the
following:

hi everyone,

i'm working with BBB rev C for my final year project , i want to controle a
3 step by step motors of a 3 axis cartesien robot, i didn't come to a
solution to set up a cross compiler for my BBB , i tried Eclipse and
NetBeans but it didn't work , can u help me to program the BBB ?? the "
Master " want a C program that can generate a PWM , and he wants to
controle the robot using a LabWindows/CVI human-machine interface , that's
another problem for me , i'm stocked , please need help

  It may be slow, but couldn't you do the builds on the BBB.

  I've not done much with mine, but the last exercise had me using
(horrors) Visual Studio C++ 2010 for editing (having to ignore its
complaints about modern C++ features) and sFTP to transfer the files to my
BBB where I invoked the compiler to build the executable.

Just a comment on the hardware here. The usual stepper motor driver
(that's a motor with multiple coils that needs either a grounding
driver or a phase switching bipolar driver to run) takes a direction
logic input (CW or CCW) and a step pulse.

Servo motor systems (not the motors themselves) take a PWM directly,
these are often used in model aircraft and boats.

Servo motors (the motors themselves) can run on a PWM signal, but need
a hardware driver and a direction input. Many controllers take an
analog input for speed.

Important to know exactly what kind of motor you're working with,
since that will absolutely control what kind of signals you need.

Harvey

While I prefer CVI over LabView, you might find the new LINX 3.0 LabView for Linux libraries useful:
http://forums.ni.com/t5/LabVIEW/LINX-3-0-LabVIEW-for-BeagleBone-Black-and-Raspberry-Pi-2-3/td-p/3278758

OTOH, I’m not sure why you want a C program to generate PWM when there already are multiple ways to generate PWM signals on the GPIO pins that support being PWM (analogWrite in the Bonescript examples) outputs.

Unless your C/C++ code project is really large, native development on the BBB is not too painful, ditch the HDMI and use ssh -X over the USB “gadget” Ethernet interface and install a lightweight IDE like geany.

While I prefer CVI over LabView, you might find the new LINX 3.0 LabView
for Linux libraries useful:
http://forums.ni.com/t5/LabVIEW/LINX-3-0-LabVIEW-for-BeagleBone-Black-and-Raspberry-Pi-2-3/td-p/3278758

OTOH, I'm not sure why you want a C program to generate PWM when there
already are multiple ways to generate PWM signals on the GPIO pins that
support being PWM (analogWrite in the Bonescript examples) outputs.

You're missing that this is an educational project. Often times the
students are told "solve it this way only" for various reasons. One
might be that the student is to use certain tools that are regarded as
essential to the course. Another might be that the instructor
understands only those particular methods and will not be able to
figure out a different method or processor.

Harvey

Hello Brainiac!

I never used a cross compiler yet and I see no reason to do so. I’m running Geany on my PC (in order to use my standard settings), load and save the source files via ethernet from and to the BBB, and compile and test on the BBB via ssh command line connection. For graphics testing, when your PC is running Linux, you can use option -X (upper case) to get graphic output directed to the PC screen (as mentioned above, including keyboard / mouse input to the BBB).

Regarding your project, you can do GPIOs and generate PWM signals by using libpruio. Once installed, it’s very painless to configure (by single source) and to control (in a fast manner) the pins. It’s written in FreeBASIC, but provides a C wrapper, so you can make your “master” happy.

Check out some examples: ie. pwm_cap in order to generate a PWM puls train or stepper in order to control a stepper motor (here single phase = unipolar).

Good luck for your project.

BR

Your best bet is to look at the book Exploring the Beaglebone by Derek Molloy. It gives you all the instructiions to setup a cross compiled environment on a Debian Linux version. It takes time - but DO IT. DOn’t compile on the bone. Logn term it is not the way to go.

Your best bet is to look at the book Exploring the Beaglebone by Derek Molloy. It gives you all the instructiions to setup a cross compiled environment on a Debian Linux version. It takes time - but DO IT. DOn’t compile on the bone. Logn term it is not the way to go.

I think there s a situation for both cross compiling, and compiling native. But that one should be aware that compiling on flash media is probably not the best idea every. However, one can setup an NFS share, to share with the beaglebone. Which does compile a bit slower. Or the method I prefer to use when possible. Is setup a tmpfs directory, and do all my compiling there. Which if you’re unfamiliar with what tmpfs is. Basically you’re create a file system in memory, for which you can specify size. Me, I set my own tmpfs up to 256M in size. Do however keep in mind that I use a separate image for development, than what I’d use for production.

Also, Derrek Molloy’s book is indeed a decent read for beginners to embedded Linux. BUT, it is dated, and may not work with the newer kernel’s and images. Device tree files for instance are slightly different, and the sysfs objects for various things such as PWM, GPIO, etc may also be located in a slightly different location. For the more experienced embedded Linux developer, this would not be a problem, but can cause all sorts of grief and confusion for beginners. Do not that I have noticed that DR Molloy does have updated content on his web site as “companion” content for his book. However, what I do not know is that if he has addressed the things I mentioned in this paragraph.

I think there s a situation for both cross compiling, and compiling native.

By this above what I mean is that if it will take you more than half a day to read about, and figure out how to cross compile something. Then it is probably much easier to compile natively. Even if physically compiling a bit of software takes a day or longer. The reason is simple. You can easily spend months trying to figure out how to cross compile various projects. Nodejs would be a perfect example, except compiling natively on the beaglebone only takes up to a couple hours. Wireshark would be a perfect example, and QT would also be a good example, except that I do not believe it is possible to compile QT natively on the beaglebone it’s self.

There is also another option. You can buy an ARM build system that uses the same hardware architecture ( armv7). Such as a Beagleboard X15, or wanderboard.

any idea how can setup Geany on my BBB ??? i think it’s the best and short (time speaking) solution

Execute

sudo apt-get install geany

The best short time solution is Samba. Samba on the client side is also supported on Linux, Windows, and probably OSX too( since it’s UNIX ). On Windows, Samba shares have integrated support into explorer. Which means, once you’ve properly connected to a Samba share in Windows, it behaves just like any other storage.

So there are no third party crappy tools needed to view or manipulate files and directories remotely.