Hobbyist Toolkit

cancel
Showing results for 
Search instead for 
Did you mean: 

Modifying code to reconfigure GPIO (BeagleBone Black or Raspberry Pi)

Hello,

Has anyone gone through the (painful) process of searching out and modifying the toolkit to change the way that it configures the pins?

For instance: the BeagleBone Black has 2 spi drivers onboard but Linx only accesses 1.

 

Currently, the Linx toolkit configures pins as:

cape-headers.png

 

But in my application, I have a need to configure the pins as follows:

cape-headers-spi.png

 

Has anyone accomplished doing this? (whether in the vi library or the driver-level c code)

I've spent a significant amount of time digging through the library and source (LabVIEW) code and cannot find where it loads the pin configurations. Any help would be MUCH appreciated!

 

side note: This is also in reference to Error Code 5005 when attempting to use the BeagleBone's SPI CS pin number in LV. I'm aware of the reason it generates this error, but to me, this SHOULD be something I can get around without having to use up one of the GPIO pins as the SPI's CS. 

0 Kudos
Message 1 of 2
(140 Views)

You obviously haven't look hard enough.

https://github.com/MakerHub/LINX/blob/master/LabVIEW/vi.lib/MakerHub/LINX/Firmware/Source/core/devic...

 

#define NUM_SPI_CHANS 1

needs to be changed to:

#define NUM_SPI_CHANS 2

 

https://github.com/MakerHub/LINX/blob/master/LabVIEW/vi.lib/MakerHub/LINX/Firmware/Source/core/devic...

 

string m_SpiPaths[NUM_SPI_CHANS] = { "/dev/spidev1.1"};
string m_SpiDtoNames[NUM_SPI_CHANS] = { "BB-SPIDEV0"};
unsigned char LinxBeagleBoneBlack::m_SpiChans[NUM_SPI_CHANS] = {0};

 Should be changed like this:

string m_SpiPaths[NUM_SPI_CHANS] = { "/dev/spidev1.1", "/dev/spidevX.X"};
string m_SpiDtoNames[NUM_SPI_CHANS] = { "BB-SPIDEV0", "BB-SPIDEV1"};
unsigned char LinxBeagleBoneBlack::m_SpiChans[NUM_SPI_CHANS] = {0, 1};

 

What names to use for the SpiPaths and SpiDtoNames you will have to find in the documentation.

 

And it may be a lot more complex since there is also some spiMux handling in LinxBeagleBoneBlack.cpp which I have no idea how that works. And no it's not Linx that is complicated but the way all those embedded platforms expose the various hardware. Each one in its own way and all of them in true Linux manner actually already obsolete.

Rolf Kalbermatter
Averna BV
0 Kudos
Message 2 of 2
(116 Views)