Hobbyist Toolkit

cancel
Showing results for 
Search instead for 
Did you mean: 

SPI Open fails when in an executable

Hello all,

 

We have built a system that reads EEG values. The system is finished (and runs well with web server communication). Last step was making the executable.....

 

The executable builds with no errors and, previously, failed because of some method nodes. Once removed, most of the system works correctly, except for SPI Open. Here, it fails with an unknown error.

 

A long time ago, we were having similar problems just communicating with SPI over beaglebone. To fix the issue at the time, we had to add a symbolic link:

 

sudo sh -c 'echo KERNEL==\"spidev1.1\", SYMLINK+=\"spidev0.0\" > /etc/udev/rules.d/99_linx_spi.rules'

 

which allowed us to communicate correctly with a connected amplifier.

 

Now, once in the executable, SPI fails to open and gives a unknown error (but LINX device opens, and digital read/write works). Does anyone have ANY suggestions on what to try here? Does the added symbolic link fail for some reason once the system is in an executable? Do we need to add the symbolic link directly to the LINX libraries? Are there specific compilation configuration settings I should try? I would very much appreciate help.

0 Kudos
Message 1 of 5
(1,493 Views)

If I am understanding your scenario correctly, you have a program that runs on a PC which communicates to a beaglebone over SPI, right?

 

Your issue is when you build your program into an executable the SPI communication does not work.

 

Does this happen if you run the executable on the same system which you built the program on?  If this happens on a different PC, not the development PC, you probably require some drivers/files which do not exist on the non-development PC.  You may want to build an installer instead of just an executable or you may need to always include some files with your executable build.

 

I don't have any particular knowledge about working with the beaglebone.

David Wilt
The New Standard LLC
Message 2 of 5
(1,488 Views)

We have a program that runs on the beaglebone with LINX. It communicates to the development PC and to our HTML interface. We use SPI to talk to an amplifier that is directly connected to the beaglebone. The executable is built to run on the beaglebone directly. The executable works, all except SPI communication with LINX. (it works entirely when it is connected to the development PC, but the program itself runs on the beaglebone)

0 Kudos
Message 3 of 5
(1,486 Views)

Hi,

Is the executable running before the symbolic link has been created at startup? You may be able to change the point at which symbolic link is created by renaming the file 

 

/etc/udev/rules.d/99_linx_spi.rules

 

Another option would be to create the symbolic link in your LabVIEW program.

 

Message 4 of 5
(1,452 Views)

Hello Andy,

 

Hmm. We made the symbolic link change on the beaglebone manually and, since we didn't have to do that again with every restart, I assumed we wouldn't have to do that again (?). 

 

What do you mean renaming that linx rules file? That's where we put the symbolic link. Does a symbolic link get reinitialized every time the remote board restarts? 

 

I do think that creating the symbolic link in LabVIEW could potentially work, but I d 

 

As I was writing my response, my labmates messaged me from the lab (I couldn't stick around, this problem was driving me crazy) and they got SPI working on a different beaglebone. We think it is because of different debian images (2018 vs 2020) or a broken beaglebone generally. I will update with what conclusion we land on for the above issue but it looks like the past 9 months were Not a waste, so that's a huge relief. Thank you both for reaching out. Jeeze PHEW

0 Kudos
Message 5 of 5
(1,445 Views)