gpioService gives error when using GPIO36, GPIO37 or GPIO38 on WP8548 and WP76

Hi,

I’ve built customer Legato systems for my WP8548 and WP76xx targets based upon Legato 18.04.
I get errors when my app uses GPIO36 or GPIO37 (as an output pin) or GPIO38 (as an input pin).
myApp.myComponent.OUTPUT1 → gpioService.le_gpioPin36
myApp.myComponent.OUTPUT2 → gpioService.le_gpioPin37
myApp.myComponent.INPUT1 → gpioService.le_gpioPin38

These errors are different for both targets.
WP8548:

  • “missing binding le_gpioPin36” at startup of myApp
  • “missing binding le_gpioPin37” at startup of myApp
  • no error for GPIO38

WP76xx:

  • gpioSysfsUtils.c WriteSysGpioSignalAttr() 175 | Failed to write out to GPIO config /sys/class/gpio/gpio36/direction. Error Operation not permitted
    gpioSysfsUtils.c gpioSysfs_Activate() 731 | Failed to set Direction on GPIO gpio36

  • gpioSysfsUtils.c WriteSysGpioSignalAttr() 175 | Failed to write out to GPIO config /sys/class/gpio/gpio37/direction. Error Operation not permitted
    gpioSysfsUtils.c gpioSysfs_Activate() 731 | Failed to set Direction on GPIO gpio37

  • gpioSysfsUtils.c ExportGpio() 106 | Failed to export GPIO 38. Error Operation not permitted
    gpioSysfsUtils.c gpioSysfs_SessionOpenHandlerFunc() 1112 | Unable to export GPIO gpio38 for use - stopping session
    gpioSysfsUtils.c WriteSysGpioSignalAttr() 175 | Failed to write in to GPIO config /sys/class/gpio/gpio38/direction. Error Operation not permitted
    ConfigureGpioInputPins() 85 | Couldn’t configure INPUT1 as default input high

When I run AT+WIOCFG? on both targets, I get different results:
WP8548:
afbeelding
WP76xx:
afbeelding

These screenshots tell me that I can’t use GPIO pins 36, 37 and 38 in my app.

To solve this, I use the command AT+WIOCFG on both targets, and this gives different results.
WP8548:
AT+WIOCFG=36,16,0,0,1,0,0 OK
AT+WIOCFG=37,16,0,0,1,0,0 OK
AT+WIOCFG=38,16,0,0,1,0,0 ERROR
==> myApp runs on WP8548

WP76xx:
AT+WIOCFG=36,16,0,0,1,0,0 ERROR
AT+WIOCFG=37,16,0,0,1,0,0 ERROR
AT+WIOCFG=38,16,0,0,1,0,0 ERROR
==> the errors are still there

According to the datasheets it should be possible to use GPIO36, GPIO37 and GPIO38 on WP76xx.
Any idea how I can fix this for WP76xx?

greetings,
annaertd

From PTS of WP76, GPIO 36 37 38 is accessible via sysfs/Legato only.

root@swi-mdm9x28:~# echo 36 > /sys/class/gpio/export

root@swi-mdm9x28:~# echo in > /sys/class/gpio/gpio36/direction

Based on this info, I did some extra tests on my WP76xx with Legato 18.04:

First, I executed following commands:
root@swi-mdm9x28:~# echo 36 > /sys/class/gpio/export
root@swi-mdm9x28:~# echo 37 > /sys/class/gpio/export
root@swi-mdm9x28:~# echo 38 > /sys/class/gpio/export
This resulted in subfolders gpio36, gpio37 and gpio38 in folder /sys/class/gpio/

AT+WIOCFG? still didn’t show entries for 36, 37 or 38

Secondly, I tried to configure via AT command:
AT+WIOCFG=36,16,0,0,1,0,0 ERROR
AT+WIOCFG=37,16,0,0,1,0,0 ERROR
AT+WIOCFG=38,16,0,0,1,0,0 ERROR

