Hi everyone,
I am having an issue with my Legato application. When I attempt to add a GPIO change event handler, the program suddenly faults.
What Im doing:
I’m attempting to add a change event handler to GPIO Pin 35 via AddChangeEventHandler. An abbreviated version of my code is below:
static le_gpioPin35_ChangeEventHandlerRef_t gpio35Ref;
int PIN_35 = 35;
static void onStateChangeGpio35 (bool state, void *ctx) { ... }
gpio35Ref = le_gpioPin35_AddChangeEventHandler(LE_GPIOPIN35_EDGE_BOTH, onStateChangeGpio35, &PIN_35, 0);
I’ve bound 35 in my .adef
file via:
myApp.mainComponent.le_gpioPin35 -> gpioExpanderServiceRed.le_gpioPin35
…and required the API in my .cdef
file via:
le_gpioPin35 = le_gpio.api
What I’m experiencing:
Everything compiles and runs fine, until it gets to the line where the change event handler is added. When I call that function, the application faults, displaying the following in the log:
*EMR* | myApp@0[4701]/framework T=main | le_gpioPin35_client.c SessionCloseHandler() 424 | Component for le_gpioPin35 disconnected
INFO | supervisor[460]/supervisor T=main | proc.c proc_SigChildHandler() 1986 | Process 'myApp@0' (PID: 4701) has exited with exit code 1.
-WRN- | supervisor[460]/supervisor T=main | app.c app_SigChildHandler() 3355 | Process 'myApp@0' in app 'myApp' faulted: Ignored.
INFO | supervisor[460]/supervisor T=main | apps.c DeactivateAppContainer() 348 | Application 'myApp' has stopped.
It seems as though the application loses connection to the GPIO server, or something of the sort. Interestingly enough, I tried this same setup with Pin 22, and everything worked without any issue. Furthermore, I’ve tried polling Pin 35 with le_gpioPin35_Read()
and it detects state changes without issue; this only happens when I try to add the change event handler.
Is there perhaps something different about Pin 35, and something I need to do differently to handle it?
Thank you much in advance for any assistance.
Additional Information:
Board: MangOH Red
Device: WP8548
Device Firmware: SWI9X15Y_07.12.09.00
Legato Version: 16.10.3