Community
cancel
Showing results for 
Search instead for 
Did you mean: 
CWu44
Beginner
1,372 Views

MRAA not working

Hi

I need to setup GPIO2 as output and I used "new mraa::Gpio(2)" statement to allocate the object in Eclipse environment. But I got this output information:

terminate called after throwing an instance of 'std::invalid_argument'

what(): Invalid GPIO pin specified

and I have traced the syslog information as follow:

Feb 9 13:24:40 galileo local1.err libmraa[390]: gpio35: dir: Failed to write to 'direction': Connection timed out

Feb 9 13:24:40 galileo local1.err libmraa[390]: gpio2: init: unable to setup muxes

I have restarted the board several times but it still not work.

@

I'm using the default Yocto image downloaded from official website and I have synchronized package between Eclipse and the board. MRAA version is 1.5.1.

Can someone give me advice?

Regards,

Wu Chunnan.

0 Kudos
7 Replies
idata
Community Manager
43 Views

Hi Wu,

Thank you for reaching out. We would like to know if you've already configure the muxes on the Galileo board to set this pin as output from the console, could you please confirm this?

 

Check this examples on how to set IO7 as output or input:

IO7 as GPIO output (setting it as low or high):

 

echo -n "27" > /sys/class/gpio/export

 

echo -n "out" > /sys/class/gpio/gpio27/direction

 

echo 0 > /sys/class/gpio/gpio27/value # will set OUTPUT as LOW

 

echo 1 > /sys/class/gpio/gpio27/value # will set OUTPUT as HIGH

 

 

IO7 as GPIO input:

 

echo -n "27" > /sys/class/gpio/export

 

echo -n "in" > /sys/class/gpio/gpio27/direction

 

cat /sys/class/gpio/gpio27/value

Regards,

-Pablo

CWu44
Beginner
43 Views

Hi Pablo

Thank you for your reply,

Setting up GPIO using console was unsuccessful, the output information is as follow:

mailto:root@galileo root@galileo:~# echo -n "27" > /sys/class/gpio/export

mailto:root@galileo root@galileo:~# echo -n "out" > /sys/class/gpio/gpio27/direction

-sh: echo: write error: Connection timed out

The console paused for about 1 second before the error information was prompted.

What should I do next?

Regards.

Wu Chunnan

idata
Community Manager
43 Views

Hi Wu,

That's pretty strange. Could you please tell me if you're doing it via SSH or Serial connection?

 

I just tried it myself via serial connection and didn't get any error like the one you shared. Check my output below:

 

 

Make sure that you're not running your code or any MRAA code is running when making these changes.

Regards,

 

-Pablo
CWu44
Beginner
43 Views

Hi Pablo

Thank you for your help.

I was using SSH terminal yesterday.

I tried again using serial connection and got similar error. Please Check my output below:

Reading was successful, but timed out when writing.

Is that means my hardware is damaged?

Regards

Wu Chunnan.

CWu44
Beginner
43 Views

Hi Pablo

I think got it, I have connected analog input pin A4 and A5 to an output of an amplifier.

I check the schematic, the analog input pin A4 and A5 was mux'd to either analog input or I2C bus.

I guess the board was initialized to mux those pins to I2C bus, and the control signal was stucked by my amplifier.

It worked when I unplugged the wires connecting to ANALOG_A4 and ANALOG_A5.

Did I violated any design instructions of the Arduino-like board? Such as driving strength or output impedance for analog pin, or power on sequence requirements?

Regards

Wu Chunnan.

idata
Community Manager
43 Views

Hi Wu,

 

 

Sorry for the late reply.

 

To be honest, this is the first time I see this kind of error message when setting the muxing configuration for the board so I'm not sure if you have violated a design instruction. My guess is that is some kind of hardware protection from the board itself, so that when detects that something is connected it won't be possible to make changes to the current configuration.

 

 

Regards,

 

-Pablo
idata
Community Manager
43 Views

Hi Wu,

 

 

Don't hesitate to contact us again if you have any further question in the future, we'll be glad to help you. If you have an issue similar to this one you can post your question in this thread, if you have a new issue you can always open a new one.

 

 

Regards,

 

-Pablo
Reply