LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Edit and recompile Labview LINX source file

Solved!
Go to solution

Hi All,

 

I am using Labview 2020 with Beagle Bone Black. LINX is an interface used to make BBB work with Labview.

When I was using the PWM channels of the BBB, I found that the VI supports only duty cycle and frequency is kept a constant. Now if one were to look in the source file of the LINX folder (for BBB), its clear that the frequency is set to 500000ns.

 

"unsigned long m_PwmDefaultPeriod = 500000;"

 

This information is available in the folder:-  

LINX/LabVIEW/vi.lib/MakerHub/LINX/Firmware/Source/core/device/LinxBeagleBoneBlack.cpp

 

Now the question I have is, I would like to change the frequency to 1000000000ns from 500000ns, and so, after I edit this in LinxBeagleBoneBlack.cpp, how do I recompile the LINX firmware and then flash it into the Beagle Bone Black over Labview. I think the flashing I did previously by connecting to BBB over Hobbyist toolkit and then upgrade the firmware, and this did work.

 

I kindly request someone to share me, how to re-compile the LINX firmware and then flash to BBB.

 

Thanks & Regards

Anand

0 Kudos
Message 1 of 5
(658 Views)

You either install a crosscompile GNU CC toolchain for BBB on your development PC and compile the whole source code into a new shared library. 

 

Or you install the according native GNU CC compiler toolchain onto your BBB and compile it directly on there.

 

I used the second approach for tests on some modifications of the shared library source for Raspberry Pi.

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 5
(654 Views)

Hi Rolf,

Thank you very much for your support.

 

I also would like to go by your second option of compiling the file "LinxBeagleBoneBlack.cpp" using GCC on the Debian OS running on BBB.

 

I first checked if GCC was installed on BBB, and I found it was.

 

root@BeagleBone:/# gcc --version
gcc (Debian 10.2.1-6) 10.2.1 20210110
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

The next was locating where the file with name "LinxBeagleBoneBlack.cpp" is stored in the BBB which has LINX labview installed.
I could not find the path or location nor could I even find the file "LinxBeagleBoneBlack.o". Below are few of the many searches I did.

 

root@BeagleBone:/# find / -type d -name "LinxBeagleBoneBlack.cpp"
find: File system loop detected; ‘/run/schroot/mount/lv/run’ is part of the same file system loop as ‘/run’.

 

root@BeagleBone:/# find / -type d -name "LinxBeagleBoneBlack.o"
find: File system loop detected; ‘/run/schroot/mount/lv/run’ is part of the same file system loop as ‘/run’.

 

root@BeagleBone:/# find / -type d -name Linx*.*
find: File system loop detected; ‘/run/schroot/mount/lv/run’ is part of the same file system loop as ‘/run’.

 

root@BeagleBone:/# find / -type d -name "labview"
/srv/chroot/labview
/srv/chroot/labview/usr/local/natinst/labview
/srv/chroot/labview/var/local/natinst/labview
/etc/schroot/labview
/usr/share/doc/labview
/run/schroot/mount/lv/usr/local/natinst/labview
/run/schroot/mount/lv/var/local/natinst/labview
find: File system loop detected; ‘/run/schroot/mount/lv/run’ is part of the same file system loop as ‘/run’.
root@BeagleBone:/#

 

#1: Since you have worked on Raspberry Pi for the same reason, could you please share me information on what the location of the file "LinxBeagleBoneBlack.cpp" would be on a Debian running on BBB.

 

#2: Also after I compile the file using gcc, in which location should I place the file "LinxBeagleBoneBlack.o" in the Debian running on BBB.

 

Thanks & Regards
Anand

0 Kudos
Message 3 of 5
(591 Views)

You need to install the gcc toolchain inside the labview chroot. The GCC toolchain on your Raspbian is NOT without tinkering compatible to create the correct binary format that the Debian derived OS inside the chroot is.

 

The source code for the Linx Toolkit is not automatically on your chroot either. It is part of the Linx Toolkit sources but you have to get them there first.

 

Also the LinxBeagleBoneBlack.cpp is only the main file for the whole shared library. There are other files needed to build the whole shared library.

Rolf Kalbermatter
My Blog
0 Kudos
Message 4 of 5
(571 Views)
Solution
Accepted by topic author anu208

Hi Rolf,

 

Thank you very much. I was able to make the necessary changes in PWM and I was able to run the Labview program on BBB. However, there were few more steps I had to do to make it work.

 

1. First, I followed the steps as mentioned in the link below.

Build .so On Target [LabVIEW MakerHub]

With this I was able to edit the file with name LinxBeagleBoneBlack.cpp where I changed the PWM frequency. I then compiled using Makefile and threw the .so file created to the folder usr/bin. But after I still found the PWM not working on BBB.

 

2. I came across some test codes that was available under the LINX folder. Please have the link below. 

LINX/LabVIEW/vi.lib/MakerHub/LINX/Firmware/Source/tests/src at main · LVMakerHub/LINX · GitHub

These helped to find if PWM was working on the BBB.

Since my PWMs were not working, I put in some println statements to see the code execution flow. And thats when I came to understand that there was difference in the path. I was running on kernel 5.10 of debian and I found that the right path for the PWMs were:- 

 

P9.14 sys/ class/pwm/pwmchip5/pwm0
P9.16 sys/ class/pwm/pwmchip5/pwm1
P8:13 sys/ class/pwm/pwmchip7/pwm1
P8:19 sys/ class/pwm/pwmchip7/pwm0

 

I think the existing Linx code was built for some other previous kernel versions and they had a slightly different path for PWM access. Those version don't have pwmchip5, pwmchip7 etc.

 

So after I included these changes on the path in the LinxBeagleBoneBlack.cpp, I recompiled it and threw the .so file in the folder usr/lib. After this when I ran the test codes, my PWMs started working. Please note that when you run the PWM duty cycle test code, the duty cycle range is from 0 to 250 for test codes. Now that was a relief because now I know that the LabVIEW .so file is working fine on the BBB. Next step was to run a PWM code from the Labview on the laptop.

 

3. Third, I tried to run the PWM from the Labview in the laptop by connecting a BBB. I found that it was still not working. So I went deep inside the .VI file for the PWM block provided for Linx peripheral and then I found the default configuration set was DI (which means Digital Input). So I changed it to PWM in the VI block diagram of the PWM (deep inside). After this I flashed the code to BBB through the Labview, and then the PWM worked, meaning I was able to control using the knob in the Labview. It worked. Please note:- that the duty cycle that was set for PWM was from 0 to 1.

 

0 Kudos
Message 5 of 5
(334 Views)