Can't get GPIO to work correctly

Moderators: mdrjr, odroid

Can't get GPIO to work correctly

Unread postby TomAngel » Thu Sep 14, 2017 7:42 pm

Hi,

I use my Odroid U3 as Server for TT-RSS Newsfeed aggregator and Nextcloud Server.
After several Power Blackouts my eMMC Card got damaged. For not to have to buy a new one I switched over to mSD-Card.
Same time I decided to switch from Ubuntu to ArchLinux because of it's oob support for Odroids and it's rolling release concept.
After days of readings I got everything up again. Thanks to ArchLinux good documentation.
After many months of searching I recently got a UPS2 for U3 from a shop in Germany.

I followed the Wiki, and after I got the correct cron command my U3 forced to schutdown every two minutes.
I measured the Voltages on the pins 1,3 to pin 7 and verything seemed OK, but my U3 forced to shutdown in a 2 minutes loop.

So I disabled the cron service to kepp my U3 running for evaluation.

What I found out:
Code: Select all
#Enable GPIOs'
echo 199 > /sys/class/gpio/export
echo 200 > /sys/class/gpio/export

#Set Type
echo "in" > /sys/class/gpio/gpio199/direction
echo "in" > /sys/class/gpio/gpio200/direction


Measure Voltages with AC-Jack plugged in
Pin 1 ==> Pin 7 == 1.74V
Pin 3 ==> Pin 7 == 1.72V

Code: Select all
cat /sys/class/gpio/gpio199/value
cat /sys/class/gpio/gpio200/value

Both commands got back a 0 while both had to be 1.

Plugged AC-Jack off

Measured Voltages
Pin 1 ==> Pin 7 == 0V
Pin 3 ==> Pin 7 == 1.7V

Code: Select all
cat /sys/class/gpio/gpio199/value
cat /sys/class/gpio/gpio200/value

Both commands got back a 0 again while the gpio200 should have to be 1.

So there is no change in GPIO value when changing from high to low and back.
To set type to "out" and set value manually to "1" gets read the correct state.

I cant get the GPIOs to work as inputs and change its states. Where I'm wrong?
TomAngel
 
Posts: 9
Joined: Mon Aug 04, 2014 6:44 am
languages_spoken: english, german
ODROIDs: Odroid U3

Re: Can't get GPIO to work correctly

Unread postby odroid » Fri Sep 15, 2017 9:15 am

Check "lsmod" output first.
If other driver modules use the GPIO pins, GPIO values could be different.
In that case, add the unused modules into the blacklist.
User avatar
odroid
Site Admin
 
Posts: 25307
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: Can't get GPIO to work correctly

Unread postby TomAngel » Fri Sep 15, 2017 1:36 pm

My lsmod output...

Code: Select all
Last login: Thu Sep 14 22:35:09 2017 from 192.168.2.110
[alarm@odroid ~]$ lsmod
Module                  Size  Used by
iptable_filter         16384  1
iptable_mangle         16384  0
iptable_nat            16384  0
nf_conntrack_ipv4      16384  1
nf_defrag_ipv4         16384  1 nf_conntrack_ipv4
nf_nat_ipv4            16384  1 iptable_nat
nf_nat                 28672  1 nf_nat_ipv4
nf_conntrack          122880  3 nf_conntrack_ipv4,nf_nat_ipv4,nf_nat
snd_soc_i2s            24576  4
snd_soc_idma           16384  1 snd_soc_i2s
snd_soc_max98090       65536  1
snd_soc_simple_card    16384  0
snd_soc_s3c_dma        16384  1 snd_soc_i2s
snd_soc_simple_card_utils    16384  1 snd_soc_simple_card
s5p_csis               20480  0
smsc95xx               24576  0
s5p_fimc               61440  0
usbnet                 36864  1 smsc95xx
snd_soc_core          159744  6 snd_soc_idma,snd_soc_s3c_dma,snd_soc_simple_card_utils,snd_soc_i2s,snd_soc_max98090,snd_soc_simple_card
mii                    16384  2 usbnet,smsc95xx
pwm_fan                16384  0
exynos4_is_common      16384  1 s5p_fimc
evdev                  24576  2
ac97_bus               16384  1 snd_soc_core
v4l2_fwnode            16384  2 s5p_csis,s5p_fimc
snd_pcm_dmaengine      16384  1 snd_soc_core
snd_pcm                98304  5 snd_soc_idma,snd_pcm_dmaengine,snd_soc_i2s,snd_soc_max98090,snd_soc_core
exynosdrm             131072  0
snd_timer              32768  1 snd_pcm
s5p_jpeg               45056  0
s5p_mfc               135168  0
analogix_dp            32768  1 exynosdrm
v4l2_mem2mem           24576  2 s5p_jpeg,s5p_fimc
videobuf2_dma_contig    20480  3 s5p_jpeg,s5p_mfc,s5p_fimc
videobuf2_memops       16384  1 videobuf2_dma_contig
videobuf2_v4l2         24576  4 s5p_jpeg,s5p_mfc,v4l2_mem2mem,s5p_fimc
videobuf2_core         45056  5 s5p_jpeg,s5p_mfc,v4l2_mem2mem,videobuf2_v4l2,s5p_fimc
rc_cec                 16384  0
s5p_cec                16384  0
cec                    45056  2 exynosdrm,s5p_cec
exynos_rng             16384  0
s5p_sss                16384  0
s3c2410_wdt            16384  0
uio_pdrv_genirq        16384  0
uio                    16384  1 uio_pdrv_genirq
sch_fq_codel           20480  2
ip_tables              24576  3 iptable_mangle,iptable_filter,iptable_nat
x_tables               24576  3 iptable_mangle,ip_tables,iptable_filter
[alarm@odroid ~]$ lsmod | grep gpio
[alarm@odroid ~]$
TomAngel
 
