Community
cancel
Showing results for 
Search instead for 
Did you mean: 
AAsar
Beginner
2,390 Views

GPIO pins not working properly on arduino101

Hello, I'm using the arduino 101 with Zephyr ... I am having problems with using the gpio pins in input mode.

1) IO8 seems to be perpetually not working as inout or output

2) Though I am configuring all pins as inpul pull down, the pins are not following this configuration. pins IO13, IO3 and IO5 seem to be perpetually pulled up.

any suggestion on what the issue might?

3) Also facing similar issue regarding pu, pd in d2000 as well

0 Kudos
14 Replies
idata
Community Manager
110 Views

Hello me_5,

 

 

Thanks for reaching out!

 

 

Could you please show us how you are setting up the pins on both cases? Also, how did you determine that IO8 is not functional and that IO13, IO3 and IO5 are always set as pull-up?

 

 

Regarding the issue with the D2000, despite Curie (and therefore Arduino 101) being based on the module, it may still be a different issue. Hence, I suggest you to post a question for this issue on its forum, which you can find in https://communities.intel.com/community/tech/microcontrollers https://communities.intel.com/community/tech/microcontrollers.

 

 

I will be waiting for your response.

 

Pedro M.
AAsar
Beginner
110 Views

Hi, thanks for replying.

let me share my code with you :

# include

# include

# include

# include

# include

# include

# define delay 500

# define CONFIG_PINMUX_DEV_NAME "PINMUX_DEV"

# define noofpins 9

int input_pins[noofpins] = {18,17,19,15,20,0,3,1,2}; //ard 2,3,4,5,7,10,11,12,13

int ret=5;

int in_val=5;

void main()

{

struct device* pinmux_dev = device_get_binding(CONFIG_PINMUX_DEV_NAME);

if (pinmux_dev==NULL)

printk("pin failed to get binding\n");

else

printk("pin binding successfull\n");

for(int i=0; i

{

ret=pinmux_pin_set(pinmux_dev, input_pins[i], PINMUX_FUNC_A);

printk("Pin %d mode set ret as %d\n",input_pins[i], ret);

k_sleep(100);

}

struct device* dev = NULL;

dev = device_get_binding("GPIO_0");

if (dev==NULL)

printk("device failed to get binding\n");

else

printk("device binding sucessfull\n");

for(int i=0; i

{

ret = gpio_pin_configure(dev, input_pins[i], GPIO_DIR_IN | GPIO_PUD_PULL_DOWN);

if (ret==0)

printk("pin %d configured as input \n", input_pins[i]);

else

printk("pin configuration error");

}

while(1)

{

for(int i=0; i

{

ret = gpio_pin_read(dev,input_pins[i],&in_val);

if (ret==0)

printk("GPIO read at pin %d successfull with value %d\n", input_pins[i], in_val);

else

printk("GPIO read unsuccessfull");

k_sleep(1000);

}

}

}

so in this case, the pins are being configured as input but they are not following the command of being pulled down (or pull up- have tried that too, i have also tried disabling the gpio pins and then enabling them again). Whatever i try, their default state doesnt change. A few pins come up as 1 and a few as 0. on configuration, i want all pins as either 0 or 1. Do help.

Also about IO8, if i add that to my array i.e input_pins[] (as gpio pin 16 on zephyr) then the code stops executing after displaying pin binding successful on the serial monitor. This problem arises even if i try to configure it as output. Do help

AAsar
Beginner
110 Views

Also, sending you a screenshot of the serial monitor. sorry, pins 3,5,13(arduino pins) are pulled down while others are pulled up.

idata
Community Manager
110 Views

Hello me_5,

 

 

Thank you for providing me this information.

 

 

We will take a look at this and see if we can replicate this behavior. If we are able to do so, or we are able to find out why this might be happening, I will make sure to update you in here.

 

 

Meanwhile, something that might be useful to know is, are you using the M tree or the Z tree?

 

 

Pedro M.
idata
Community Manager
110 Views

Hello me_5,

I've been doing some tests on my Arduino 101 and unfortunately I've not been able to run your code. I'm getting the following error:

makers@makers:~/Documents/Peter/CODK_Z/CODK-Z$ make compile-x86

Compiling x86 core

make O=/home/makers/Documents/Peter/CODK_Z/CODK-Z//out/x86 BOARD=arduino_101_factory ARCH=x86 -C /home/makers/Documents/Peter/CODK_Z/CODK-Z/test/x86

make[1]: Entering directory `/home/makers/Documents/Peter/CODK_Z/CODK-Z/test/x86'

make[2]: Entering directory `/home/makers/Documents/Peter/CODK_Z/zephyr'

make[3]: Entering directory `/home/makers/Documents/Peter/CODK_Z/CODK-Z/out/x86'

Using /home/makers/Documents/Peter/CODK_Z/zephyr as source for kernel

GEN ./Makefile

CHK include/generated/version.h

CHK misc/generated/configs.c

CHK include/generated/offsets.h

CHK misc/generated/sysgen/prj.mdef

CC src/main.o

/home/makers/Documents/Peter/CODK_Z/CODK-Z/test/x86/src/main.c: In function 'main':

/home/makers/Documents/Peter/CODK_Z/CODK-Z/test/x86/src/main.c:30:3: warning: implicit declaration of function 'k_sleep' [-Wimplicit-function-declaration]

k_sleep(100);

^

LD src/built-in.o

AR libzephyr.a

LINK zephyr.lnk

src/built-in.o: In function `main':

/home/makers/Documents/Peter/CODK_Z/CODK-Z/test/x86/src/main.c:30: undefined reference to `k_sleep'

/home/makers/Documents/Peter/CODK_Z/CODK-Z/test/x86/src/main.c:57: undefined reference to `k_sleep'

collect2: error: ld returned 1 exit status

make[3]: *** [.tmp_zephyr.prebuilt] Error 1

make[3]: Leaving directory `/home/makers/Documents/Peter/CODK_Z/CODK-Z/out/x86'

make[2]: *** [sub-make] Error 2

make[2]: Leaving directory `/home/makers/Documents/Peter/CODK_Z/zephyr'

make[1]: *** [all] Error 2

make[1]: Leaving directory `/home/makers/Documents/Peter/CODK_Z/CODK-Z/test/x86'

make: *** [compile-x86] Error 2

These are the steps I followed:

mkdir -p ~/CODK && cd $_

 

git clone https://github.com/01org/CODK-Z.git https://github.com/01org/CODK-Z.git

 

cd CODK-Z

 

make clone

 

sudo make install-dep

 

make setup

 

source ../zephyr/zephyr-env.sh

 

make compile-x86

 

make upload-x86-dfu

***I checked that the board got flashed correctly and closed the terminal to start a new session.

cd ~/CODK/CODK-Z

 

source ../zephyr/zephyr-env.sh

 

make project PROJ_DIR=test

***I received the message that the new project got created correctly, I closed the terminal to start a new session and copied the code into test/x86/src/main.c

cd ~/CODK/CODK-Z

 

source ../zephyr/zephyr-env.sh

 

make compile-x86

Do you get the same output? If you don't, what steps did you take to compile this code? I'm using the Z tree.

 

Let me know.

 

Pedro M.
AAsar
Beginner
110 Views

Hi, Thanks for the reply.

To answer your question, I am not familiar with the terminology of "tree". Correct me if I am wrong but it is used solely with respect to Intel Curie Open Development Kit?

What I am doing is flashing the zephyr code directly via the terminal window without the use of any other development kit

Is the use of z-tree necessary? If so, how is it used? could you please elaborate? Also, is it something only for Intel Curie Open Development Kit?

idata
Community Manager
110 Views

Yes, you are correct, the term tree refers to Curie's ODK. You can find details about the A, M, Z trees and their differences in https://software.intel.com/en-us/node/674972.

 

 

I am indeed trying to compile and upload your code using the ODK by following the instructions found in:

 

 

https://software.intel.com/en-us/node/675544

 

https://software.intel.com/en-us/node/700100

 

 

How did you upload your project to your Arduino 101? Could you please send us the step by step process to see if we can replicate the behavior you described?

 

 

Let me know.

 

Pedro M.
AAsar
Beginner
110 Views

Hi, I've gone through the links u sent. I tried installing it but got the following error:

Ign http://in.archive.ubuntu.com/ http://in.archive.ubuntu.com trusty InRelease

Get:1 http://security.ubuntu.com/ http://security.ubuntu.com trusty-security InRelease [65.9 kB]

Get:2 http://in.archive.ubuntu.com/ http://in.archive.ubuntu.com trusty-updates InRelease [65.9 kB]

Hit http://ppa.launchpad.net/ http://ppa.launchpad.net trusty InRelease

Hit http://in.archive.ubuntu.com/ http://in.archive.ubuntu.com trusty-backports InRelease

Ign http://extras.ubuntu.com/ http://extras.ubuntu.com trusty InRelease

Get:3 http://extras.ubuntu.com/ http://extras.ubuntu.com trusty Release.gpg [72 B]

Hit http://in.archive.ubuntu.com/ http://in.archive.ubuntu.com trusty Release.gpg

Hit http://ppa.launchpad.net/ http://ppa.launchpad.net trusty/main amd64 Packages

Hit http://extras.ubuntu.com/ http://extras.ubuntu.com trusty Release

Get:4 http://in.archive.ubuntu.com/ http://in.archive.ubuntu.com trusty-updates/main Sources [392 kB]

Get:5 http://security.ubuntu.com/ http://security.ubuntu.com trusty-security/main Sources [126 kB]

Hit <a data-saferedirecturl="https://www.google.com/url?hl=en&q=http://extras.ubuntu.com&source=gmail&ust=1487917613484000&usg=AF..." href="http://extras.ubuntu.com/" style="color: # 11...

idata
Community Manager
110 Views

I see, I haven't had any issues with the examples provided on the ODK. However, I believe I was able to find the issue in my compilation thanks to your post. I was compiling for x86 not arc. I just tested compiling your code for arc and there was no issue, not yet at least.

 

 

Please let me do some tests to see if I can replicate the issue. I will post all the steps I took and the results of my tests as soon as possible.

 

 

Also, I wanted to as you how you connected the serial monitor to your Arduino 101? Is it connected to the board's USB port or pins 0 and 1?

 

 

Pedro M.
AAsar
Beginner
110 Views

Hi, sorry for replying so late.

The serial monitor is connected via pins 0 and 1.

I Think its more of a problem with the configuration in the code and Zephyr environment than anything else.

Thanks for the help though. If you do find anything do let me know.

idata
Community Manager
110 Views

I understand, thank you for letting us know. I'm still working on this, let me do some more testing and I'll get back to you as soon as possible.

 

 

Pedro M.
idata
Community Manager
110 Views

Hi me_5,

 

 

I'm sorry it's taken so long to come back to you. I've a few questions for you.

 

 

Firstly, I can see from your code that you are using UART but I also noticed that you used ARC to compile. What confuses us is the information found at https://www.zephyrproject.org/doc/boards/x86/arduino_101/doc/board.html. Under supported features you will see that UART is not supported on ARC. So, this makes me believe you are in fact x86, so, we would you to answer us this questions:

 

 

1. Are you interested in using CODK-M, a combination of Arduino CoreLibs and Zephyr 1.6? Or, are you more interested in CODK-Z, straight Zephyr environment?

 

In case you are indeed interested in using the CODK-Z, I suggest you to go to contact the Zephyr team directly as they have the better information on their drivers. You can contact them at mailto:info@zephyrproject.org info@zephyrproject.org.

 

2. If you are indeed using the CODK-M, could you please clarify us if you are using the ARC Corelibs or the x86 Zephyr or both on your project? In addition, which core are you going to use to drive these pins?

 

 

Let me know.

 

Pedro M.
idata
Community Manager
110 Views

Hello me_5,

 

 

Do you have any updates about this?

 

 

Pedro M.
idata
Community Manager
110 Views

Hello me_5,

 

 

In case you still need help, please let us know by replying to this thread.

 

 

We'll try to help you in any way we can.

 

Pedro M.
Reply