GPIO PIn2 is stop while connectservice

GPIO PIn2 is stop while connectservice how to fix it

Jan 24 17:45:59 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c app_Start() 3471 | Starting app ‘gpio’
Jan 24 17:46:00 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c CreateFileLink() 2084 | Skipping file link '/legato/systems/current/apps/gpio/read-only/lib/libComponent_gpioCompi
Jan 24 17:46:00 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c CreateFileLink() 2084 | Skipping file link ‘/legato/systems/current/apps/gpio/read-only/bin/gpio’ to '/legato/syss
Jan 24 17:46:00 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | proc.c proc_Start() 1403 | Starting process ‘gpio’ with pid 12624
Jan 24 17:46:00 swi-mdm9x28-wp user.info Legato: INFO | supervisor[12624]/supervisor T=main | proc.c proc_Start() 1363 | Execing ‘gpio’
Jan 24 17:46:00 swi-mdm9x28-wp user.debug Legato: DBUG | UNKNOWN[12624]/ T=main | _componentMain.c _gpioComponent_Init() 222 | Initializing gpioComponent component library.
Jan 24 17:46:00 swi-mdm9x28-wp user.info Legato: INFO | gpioService[1936]/sysfsGpio T=main | gpioSysfsUtils.c gpioSysfs_SessionOpenHandlerFunc() 1176 | Assigning GPIO 2
Jan 24 17:46:00 swi-mdm9x28-wp user.debug Legato: DBUG | UNKNOWN[12624]/framework T=main | le_gpioPin2_client.c DoConnectService() 242 | ======= Starting client for ‘gpio.gpioComponent.le_gpioPin2’ service =====

at+wiocfg?
+WIOCFG: 2,16,0,0,1,0,0
+WIOCFG: 4,4,0,0,1,0,0
+WIOCFG: 6,4,0,0,1,0,0
+WIOCFG: 7,16,0,0,1,0,0
+WIOCFG: 8,16,0,0,1,0,0
+WIOCFG: 13,16,0,0,1,0,0
+WIOCFG: 21,16,0,0,1,0,0
+WIOCFG: 22,16,0,0,1,0,0
+WIOCFG: 23,16,0,0,1,0,0
+WIOCFG: 24,16,0,0,1,0,0
+WIOCFG: 25,16,0,0,1,0,0
+WIOCFG: 28,16,0,0,1,0,0
+WIOCFG: 29,16,0,0,1,0,0
+WIOCFG: 30,16,0,0,1,0,0
+WIOCFG: 31,16,0,0,1,0,0
+WIOCFG: 32,16,0,0,1,0,0
+WIOCFG: 33,16,0,0,1,0,0
+WIOCFG: 35,16,0,0,1,0,0
+WIOCFG: 42,16,0,0,1,0,0

OK

Does GPIO2 work on linux console?

BTW, you can try this example:

i got it like this:

root@swi-mdm9x28-wp:# echo 2 >> /sys/class/gpio/export
sh: write error: Device or resource busy

maybe it is already exported:

root@swi-mdm9x28-wp:~# ls /sys/class/gpio/
export gpiochip0 gpiochip1018 gpiochip852 gpiochip948
gpio13 gpiochip1 gpiochip200 gpiochip884 gpiochip980
gpio2 gpiochip1012 gpiochip820 gpiochip916 unexport
root@swi-mdm9x28-wp:~#
root@swi-mdm9x28-wp:~# echo out > /sys/class/gpio/gpio2/direction

