Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
1,816 Views

intel Galllieo gen 2 SPI pin configuration issue

Jump to solution

Hi,

I am working with Intel Galileo Gen 2 board and I am trying to configure pin no 10-13 for SPI mode.

I have written the following script but when i execute script it shows the following error,

///////////////////////////////////////SCRIPT_START///////////////////////////////////////////////////////////////////

# !/bin/bash -e

# v0od0ochild

echo "Configuration Spidev1.0 for Galileo-Gen2.."

# pin10 CS

echo 26 > /sys/class/gpio/export || echo "gpio26 already exported"

echo 27 > /sys/class/gpio/export || echo "gpio27 already exported"

echo 74 > /sys/class/gpio/export || echo "gpio74 already exported"

echo out > /sys/class/gpio/gpio26/direction || echo "Failed to set gpio26 low"

echo out > /sys/class/gpio/gpio27/direction || echo "Failed to set gpio74 low"

echo out > /sys/class/gpio/gpio74/direction || echo "Failed to set gpio74 direction out"

echo 0 > /sys/class/gpio/gpio74/value

# pin11 MOSI

echo 24 > /sys/class/gpio/export || echo "gpio24 already exported"

echo 25 > /sys/class/gpio/export || echo "gpio25 already exported"

echo 44 > /sys/class/gpio/export || echo "gpio44 already exported"

echo 72 > /sys/class/gpio/export || echo "gpio72 already exported"

echo out > /sys/class/gpio/gpio24/direction || echo "Failed to set gpio24 low"

echo out > /sys/class/gpio/gpio25/direction || echo "Failed to set gpio24 low"

echo out > /sys/class/gpio/gpio44/direction || echo "Failed to set gpio44 high"

echo out > /sys/class/gpio/gpio72/direction || echo "Failed to set gpio72 direction out"

echo 1 > /sys/class/gpio/gpio44/value

echo 0 > /sys/class/gpio/gpio72/value

# pin12 MISO

echo 42 > /sys/class/gpio/export || echo "gpio42 already exported"

echo 43 > /sys/class/gpio/export || echo "gpio43 already exported"

echo in > /sys/class/gpio/gpio42/direction || echo "Failed to set gpio42 low"

echo in > /sys/class/gpio/gpio43/direction || echo "Failed to set gpio43 direction in"

# pin13 SCLK

echo 30 > /sys/class/gpio/export || echo "gpio30 already exported"

echo 46 > /sys/class/gpio/export || echo "gpio46 already exported"

echo 31 > /sys/class/gpio/export || echo "gpio31 already exported"

echo out > /sys/class/gpio/gpio30/direction || "Failed to set gpio30 low"

echo out > /sys/class/gpio/gpio46/direction || "Failed to set gpio46 high"

echo out > /sys/class/gpio/gpio31/direction || "Failed to set gpio31 direction in"

echo 1 > /sys/class/gpio/gpio46/value

echo "SPI Ready"

//////////////////////////////////////////////////SCRIPT_END//////////////////////////////////////////////////////////////////////

Getting the following error after script execution,

Configuration Spidev1.0 for Galileo-Gen2..

 

./spi_test.sh: line 11: /sys/class/gpio/gpio74/direction: No such file or directory

 

Failed to set gpio74 direction out

 

./spi_test.sh: line 22: /sys/class/gpio/gpio72/direction: No such file or directory

 

Failed to set gpio72 direction out

 

SPI Ready

it is not creating the direction directory for for gpio72 and gpio74.

Thanks

Pankaj.


Accepted Solutions
Highlighted
Valued Contributor II

Re: intel Galllieo gen 2 SPI pin configuration issue

Jump to solution

Hi,

I guess a behaviour that there is no direction for gpio72 and gpio74 is correct.

Let me explain:

gpio72 and gpio74 belong to PCA9685 chip on Galileo Gen2 board.

Below you can find a picture with PCA9685 schematic on Gen2 board:

As you may see all pins on the rights side have an output direction.

And there is no need to make them for input.

This is a Galileo Gen2 hardware design.

So, a direction property is not available for all pins belong to PCA9685: from gpio64 to gpio79.

This is implemented in a Linux device driver.

Let's check this in Linux:

As you may see there is no direction property for gpio72 and gpio74.

But it is present for gpio47.