Posts: 9
Joined: Mon Aug 04, 2014 6:44 am
languages_spoken: english, german
ODROIDs: Odroid U3

Re: Can't get GPIO to work correctly

Unread postby odroid » Fri Sep 15, 2017 2:15 pm

lsmod output looks okay.

Let's try to find other possible root cause.
Remove the UPS2 from U3 board.
And read gpio200/value while changing the level by connecting 1.8volt to the pin.
User avatar
odroid
Site Admin
 
Posts: 25307
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: Can't get GPIO to work correctly

Unread postby TomAngel » Sun Sep 17, 2017 8:30 pm

Sorry for my late feedback, but I had no much time the last days.

So I followed your advice and put 1.8v directly to the Pin, but it remains the same. Value stays 0.
TomAngel
 
Posts: 9
Joined: Mon Aug 04, 2014 6:44 am
languages_spoken: english, german
ODROIDs: Odroid U3

Re: Can't get GPIO to work correctly

Unread postby odroid » Mon Sep 18, 2017 8:57 am

Did you remove the UPS board while you measure the check the pin value?
User avatar
odroid
Site Admin
 
Posts: 25307
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: Can't get GPIO to work correctly

Unread postby TomAngel » Mon Sep 18, 2017 1:17 pm

Yes I did. I powered from external power source. Two AA-Batteries with Poti to adjust to exact 1.8v and Button to trigger it. I tried up to 1.92v to ensure to get over logic level.
TomAngel
 
Posts: 9
Joined: Mon Aug 04, 2014 6:44 am
languages_spoken: english, german
ODROIDs: Odroid U3

Re: Can't get GPIO to work correctly

Unread postby odroid » Tue Sep 19, 2017 5:59 pm

We've installed ubuntu-14.04.2lts image on U3. Kernel version is 3.8.13.30
We connected a wire from pin-2(vdd_io 1.8V) to pin connector pin-1(199) and pin-3(200).
We could read the value without issue.

Do you have a problem of reading from pin-1 and pin-3 both?
User avatar
odroid
Site Admin
 
Posts: 25307
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: Can't get GPIO to work correctly

Unread postby TomAngel » Wed Sep 20, 2017 12:34 am

I tried yours, connecting Pin2 to Pin1 and Pin2 to Pin3.
cat /sys/class/gpio/gpio***/value are always 0. (199 and 200 for ***).
echo to export and setting direction are working fine without error results.

Output for uname -a is
Code: Select all
Linux odroid 4.13.2-1-ARCH #1 SMP
+timestamp
Code: Select all
armv7l GNU/Linux


I have no idea what is wrong. Otherwise Arch Linux for ARM suports my U3 out of the box.
Measuring Voltage from Pin2 to Pin7(Ground) gives 1.82v

Board Revision is REV.0.2 20131107 printed on the U3-Board and I don't have 2x2 Pin connector.
Probably this helps...?
TomAngel
 
Posts: 9
Joined: Mon Aug 04, 2014 6:44 am
languages_spoken: english, german
ODROIDs: Odroid U3

Re: Can't get GPIO to work correctly

Unread postby odroid » Wed Sep 20, 2017 8:42 am

Can you try our Ubuntu image to narrow down root causes? Do you have a spare micro-SD card (8GB<)?
User avatar
odroid
Site Admin
 
Posts: 25307
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: Can't get GPIO to work correctly

Unread postby TomAngel » Thu Sep 21, 2017 12:15 pm

This will take some days, because I have much work this and next week. I will try after and report.
Thank you for your help till now...
TomAngel
 
Posts: 9
Joined: Mon Aug 04, 2014 6:44 am
languages_spoken: english, german
ODROIDs: Odroid U3


Return to Hardware and peripherals

Who is online

Users browsing this forum: No registered users and 1 guest