setting of GPIO is unstable

Post Reply
Zaren
Posts: 62
Joined: Wed Nov 08, 2017 7:12 am
languages_spoken: english
ODROIDs: ODROID C1+, XU4
Location: Poland
Has thanked: 20 times
Been thanked: 0
Contact:

setting of GPIO is unstable

Unread post by Zaren » Mon Oct 14, 2019 5:10 am

Hello!
I'm trying to use wiringPi and I see strange behaviour of that

Code: Select all

 |  100 |  22 | GPIO.100 |  OUT | 1 | 31 || 32 | 0 | OUT  | GPIO. 99 | 26  |  99  |
 |  108 |  23 | GPIO.108 |   IN | 1 | 33 || 34 |   |      | 0v       |     |      |
 |   97 |  24 | GPIO.97  |  OUT | 1 | 35 || 36 | 1 | IN   | GPIO. 98 | 27  |  98  |
 |      |  25 |    AIN.1 |      |   | 37 || 38 |   |      | 1v8      | 28  |      |
 |      |     |       0v |      |   | 39 || 40 |   |      | AIN.0    | 29  |      |
 +------+-----+----------+------+---+----++----+---+------+----------+-----+------+
odroid@odroid:~$ sudo gpio read 22
1
odroid@odroid:~$ sudo gpio write 22 0
odroid@odroid:~$ sudo gpio read 22
1
Did I something wrong? The pin 100 setup as OUT. wiringPi number is 22. There is some unstable setup. Sometimes it works sometimes not. It is possible to get stable work of wiringPi?

Cheers, Zaren

User avatar
odroid
Site Admin
Posts: 32519
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 184 times
Been thanked: 349 times
Contact:

Re: setting of GPIO is unstable

Unread post by odroid » Mon Oct 14, 2019 10:10 am

Which Kernel and Wiringpi version do you use?
Can you show us "lsmod" output too?
These users thanked the author odroid for the post:
Zaren (Fri Nov 01, 2019 1:48 pm)

Zaren
Posts: 62
Joined: Wed Nov 08, 2017 7:12 am
languages_spoken: english
ODROIDs: ODROID C1+, XU4
Location: Poland
Has thanked: 20 times
Been thanked: 0
Contact:

Re: setting of GPIO is unstable

Unread post by Zaren » Mon Oct 14, 2019 1:57 pm

wiringPi 2.0

Linux odroid 3.10.107 #3 SMP PREEMPT Thu Jan 25 21:55:10 UTC 2018 armv7l armv7l armv7l GNU/Linux

Code: Select all

Module                  Size  Used by
auth_rpcgss            44749  0
oid_registry            2579  1 auth_rpcgss
nfsv4                 182273  1
nfs                   132606  2 nfsv4
lockd                  64549  1 nfs
dns_resolver            5249  1 nfs
squashfs               28677  0
can_raw                 5839  3
can                    23954  1 can_raw
nls_cp437               5117  1
dwav_usb_mt             4641  0
meson_gpiomem           3378  2
joydev                  8775  0
ads7846                13832  0
spidev                  5442  0
mcp251x                11474  0
can_dev                 9064  1 mcp251x
sunrpc                194172  11 nfs,auth_rpcgss,lockd,nfsv4
spicc                   8279  0
autofs4                22255  2
It is possible to set GPIO w/o wiringPi? I tryed console command "echo 0 > /sys/class/gpio/gpio100/value" but it's also work unstable :(

User avatar
odroid
Site Admin
Posts: 32519
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 184 times
Been thanked: 349 times
Contact:

Re: setting of GPIO is unstable

Unread post by odroid » Mon Oct 14, 2019 3:05 pm

I think uncertain device driver might take GPIO-100 (Pin#31).
We will check it tomorrow.

BTW, do you have the issue with only GPIO-100? How about other GPIO pins?
These users thanked the author odroid for the post:
Zaren (Fri Nov 01, 2019 1:48 pm)

Zaren
Posts: 62
Joined: Wed Nov 08, 2017 7:12 am
languages_spoken: english
ODROIDs: ODROID C1+, XU4
Location: Poland
Has thanked: 20 times
Been thanked: 0
Contact:

Re: setting of GPIO is unstable

Unread post by Zaren » Mon Oct 14, 2019 4:13 pm

I use multiplexor and for it needs 3 pins. I use 99, 83, and try 108 or 100. 99,83 pins worked ok. But GPIO-108, 100 are unstable. Unfoturnately rest pins are busy for my project. I need 3 pins but have only 2. It will be good if manage to free 108 or 100


Thanks!

Zaren
Posts: 62
Joined: Wed Nov 08, 2017 7:12 am
languages_spoken: english
ODROIDs: ODROID C1+, XU4
Location: Poland
Has thanked: 20 times
Been thanked: 0
Contact:

Re: setting of GPIO is unstable

Unread post by Zaren » Mon Oct 14, 2019 5:15 pm

By the way, how to learn which pin is free for use and which is taken by driver or something else? If it is possible in which way?

User avatar
odroid
Site Admin
Posts: 32519
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 184 times
Been thanked: 349 times
Contact:

Re: setting of GPIO is unstable

Unread post by odroid » Mon Oct 14, 2019 6:53 pm

According to your lsmod output, you are using SPI driver with ads7846 touchscreen and mcp251x CAN drivers.
If it is not true, add the following drivers in the blacklist file. Probably "/etc/modprobe.d/blacklist-odroid.conf"
spidev
spicc
ads7846
mcp251x
can_dev
can_raw
can
These users thanked the author odroid for the post:
Zaren (Fri Nov 01, 2019 1:49 pm)

Zaren
Posts: 62
Joined: Wed Nov 08, 2017 7:12 am
languages_spoken: english
ODROIDs: ODROID C1+, XU4
Location: Poland
Has thanked: 20 times
Been thanked: 0
Contact:

Re: setting of GPIO is unstable

Unread post by Zaren » Tue Oct 15, 2019 3:37 am

Hej,

viewtopic.php?f=112&t=35601

Right now I'm using for mcp251x following GPIO's : 117,104,87,102,101,116,98,97 for SS/IRQ purposes.
It is possible to free 108 or 100 ? Because it seems free now...

Thanks!

joshua.yang
Posts: 287
Joined: Fri Sep 22, 2017 5:54 pm
languages_spoken: Korean, English
ODROIDs: XU4, XU4Q + Cloudshell2, H2, N2
Has thanked: 2 times
Been thanked: 40 times
Contact:

Re: setting of GPIO is unstable

Unread post by joshua.yang » Tue Oct 15, 2019 10:00 am

Hi,

How about results of cat /sys/kernel/debug/gpio?

This file describes which pins are used on your Odroid.
If a module uses a pin, you can find out which module uses that pin by the file.
These users thanked the author joshua.yang for the post:
Zaren (Fri Nov 01, 2019 1:49 pm)

Zaren
Posts: 62
Joined: Wed Nov 08, 2017 7:12 am
languages_spoken: english
ODROIDs: ODROID C1+, XU4
Location: Poland
Has thanked: 20 times
Been thanked: 0
Contact:

Re: setting of GPIO is unstable

Unread post by Zaren » Tue Oct 15, 2019 1:46 pm

Code: Select all

cat /sys/kernel/debug/gpio 
GPIOs 0-138:
 gpio-3   (amlsd               ) out lo
 gpio-5   (DWC_OTG             ) out hi
 gpio-13  (blue:heartbeat      ) out hi
 gpio-49  (amlsd               ) in  hi
 gpio-88  (ads7846_pendown     ) in  hi
 gpio-97  (spicc_cs            ) out hi
 gpio-100 (spicc_cs            ) out hi
 gpio-101 (spicc_cs            ) out hi
 gpio-102 (spicc_cs            ) out hi
 gpio-103 (spicc_cs            ) out hi
 gpio-117 (spicc_cs            ) out hi
 gpio-118 (spicc_cs            ) out hi
Thanks! Now I see. But there is no 108 pin...

Zaren
Posts: 62
Joined: Wed Nov 08, 2017 7:12 am
languages_spoken: english
ODROIDs: ODROID C1+, XU4
Location: Poland
Has thanked: 20 times
Been thanked: 0
Contact:

Re: setting of GPIO is unstable

Unread post by Zaren » Tue Oct 15, 2019 2:07 pm

now I found in meson8_odroidc.dts

Code: Select all

1076         odroid_pwm0:odroid_pwm0{
1077             amlogic,setmask=<2 0x00000008>;     /*GPIOX_11 PWM_B Reg2[3]*/
1078             amlogic,clrmask=<3 0x00100000
1079                              7 0x40000000>;
1080             amlogic,pins="GPIOX_11";
1081         };
and

Code: Select all

857                 sdhc_a_pins:sdhc_a_pin{
 858                         amlogic,setmask=<8 0x3f>;
 859                         amlogic,clrmask=<5 0x6c00 >;
 860                         amlogic,pins="GPIOX_0","GPIOX_1","GPIOX_2","GPIOX_3","GPIOX_8","GPIOX_9";
 861                 };
 862 
 863         sdio_all_pins:sdio_all_pins{
 864             amlogic,setmask=<8 0x0000003f>;         /*sdio a*/
 865             amlogic,clrmask=<6 0x3f000000           /*sdio c*/
 866                                 2 0x0000fc00        /*sdio b*/
 867                                 5 0x00006c00>;      /*sdhc a*/
 868             amlogic,pins = "GPIOX_0","GPIOX_1","GPIOX_2","GPIOX_3","GPIOX_8","GPIOX_9";
 869             amlogic,enable-output=<1>; /** 0:output, 1:input */
 870             amlogic,pullup=<1>;
 871             amlogic,pullupen=<1>;
which is GPIOX_3=100 and GPIOX_11=108

It is the reason "unstable" work of those pins?

joshua.yang
Posts: 287
Joined: Fri Sep 22, 2017 5:54 pm
languages_spoken: Korean, English
ODROIDs: XU4, XU4Q + Cloudshell2, H2, N2
Has thanked: 2 times
Been thanked: 40 times
Contact:

Re: setting of GPIO is unstable

Unread post by joshua.yang » Tue Oct 15, 2019 2:21 pm

It might be, but I think it doesn't because when the pin comes to PWM mode, its pin mux (as labeled as "mode" in gpio readall) should be changed to ALT.

But to make sure, could you enter the following commands and test again? These commands disable PWM functionalities in device tree.

Code: Select all

fdtput -t s /media/boot/meson8b_odroidc.dtb /pwm status "disabled"
fdtput -t s /media/boot/meson8b_odroidc.dtb /pwm-ctrl status "disabled"
Reboot to take effect.

Then, you can check if it is disabled.

Code: Select all

root@odroid:~# fdtget /media/boot/meson8b_odroidc.dtb /pwm status
disabled
root@odroid:~# fdtget /media/boot/meson8b_odroidc.dtb /pwm-ctrl status
disabled
These users thanked the author joshua.yang for the post:
Zaren (Fri Nov 01, 2019 1:49 pm)

Zaren
Posts: 62
Joined: Wed Nov 08, 2017 7:12 am
languages_spoken: english
ODROIDs: ODROID C1+, XU4
Location: Poland
Has thanked: 20 times
Been thanked: 0
Contact:

Re: setting of GPIO is unstable

Unread post by Zaren » Tue Oct 15, 2019 2:40 pm

I do disable PWM and rebooted and before it I exclude GPIOX_3 from spi usage (before it I found thanks to /sys/kernel/debug/gpio):

Code: Select all

odroid@odroid:~$ sudo fdtget  /media/boot/meson8b_odroidc.dtb /pwm status
[sudo] password for odroid: 
disabled
odroid@odroid:~$ sudo gpio read 22 
1
odroid@odroid:~$ sudo gpio write 22 0
odroid@odroid:~$ sudo gpio read 22 
0
odroid@odroid:~$ sudo gpio read 22 
0
odroid@odroid:~$ sudo gpio read 22 
1
odroid@odroid:~$ sudo gpio read 22 
1
odroid@odroid:~$ sudo gpio read 22 
1
odroid@odroid:~$ sudo fdtget  /media/boot/meson8b_odroidc.dtb /pwm-ctrl status
disabled
Any way it is somehow change value :(

And 108 also

Code: Select all

odroid@odroid:~$ sudo gpio mode 23 out
odroid@odroid:~$ sudo gpio readall
 +------+-----+----------+------+- Model ODROID-C -+------+----------+-----+------+
 | GPIO | wPi |   Name   | Mode | V | Physical | V | Mode |   Name   | wPi | GPIO |
 +------+-----+----------+------+---+----++----+---+------+----------+-----+------+
 |      |     |     3.3v |      |   |  1 || 2  |   |      | 5v       |     |      |
 |      |   8 |    SDA.1 |      |   |  3 || 4  |   |      | 5V       |     |      |
 |      |   9 |    SCL.1 |      |   |  5 || 6  |   |      | 0v       |     |      |
 |   83 |   7 | GPIO. 83 |  OUT | 1 |  7 || 8  |   |      | TxD1     | 15  |      |
 |      |     |       0v |      |   |  9 || 10 |   |      | RxD1     | 16  |      |
 |   88 |   0 | GPIO. 88 |   IN | 1 | 11 || 12 | 1 | IN   | GPIO. 87 | 1   |  87  |
 |  116 |   2 | GPIO.116 |   IN | 1 | 13 || 14 |   |      | 0v       |     |      |
 |  115 |   3 | GPIO.115 |   IN | 1 | 15 || 16 | 1 | IN   | GPIO.104 | 4   |  104 |
 |      |     |     3.3v |      |   | 17 || 18 | 1 | OUT  | GPIO.102 | 5   |  102 |
 |  107 |  12 |     MOSI |   IN | 1 | 19 || 20 |   |      | 0v       |     |      |
 |  106 |  13 |     MISO |   IN | 1 | 21 || 22 | 1 | OUT  | GPIO.103 | 6   |  103 |
 |  105 |  14 |     SCLK |   IN | 1 | 23 || 24 | 1 | OUT  | CE0      | 10  |  117 |
 |      |     |       0v |      |   | 25 || 26 | 1 | OUT  | GPIO.118 | 11  |  118 |
 |      |  30 |    SDA.2 |      |   | 27 || 28 |   |      | SCL.2    | 31  |      |
 |  101 |  21 | GPIO.101 |  OUT | 1 | 29 || 30 |   |      | 0v       |     |      |
 |  100 |  22 | GPIO.100 |  OUT | 1 | 31 || 32 | 1 | OUT  | GPIO. 99 | 26  |  99  |
 |  108 |  23 | GPIO.108 |   IN | 1 | 33 || 34 |   |      | 0v       |     |      |
 |   97 |  24 | GPIO.97  |  OUT | 1 | 35 || 36 | 1 | IN   | GPIO. 98 | 27  |  98  |
 |      |  25 |    AIN.1 |      |   | 37 || 38 |   |      | 1v8      | 28  |      |
 |      |     |       0v |      |   | 39 || 40 |   |      | AIN.0    | 29  |      |
 +------+-----+----------+------+---+----++----+---+------+----------+-----+------+

joshua.yang
Posts: 287
Joined: Fri Sep 22, 2017 5:54 pm
languages_spoken: Korean, English
ODROIDs: XU4, XU4Q + Cloudshell2, H2, N2
Has thanked: 2 times
Been thanked: 40 times
Contact:

Re: setting of GPIO is unstable

Unread post by joshua.yang » Tue Oct 15, 2019 5:35 pm

It shouldn't be. :O

How about the fresh image? Could you check out that?
I think something uses those pins directly. Maybe not through a module.
These users thanked the author joshua.yang for the post:
Zaren (Fri Nov 01, 2019 1:49 pm)

Zaren
Posts: 62
Joined: Wed Nov 08, 2017 7:12 am
languages_spoken: english
ODROIDs: ODROID C1+, XU4
Location: Poland
Has thanked: 20 times
Been thanked: 0
Contact:

Re: setting of GPIO is unstable

Unread post by Zaren » Tue Oct 15, 2019 5:58 pm

Ok, it's clear. Maybe it is bug in my side. I will check

Zaren
Posts: 62
Joined: Wed Nov 08, 2017 7:12 am
languages_spoken: english
ODROIDs: ODROID C1+, XU4
Location: Poland
Has thanked: 20 times
Been thanked: 0
Contact:

Re: setting of GPIO is unstable

Unread post by Zaren » Thu Oct 17, 2019 1:15 pm

I found what the deal with 108 pin. It's my old daemon play with it.

joshua.yang
Posts: 287
Joined: Fri Sep 22, 2017 5:54 pm
languages_spoken: Korean, English
ODROIDs: XU4, XU4Q + Cloudshell2, H2, N2
Has thanked: 2 times
Been thanked: 40 times
Contact:

Re: setting of GPIO is unstable

Unread post by joshua.yang » Thu Oct 17, 2019 2:18 pm

Fortunately, we found the hidden culprit. :)
These users thanked the author joshua.yang for the post:
Zaren (Fri Nov 01, 2019 1:49 pm)

Post Reply

Return to “Ubuntu”

Who is online

Users browsing this forum: No registered users and 5 guests