root@swi-mdm9x28-wp:/tmp# echo 2 >> /sys/class/gpio/export
sh: write error: Device or resource busy
root@swi-mdm9x28-wp:/tmp# echo out > /sys/class/gpio/gpio2/direction
root@swi-mdm9x28-wp:/tmp# logread -f | grep gpio
Jan 24 18:25:57 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c app_Start() 3471 | Starting app ‘gpio’
Jan 24 18:25:57 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c CreateFileLink() 2084 | Skipping file link '/legato/systems/current/apps/gpio/read-only/lib/libComponent_gpioCompi
Jan 24 18:25:57 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c CreateFileLink() 2084 | Skipping file link ‘/legato/systems/current/apps/gpio/read-only/bin/gpio’ to '/legato/syss
Jan 24 18:25:57 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | proc.c proc_Start() 1403 | Starting process ‘gpio’ with pid 22220
Jan 24 18:25:57 swi-mdm9x28-wp user.info Legato: INFO | supervisor[22220]/supervisor T=main | proc.c proc_Start() 1363 | Execing ‘gpio’
Jan 24 18:25:57 swi-mdm9x28-wp user.debug Legato: DBUG | UNKNOWN[22220]/ T=main | _componentMain.c _gpioComponent_Init() 222 | Initializing gpioComponent component library.
Jan 24 18:25:57 swi-mdm9x28-wp user.info Legato: INFO | gpioService[1936]/sysfsGpio T=main | gpioSysfsUtils.c gpioSysfs_SessionOpenHandlerFunc() 1176 | Assigning GPIO 2
Jan 24 18:25:57 swi-mdm9x28-wp user.debug Legato: DBUG | UNKNOWN[22220]/framework T=main | le_gpioPin2_client.c DoConnectService() 242 | ======= Starting client for ‘gpio.gpioComponent.le_gpioPin2’ service =====

still stop in the same line

can you try GPIO13

Jan 24 18:39:25 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c app_Start() 3471 | Starting app ‘gpioCf3Demo’
Jan 24 18:39:25 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c CreateFileLink() 2154 | Created file link ‘/dev/log’ to '/legato/systems/current/appsWriteable/gpioCf3Demo/dev/lo.
Jan 24 18:39:25 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c CreateFileLink() 2154 | Created file link ‘/dev/null’ to '/legato/systems/current/appsWriteable/gpioCf3Demo/dev/n.
Jan 24 18:39:25 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c CreateFileLink() 2154 | Created file link ‘/dev/zero’ to '/legato/systems/current/appsWriteable/gpioCf3Demo/dev/z.
Jan 24 18:39:25 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c CreateFileLink() 2154 | Created file link ‘/dev/urandom’ to '/legato/systems/current/appsWriteable/gpioCf3Demo/de.
Jan 24 18:39:25 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c CreateFileLink() 2154 | Created file link ‘/legato/systems/current/lib/liblegato.so’ to '/legato/systems/current/.
Jan 24 18:39:25 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c CreateFileLink() 2154 | Created file link ‘/lib/ld-linux.so.3’ to '/legato/systems/current/appsWriteable/gpioCf3D.
Jan 24 18:39:25 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c CreateFileLink() 2154 | Created file link ‘/lib/libc.so.6’ to '/legato/systems/current/appsWriteable/gpioCf3Demo/.
Jan 24 18:39:25 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c CreateFileLink() 2154 | Created file link ‘/lib/libpthread.so.0’ to '/legato/systems/current/appsWriteable/gpioCf.
Jan 24 18:39:25 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c CreateFileLink() 2154 | Created file link ‘/lib/librt.so.1’ to '/legato/systems/current/appsWriteable/gpioCf3Demo.
Jan 24 18:39:25 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c CreateFileLink() 2154 | Created file link ‘/lib/libdl.so.2’ to '/legato/systems/current/appsWriteable/gpioCf3Demo.
Jan 24 18:39:25 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c CreateFileLink() 2154 | Created file link ‘/lib/libgcc_s.so.1’ to '/legato/systems/current/appsWriteable/gpioCf3D.
Jan 24 18:39:25 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c CreateFileLink() 2154 | Created file link ‘/lib/libm.so.6’ to '/legato/systems/current/appsWriteable/gpioCf3Demo/.
Jan 24 18:39:25 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c CreateFileLink() 2154 | Created file link ‘/usr/lib/libstdc++.so.6’ to '/legato/systems/current/appsWriteable/gpi.
Jan 24 18:39:25 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c CreateFileLink() 2154 | Created file link '/legato/systems/current/apps/gpioCf3Demo/read-only/lib/libComponent_gpe
Jan 24 18:39:25 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c CreateFileLink() 2154 | Created file link ‘/legato/systems/current/apps/gpioCf3Demo/read-only/bin/gpioCf3Demo’ to3
Jan 24 18:39:25 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c CreateTmpFs() 1788 | Mounted tmpfs at /legato/systems/current/appsWriteable/gpioCf3Demo/tmp.
Jan 24 18:39:25 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c CreateFileLink() 2154 | Created file link ‘/tmp/legato/serviceDirectoryServer’ to '/legato/systems/current/appsWr.
Jan 24 18:39:25 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c CreateFileLink() 2154 | Created file link ‘/tmp/legato/serviceDirectoryClient’ to '/legato/systems/current/appsWr.
Jan 24 18:39:25 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | proc.c proc_Start() 1403 | Starting process ‘gpioCf3Demo’ with pid 25539
Jan 24 18:39:25 swi-mdm9x28-wp user.info Legato: INFO | updateDaemon[1091]/updateDaemon T=main | app.c app_InstallIndividual() 830 | App gpioCf3Demo <2cc3eb8cdbbd40fc505e69a68ea900b9> installed
Jan 24 18:39:25 swi-mdm9x28-wp user.info Legato: INFO | updateDaemon[1091]/updateDaemon T=main | updateDaemon.c ApplyAppUpdate() 956 | App ‘gpioCf3Demo<2cc3eb8cdbbd40fc505e69a68ea900b9>’ installed properly.
Jan 24 18:39:25 swi-mdm9x28-wp user.info Legato: INFO | supervisor[25539]/supervisor T=main | proc.c proc_Start() 1363 | Execing ‘gpioCf3Demo’
Jan 24 18:39:25 swi-mdm9x28-wp user.err Legato: =ERR= | serviceDirectory[1088]/serviceDirectory T=main | serviceDirectory.c DispatchToServer() 734 | Client (uid 1046 ‘appgpioCf3Demo’, pid 25539) disagrees with sero
Jan 24 18:39:25 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | proc.c proc_SigChildHandler() 2079 | Process ‘gpioCf3Demo’ (PID: 25539) has exited with exit code 1.
Jan 24 18:39:25 swi-mdm9x28-wp user.warn Legato: -WRN- | supervisor[1077]/supervisor T=main | app.c app_SigChildHandler() 4066 | Process ‘gpioCf3Demo’ in app ‘gpioCf3Demo’ faulted: Ignored.
Jan 24 18:39:25 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c app_StopComplete() 4753 | app ‘gpioCf3Demo’ has stopped.
Jan 24 18:39:25 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | apps.c DeactivateAppContainer() 374 | Application ‘gpioCf3Demo’ has stopped.

seems you used wrong legato version to compile the app

Jan 24 18:39:25 swi-mdm9x28-wp user.err Legato: =ERR= | serviceDirectory[1088]/serviceDirectory T=main | serviceDirectory.c DispatchToServer() 734 | Client (uid 1046 ‘appgpioCf3Demo’, pid 25539) disagrees with sero

Jan 24 18:53:00 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c app_Start() 3471 | Starting app ‘gpioCf3Demo’
Jan 24 18:53:00 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c CreateFileLink() 2084 | Skipping file link ‘/dev/log’ to '/legato/systems/current/appsWriteable/gpioCf3Demo/dev/ls
Jan 24 18:53:00 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c CreateFileLink() 2084 | Skipping file link ‘/dev/null’ to '/legato/systems/current/appsWriteable/gpioCf3Demo/dev/s
Jan 24 18:53:00 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c CreateFileLink() 2084 | Skipping file link ‘/dev/zero’ to '/legato/systems/current/appsWriteable/gpioCf3Demo/dev/s
Jan 24 18:53:00 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c CreateFileLink() 2084 | Skipping file link ‘/dev/urandom’ to '/legato/systems/current/appsWriteable/gpioCf3Demo/ds
Jan 24 18:53:00 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c CreateFileLink() 2084 | Skipping file link ‘/legato/systems/current/lib/liblegato.so’ to '/legato/systems/currents
Jan 24 18:53:00 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c CreateFileLink() 2084 | Skipping file link ‘/lib/ld-linux.so.3’ to '/legato/systems/current/appsWriteable/gpioCf3s
Jan 24 18:53:00 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c CreateFileLink() 2084 | Skipping file link ‘/lib/libc.so.6’ to '/legato/systems/current/appsWriteable/gpioCf3Demos
Jan 24 18:53:00 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c CreateFileLink() 2084 | Skipping file link ‘/lib/libpthread.so.0’ to '/legato/systems/current/appsWriteable/gpioCs
Jan 24 18:53:00 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c CreateFileLink() 2084 | Skipping file link ‘/lib/librt.so.1’ to '/legato/systems/current/appsWriteable/gpioCf3Dems
Jan 24 18:53:00 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c CreateFileLink() 2084 | Skipping file link ‘/lib/libdl.so.2’ to '/legato/systems/current/appsWriteable/gpioCf3Dems
Jan 24 18:53:00 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c CreateFileLink() 2084 | Skipping file link ‘/lib/libgcc_s.so.1’ to '/legato/systems/current/appsWriteable/gpioCf3s
Jan 24 18:53:00 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c CreateFileLink() 2084 | Skipping file link ‘/lib/libm.so.6’ to '/legato/systems/current/appsWriteable/gpioCf3Demos
Jan 24 18:53:00 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c CreateFileLink() 2084 | Skipping file link ‘/usr/lib/libstdc++.so.6’ to '/legato/systems/current/appsWriteable/gps
Jan 24 18:53:00 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c CreateFileLink() 2084 | Skipping file link '/legato/systems/current/apps/gpioCf3Demo/read-only/lib/libComponent_gl
Jan 24 18:53:00 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c CreateFileLink() 2084 | Skipping file link ‘/legato/systems/current/apps/gpioCf3Demo/read-only/bin/gpioCf3Demo’ tf
Jan 24 18:53:00 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c CreateTmpFs() 1788 | Mounted tmpfs at /legato/systems/current/appsWriteable/gpioCf3Demo/tmp.
Jan 24 18:53:00 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c CreateFileLink() 2154 | Created file link ‘/tmp/legato/serviceDirectoryServer’ to '/legato/systems/current/appsWr.
Jan 24 18:53:00 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | app.c CreateFileLink() 2154 | Created file link ‘/tmp/legato/serviceDirectoryClient’ to '/legato/systems/current/appsWr.
Jan 24 18:53:00 swi-mdm9x28-wp user.info Legato: INFO | supervisor[1077]/supervisor T=main | proc.c proc_Start() 1403 | Starting process ‘gpioCf3Demo’ with pid 29115
Jan 24 18:53:00 swi-mdm9x28-wp user.info Legato: INFO | supervisor[29115]/supervisor T=main | proc.c proc_Start() 1363 | Execing ‘gpioCf3Demo’

it stop like this

it not GPIO pin2 problem it was gpio pin4 problem
it stop while connectservice to gpio pin 4
also same problem with pin6 and 13

I don’t see problem:

I have update legato version by using mangOH(leaf shell) and I can run pin13 now but pin4 and 6 still cannot run.

i have tried with your code too but i have the same error

you need to set +WIOCFG first for GPIO4 and GPIO6 (reset is needed after set them):

root@swi-mdm9x28-wp:~# microcom /dev/ttyAT
at+wiocfg?
+WIOCFG: 2,16,0,0,1,0,0
+WIOCFG: 4,16,0,0,1,0,0
+WIOCFG: 6,16,0,0,1,0,0
+WIOCFG: 7,16,0,0,1,0,0
+WIOCFG: 8,16,0,0,1,0,0
+WIOCFG: 13,16,0,0,1,0,0
+WIOCFG: 21,16,0,0,1,0,0
+WIOCFG: 22,16,0,0,1,0,0
+WIOCFG: 23,16,0,0,1,0,0
+WIOCFG: 24,16,0,0,1,0,0
+WIOCFG: 25,16,0,0,1,0,0
+WIOCFG: 28,16,0,0,1,0,0
+WIOCFG: 29,16,0,0,1,0,0
+WIOCFG: 30,16,0,0,1,0,0
+WIOCFG: 31,16,0,0,1,0,0
+WIOCFG: 32,16,0,0,1,0,0
+WIOCFG: 33,16,0,0,1,0,0
+WIOCFG: 35,16,0,0,1,0,0
+WIOCFG: 42,16,0,0,1,0,0

OK
root@swi-mdm9x28-wp:~# echo 4 > /sys/class/gpio/export
root@swi-mdm9x28-wp:~#
root@swi-mdm9x28-wp:~# echo 6 > /sys/class/gpio/export