Connecting to GPIO on WP7702

I’m trying to configure a single pin on the mangoh yellow Iot board to send a simple toggling signal (on/off type of thing). I’m having issues using the le_gpio api, it either hangs the app or crashes the process completely.

When it crashes, I get this error: user.emerg Legato: *EMR* | app@0[3097]/framework T=main | le_gpio_commonclient.c ifgen_le_gpio_SetPushPullOutput() 392 | Error receiving response from server

I’m trying to figure out:
a) Which api pins map to which physical Iot board pins?
b) Are there any specific calls that I need to make in order for it to function properly? Do I need to call le_gpio_ConnectService()? When should I call le_gpio_Activate()/Deactivate()?

You can try the app here

Thanks, @jyijyi. That app seems to work fine, but when I copy the necessary lines from the .adef, .cdef and .c files I get inconsistent behavior in my app. Sometimes the activation of the GPIO pin works, but in all cases it crashes my app. These are the log lines that I get, sometimes they are in different a different order, but they always seem to appear.

Apr 22 11:16:56 swi-mdm9x28-wp user.warn Legato: -WRN- | app@0[6910]/framework T=main | unixSocket.c unixSocket_SendMsg() 490 | sendmsg() failed with errno 32 (Broken pipe).
Apr 22 11:16:56 swi-mdm9x28-wp user.emerg Legato: *EMR* | app@0[6910]/framework T=main | le_gpio_commonclient.c ifgen_le_gpio_Activate() 895 | Error receiving response from server
Apr 22 11:16:56 swi-mdm9x28-wp user.info Legato:  INFO | dcsDaemon[1802]/dcsDaemon T=main | dcsServer.c CloseSessionEventHandler() 1329 | Client 0x7f5ae0c0 killed, remove allocated resources
Apr 22 11:16:56 swi-mdm9x28-wp user.info Legato:  INFO | supervisor[1130]/supervisor T=main | proc.c proc_SigChildHandler() 2079 | Process 'app@0' (PID: 6910) has exited with exit code 1.
Apr 22 11:16:56 swi-mdm9x28-wp user.info Legato:  INFO | app[6909]/CommandLine T=main | cmdLine.c GpioSignal() 877 | Pin21 read PP - High: 
Apr 22 11:16:56 swi-mdm9x28-wp user.warn Legato: -WRN- | supervisor[1130]/supervisor T=main | app.c app_SigChildHandler() 4066 | Process 'app@0' in app 'testApp' faulted: Ignored.
Apr 22 11:16:59 swi-mdm9x28-wp user.info Legato:  INFO | app[6909]/CommandLine T=main | cmdLine.c GpioSignal() 881 | Pin21 read PP - Low: 
Apr 22 11:16:59 swi-mdm9x28-wp user.info Legato:  INFO | dcsDaemon[1802]/dcsDaemon T=main | dcsServer.c CloseSessionEventHandler() 1329 | Client 0x7f5abf58 killed, remove allocated resources
Apr 22 11:16:59 swi-mdm9x28-wp user.info Legato:  INFO | gpioService[1830]/sysfsGpio T=main | gpioSysfsUtils.c gpioSysfs_SessionCloseHandlerFunc() 1215 | Releasing GPIO 13
Apr 22 11:16:59 swi-mdm9x28-wp user.info Legato:  INFO | supervisor[1130]/supervisor T=main | proc.c proc_SigChildHandler() 2079 | Process 'app' (PID: 6909) has exited with exit code 0.
Apr 22 11:16:59 swi-mdm9x28-wp user.info Legato:  INFO | supervisor[1130]/supervisor T=main | app.c app_StopComplete() 4753 | app 'testApp' has stopped.
Apr 22 11:16:59 swi-mdm9x28-wp user.info Legato:  INFO | supervisor[1130]/supervisor T=main | apps.c DeactivateAppContainer() 374 | Application 'testApp' has stopped.

Do you have any idea why this would happen? Also, it seems that the GPIO signal is actually using pin 25 in the Iot board…do you know why that is?

You can port your code to this sample app which already working fine.

pin 25 in the Iot board actually is connected to the GPIO13 of the module.

Ok, the issue is that I don’t want the implementation that is provided in the example app. I’m trying to make an app that the user inputs a CLI command and the app toggles the GPIO.

And, ok, is there a resource that shows which GPIOXX is connected to each pin? I’ve seen some mappings, but none of them map GPIO13 to pin 25, so maybe there’s an updated one?

You can set the application to be manually start in .adef.
And you can start the app by “app start” command.

BTW, you can check the schematic of mangoh red: