Overview
The LabVIEW BCM2835 library expands the GPIO interface with the Raspberry Pi (RPi) 2/3 over and above what is available with the MakerHub LINX package. The original C library was created by Mike McCauley (and others) and can be found at this link. This library has been converted to a Linux shared object which is compatible with LabVIEW-LINX. The LabVIEW library is built using this shared object as a base, and it consists of a range of functions which interface with the shared object using Call Library Function Nodes.
The figure above illustrates the GPIO and alternative modes that are available with the library; this is header J8 on the RPi 3. The functionality offered by the LabVIEW library is as follows:
Palette Details
When the library is installed it can be found in the Addons menu on the block diagram:
Three main VIs are found in this first palette:
GPIO Palette
The standard GPIO VIs are:
GPIO Multi
Event Detect
PWM Palette
The PWM VIs are:
SPI Palette
The SPI VIs are:
I2C Palette
The I2C VIs are:
Timing Palette
Two timing VI's are also included, although the accuracy is unverified, particularly for the microseconds function. Users are free to experiment with these timing functions. For example, the 'Delay msec' function may be used in place of the LabVIEW 'Wait ms' function,
Prerequisite Software
The user must have the following software/packages already on the PC before installing the BCM2835 Library and examples (refer to this document😞
Supported SW and OS
Supported Hardware
Installation Details
Comprehensive installation details are included in the PDF document below. Note that there are two packages:
It is important to install the BCM2835 library first, then the examples package.
The Linux shared object that the library uses must also be copied to the Raspberry Pi. Full details are given in the PDF document.
I have downloaded the relevant documents, thank you for your dedication!
Hi all, has anyone who downloaded the library been able to use it with an RPi 2? I want to check if it's definitely compatible with that RPi version, but don't have one to hand. Thanks...
Error on my computer, help me, Thanks !
I followed the instructions but still error, help me. Thanks DMurrayIRL !
What you have is a problem with installing LINX (and not the BCM2835 library), which I'm not involved with and so have no idea how to help you here. Your best option is to post the issue on the LINX support forums so that the developers can help you. Also, search through other posts in that forum as I think other people will have had similar issues to you. Sorry I can't be of more help, but I just don't understand enough about the LINX installation process.
Edit to add: Here's some posts which may help:
https://www.labviewmakerhub.com/forums/viewtopic.php?f=12&t=1429&hilit=installation#p7244
https://www.labviewmakerhub.com/forums/viewtopic.php?f=12&t=1370
I'm still wrong, help me , implore DMurrayIRL :((
Hi, I am having trouble with the PWM output using the PWM 1Channel example you provided. When using default settings there was no signal (see oscilloscope image with straight line and vi screenshot with clock divider 8). After playing with the settings I was able to get a readout that showed a wave with the correct frequency but an incorrect duty cycle. Upon trying to change the duty cycle during run time nothing happened (see other two images). Using the Blink example through the same port worked just fine. Any ideas on what could be causing this issue?
Hello Derek:
I'd like to follow up on the question posted above by Seperthar (a student working with me at Western Kentucky University). We have been unable to get the BCM2835 library to generate a PWM signal. Other examples in the library such as Blink and Write Multi etc. work fine. When we run the PWM 1 Channel example the application runs fine and doesn't generate any run time error. However, we do not see a PWM type signal on the expected channel. We have tested the output both with an oscilloscope and using an LED. We tried multiple combinations of the settings including using different pins, periods, duty cycles, etc. The only thing that seemed to change the output was that depending on the value of the Clock Divider input sometimes the output was always high, sometimes always low, and we found one combination that gave a PWM looking signal that had the correct period but the duty cycle was incorrect and we couldn't change it to other values.
I notice that the documentation says ...
"The PWM functionality on the RPi 3 (and probably RPi 2 as well) drives the audio jack J7. If you have any audio SW and/or drivers driving J7, then it is unlikely that you will be able to use the PWM functionality for other purposes."
Is there a chance that this could be our issue? I do not think that we have any drivers using the audio jack, but I am not sure how to tell for sure. Or do you have any other troubleshooting recommendations that we could follow?
We are attempting to use the Pi to control a motor and we need a PWM signal to set the motor speed.
By the way, the documentation that you have provided for this project is superb. Installation of the library was easy when following the detailed instructions with screenshots that you provided. Thanks for the contribution to the community !!
Regards,
Doug Harper
WKU Professor of Physics, CLA
Hi Doug,
Apologies for the delay in replying to the original post. I'm very rusty on the RPi and this library as I haven't done any RPi work of late, but my first thoughts are that your circuit should be working if the other projects are working. First of all, are any errors being flagged in the VI? They should cause the program to stop, and might give a clue. If there aren't any errors then there is something going on at a more fundamental RPi level which I will struggle to help with. A possible audio conflict may indeed be the problem, but I'm not sure how to rule that out. Regarding other debug options, I was first going to suggest that you try the other PWM pins but I see you've already done that. Other questions/things to try:
I don't really have anything else to add, but let me know how you get on with any of the above.
Derek.
Running 2 examples together in one VI
for example write mask and MCP3008 SPI example
I want to make a VI that reads 8 Channel of MCP 3008 with ''Single Ended'' setting plus in that VI I want to control other GPIO pins. for exp: To switch a PIN Low to High for switching ON/OFF a LED.
I have made this program 8 channels data is showing on labview and GPIO pin connected with LED is also Switching ON/OFF with a button.
Problem is that when I stop the program RPI3 get disconnected without giving any errors.
Can some one look at my VI to solve the problem.
I think problem is when I am using 2 ''BCM 2835 library'' close and ''LINX close''.
https://drive.google.com/file/d/1NOlbygyEZrRoAiLxI3BmljiTd7D2hO7k/view?usp=sharing
Hi,
I am having problem using the SPI with Chip Select 1. It works fine with CS0, but when i select the CS1 it doesnt modify the actual state of the pin.
any suggestion?
Thanks
Davood
If anybody else is having trouble with the PWM functionality, I can confirm that following the first two steps in this link explaining how to disable the default audio driver fixed the problem for me.
Thanks for all your hard work on this Derek. It saved my Sr. Design project from the jaws of disaster.
Disabling the audio driver FINALLY fixed my PWM issues. Wish I would have seen this post weeks ago.
Hello
I want to develop a raspberry based device that communicates with LabVIEW using your libraries.
So far, your libraries works great but I need to interact with GUI in the raspberry operative system (Raspbian PIXEL) designed on LabVIEW but I´m not able to do that.
My question is: how can I deploy an application (LabVIEW + BCM2835) on a raspberry and interact with it Raspbian SO trough ??.
LabVIEW 2020 Please!!!!!!!!!!!!!
Hello,
It would be great to have the new version compiled to LabView. Development for this library continues to this day according to the Mike McCauley's web page.
Would it be too much of a hassle to prepare a new version?
Thanks.
Hi everyone,
I did compile a new version of the BCM2835 drivers that is compatible with all models of Raspberry Pi (including 4). This is directly compatible with the library from DMurrayIRL.I cannot attach it to that message so PM to get it.
Regarding the compatibility with LabView 2020/2021, just copy the dmBCM2835 folder from vi.lib to your new version of LabView and mass compile it in the new version.
It is fully compatible.
LINX and MakerHub are already available on VIPM.
Hello everyone,
I'm having issues getting dmBCM2835 running on LabVIEW 2021SP 1 and a RPi version 4B. I followed the steps laid out in the support PDF and have mass compiled from the LV2014 version to LV2021 and made sure that the folder is located in the 2021 vi.lb folder. The issue I'm having is with the BCM2835_Int function not having root access on the RPI, I'm hoping someone can point me in the right direction.
Error Code 8000
Error detected in 'BCM2835_Init' function: Could not access library. Most likely cause is user not running as root on RPi.