Conclusion:

no need to setup a direction for gpio72 and gpio74 because they are always in an output mode.

BR,

xbolshe

View solution in original post

3 Replies
Highlighted
Employee

Re: intel Galllieo gen 2 SPI pin configuration issue

Jump to solution

Hello Sspank,

Let me check the configuration and test it on my Galileo, I'll get back to you as soon as possible.

Peter.

0 Kudos
Highlighted
Beginner

Re: intel Galllieo gen 2 SPI pin configuration issue

Jump to solution

Hello Peter,

Thanks for your response.

I have also tried the following script which i taken from still getting the same error for gpio72 and gpio74.

# !/bin/bash -e

# v0od0ochild

echo "Configuration Spidev1.0 for Galileo-Gen2.."

# pin10

echo 26 > /sys/class/gpio/export || echo "gpio26 already exported"

echo 74 > /sys/class/gpio/export || echo "gpio74 already exported"

echo 27 > /sys/class/gpio/export || echo "gpio27 already exported"

echo low > /sys/class/gpio/gpio26/direction || echo "Failed to set gpio26 low"

echo low > /sys/class/gpio/gpio74/direction || echo "Failed to set gpio74 low"

echo in > /sys/class/gpio/gpio27/direction || echo "Failed to set gpio27 direction in"

# pin11

echo 24 > /sys/class/gpio/export || echo "gpio24 already exported"

echo 44 > /sys/class/gpio/export || echo "gpio44 already exported"

echo 72 > /sys/class/gpio/export || echo "gpio72 already exported"

echo 25 > /sys/class/gpio/export || echo "gpio25 already exported"

echo low > /sys/class/gpio/gpio24/direction || echo "Failed to set gpio24 low"

echo high > /sys/class/gpio/gpio44/direction || echo "Failed to set gpio44 high"

echo low > /sys/class/gpio/gpio72/direction || echo "Failed to set gpio72 low"

echo in > /sys/class/gpio/gpio25/direction || echo "Failed to set gpio25 direction in"

# pin12

echo 42 > /sys/class/gpio/export || echo "gpio42 already exported"

echo 43 > /sys/class/gpio/export || echo "gpio43 already exported"

echo low > /sys/class/gpio/gpio42/direction || echo "Failed to set gpio42 low"

echo in > /sys/class/gpio/gpio43/direction || echo "Failed to set gpio43 direction in"

# pin13

echo 30 > /sys/class/gpio/export || echo "gpio30 already exported"

echo 46 > /sys/class/gpio/export || echo "gpio46 already exported"

echo 31 > /sys/class/gpio/export || echo "gpio31 already exported"

echo low > /sys/class/gpio/gpio30/direction || "Failed to set gpio30 low"

echo high > /sys/class/gpio/gpio46/direction || "Failed to set gpio46 high"

echo in > /sys/class/gpio/gpio31/direction || "Failed to set gpio31 direction in"

echo "SPI Ready"

Want ask some questions regarding to above script,

As per data sheet pin 10 is used for Chip Select (CS) So direction of 26,27 and 71 should be out.

Pin no 11 is used for MOSI So direction of 24,25,44,72 should be out .

Pin no 12 is used for MISO So direction of 42 and 43 should be in.

Pin no 13 is used for SCLK So direction of 30,31 and 46 should be out.

Is it correct?

Thanks

Pankaj.

0 Kudos
Highlighted
Valued Contributor II
1 View

Re: intel Galllieo gen 2 SPI pin configuration issue

Jump to solution

Hi,

I guess a behaviour that there is no direction for gpio72 and gpio74 is correct.

Let me explain:

gpio72 and gpio74 belong to PCA9685 chip on Galileo Gen2 board.

Below you can find a picture with PCA9685 schematic on Gen2 board:

As you may see all pins on the rights side have an output direction.

And there is no need to make them for input.

This is a Galileo Gen2 hardware design.

So, a direction property is not available for all pins belong to PCA9685: from gpio64 to gpio79.

This is implemented in a Linux device driver.

Let's check this in Linux:

As you may see there is no direction property for gpio72 and gpio74.

But it is present for gpio47.

Conclusion:

no need to setup a direction for gpio72 and gpio74 because they are always in an output mode.

BR,

xbolshe

View solution in original post