When I run my app, I still get the errors below:

gpioSysfsUtils.c WriteSysGpioSignalAttr() 175 | Failed to write out to GPIO config /sys/class/gpio/gpio36/direction. Error Operation not permitted
gpioSysfsUtils.c WriteSysGpioSignalAttr() 175 | Failed to write out to GPIO config /sys/class/gpio/gpio37/direction. Error Operation not permitted

gpioSysfsUtils.c WriteSysGpioSignalAttr() 175 | Failed to write in to GPIO config /sys/class/gpio/gpio38/direction. Error Operation not permitted

Documentation on the forum and in the specs always indicates that GPIO34…GPIO39 are accessible via sysfs/Legato only.
What does this mean in fact for my user application?
Why does everything run smoothly for GPIO35 although it is configured the same as GPIO36, GPIO37 and GPIO38?
I never get errors when I use GPIO35 via gpioService and AT+WIOCFG? returns by default WIOCFG: 35,16,0,0,1,0,0

Greetings,
annaert

As said before, these gpio are accessible via sysfs/Legato only.
I don’t think you can check by AT+WIOCFG command.

Can you try if you can control the GPIO output status in command line iike:
echo 0 > /sys/class/gpio/gpio36/value

I tried to control the output status in command line:
echo 0 > /sys/class/gpio/gpio36/value
echo 0 > /sys/class/gpio/gpio37/value
both resulted in:
sh: write error: Operation not permitted

GPIO35 is accessible via sysfs/Legato only, but, I can use it via gpioService without any problem.

Greetings,
annaertd

I don’t see problem with the following commands:


root@swi-mdm9x28:~# echo 36 > /sys/class/gpio/export
[76616.251978] i2c-msm-v2 78b8000.i2c: NACK: slave not responding, ensure its powered: msgs(n:1 cur:0 tx) bc(rx:0 tx:18) mode:FIFO slv_addr:0x3a MSTR_STS:0x0c1300c8 OPER:0x00000090
root@swi-mdm9x28:~#
root@swi-mdm9x28:~# echo out > /sys/class/gpio/gpio36/direction
[76617.252914] i2c-msm-v2 78b8000.i2c: NACK: slave not responding, ensure its powered: msgs(n:1 cur:0 tx) bc(rx:0 tx:18) mode:FIFO slv_addr:0x3a MSTR_STS:0x0c1300c8 OPER:0x00000090
root@swi-mdm9x28:~#
root@swi-mdm9x28:~# echo 0 > /sys/class/gpio/gpio36/value
[76624.645237] i2c-msm-v2 78b8000.i2c: NACK: slave not responding, ensure its powered: msgs(n:1 cur:0 tx) bc(rx:0 tx:18) mode:FIFO slv_addr:0x3a MSTR_STS:0x0c1300c8 OPER:0x00000090
root@swi-mdm9x28:~#
root@swi-mdm9x28:~# cm info
Device: WP7608
IMEI: 352913090100734
IMEISV: 4
FSN: XG805285330204
Firmware Version: SWI9X07Y_02.16.02.00 000000 jenkins 2018/04/19 19:59:02
Bootloader Version: SWI9X07Y_02.16.02.00 000000 jenkins 2018/04/19 19:59:02
[76679.035259] i2c-msm-v2 78b8000.i2c: NACK: slave not responding, ensure its powered: msgs(n:1 cur:0 tx) bc(rx:0 tx:2) mode:FIFO slv_addr:0x3a MSTR_STS:0x0c1300c8 OPER:0x00000090
MCU Version: 002.009
PRI Part Number (PN): 9907762
PRI Revision: 001.001
Carrier PRI Name: GENERIC
Carrier PRI Revision: 002.032_000
SKU: 1103788
Last Reset Cause: Reset, User Requested
Resets Count: Expected: 323 Unexpected: 25


I think the root cause of your problem is that you did not install the mangoH red update image.
You can have a look here: