Up Board using MRAA unable to initalize gpio
Hi,
I tried to initialize gpio on UP Board using libmraa C API:i2c = mraa_i2c_init(0);
but it always returns NULL. Then I learned that it requires root permissions, so I installed ubilinux 4 instead of ubuntu and updated the OS according to the wiki page, but again it returns NULL. Since I use Arduino Create IDE to upload sketches so I believe the code is running with root permissions. But still I got NULL, and initializing gpio or spi simply return NULL too. libmraa itself should be working fine because I can get the board name "UP" using mraa_get_platform_name() function.
Then today, I suddenly notice that after booting the board, just before entering the login page, there seem to be some errors:
efi: requested map not found.
esrt: ESRT header is not in the memory map.
CPLD verify error (expected: FFFFFFF, actual: 0)
up-pinctrl up-pinctrl: CPLD initialisation failed
Failed to find cpu0 device node
i8042: Can't read CTR while initializing i8042
I understand that GPIO buses on UP are driven by a CPLD, so does that mean my board is damaged? Or something else could be done to initialize all these correctly?
Thanks!
Comments
-
Hi @slytherin_xzf ,
Cloud you, please, try the following commands to verify MRAA is working?
Check current value:
sudo mraa-gpio get 29Set new value:
sudo mraa-gpio set 29Check the new value:
sudo mraa-gpio get 29- Wait a few seconds to get the new value set.
Cheers!
-
@ccalde Thanks a lot for helping me!
I tried the commands but what I got issudo: mraa-gpio: command not found
I reinstall ubilinux3 according to technical support people, but the problem is still there. Dose that mean I don't have mraa installed? But I can use mraa_get_platform_name() function all right in my programme. Really confuesed.
-
Hi @slytherin_xzf ,
Yes, that is pretty strange.
Maybe you could try to install the MRAA manually and test again...sudo add-apt-repository ppa:mraa/mraa
apt-get updatesudo apt-get install mraa-tools mraa-examples libmraa1 libmraa-dev
apt-get install python-mraa python3-mraa node-mraa libmraa-javaCheers!
-
Hi @ccalde,
Actually I've tried that already, but the command add-apt-repository is unavailable. I followed the instructions on the net and installed python-software-properties, although it fixed the issue but then I got a warning
can not open file /etc/apt/soureces.list
So I just can not install mraa anyway. I guess the best thing I can do is to do is to buy another up board.
-
Hi,
Yes, you are right. That command is not available in UP.
What about the git repository?
You could install it from the repo using the follow commands:git clone https://github.com/intel-iot-devkit/mraa.git
mkdir mraa/build && cd $_
cmake ..
make
make installMake sure you run the final command, “make install” with root or “sudo.”
Also, when did you get that warning? In what point exactly?
Thank you.
-
Thanks,ccalde
I got my new up board so I'm installing ubilinux3 on it, soon we'll now if the old one has indeed some hardware damages. The first thing I'm sure is that the old one's flash chip is a lot hotter than the new one, in fact it is a little too hot to touch.After I typed in
sudo add-apt-repository ppa:mraa/mraa
and it asked to confirm if I want to add mraa, I pressed enter to confirm and then came the warning.I am quite busy these days so got no chance to try installing mraa by building it. But I'll work on that soon.
-
Yes, the boards are a bit hot normally. That is the reason to set the heatsink
Ok, about the warning, it looks like you have to update the sources list to get the ppa repository.
Anyway, the git repository would be enough to install the MRAA.Cheers!
-
@ccalde,
At last things are going smooth now! I built mraa on my new board and I can freely toggle gpio or using i2c bus. As for the old one I do no more struggling because it will not accept the command:echo 26 > /sys/class/gpio/export echo out > /sys/class/gpio/gpio26/direction echo 1 > /sys/class/gpio/gpio26/value
Anyway now I had a normally functioning board, so I can go on with my job.
Thanks! -
Hi @slytherin_xzf ,
Good to know that with your new board you can install the mraa and work normally.
About the old one, you say the echo command is not accepted? Even from root user?Cheers!
-
Hi,
I have bought up2 board and installed Ubuntu 16.04.4 which is downloaded from ubuntu official website. I have installed MRAA libraries from github and tried to execute the following command
mraa-gpio list
The output is No pins
Could anyone help me how to configure my up2 gpio pinsThanks in advance
-
@rameshgm81 You also need to install the correct kernel for the UP2, the generic kernel does not have support for the GPIO header.
See here and here -
Hi @rameshgm81 ,
As @nukular said, the only way to get your gpio working via MRAA is installing the oficcial kernel supported for UP2 boards.
Cheers!