Unable to export GPIOs

Hi,
we have a module where exporting GPIOs doesn’t work for most of the GPIOs:

root@swi-mdm9x28-wp:~# echo 42 > /sys/class/gpio/export
root@swi-mdm9x28-wp:~# echo 7 > /sys/class/gpio/export
sh: write error: Device or resource busy
root@swi-mdm9x28-wp:~# echo 8 > /sys/class/gpio/export
sh: write error: Device or resource busy
root@swi-mdm9x28-wp:~# echo 13 > /sys/class/gpio/export
sh: write error: Device or resource busy
root@swi-mdm9x28-wp:~# echo 41 > /sys/class/gpio/export
sh: write error: No such device

sylog:

[  290.354295] gpio_map_name_to_num: find GPIO 79
[  306.054822] gpio_map_name_to_num: find GPIO 16
[  306.054861] gpio-16 (sysfs): gpiod_request: status -16
[  306.054878] export_store: status -16
[  309.584440] gpio_map_name_to_num: find GPIO 58
[  309.584470] gpio-58 (sysfs): gpiod_request: status -16
[  309.584484] export_store: status -16
[  313.857413] gpio_map_name_to_num: find GPIO 76
[  313.857452] gpio-76 (sysfs): gpiod_request: status -16
[  313.857468] export_store: status -16
[  320.562841] gpio_map_name_to_num: find GPIO 204
[  320.562877] gpio-204 (?): gpiod_request: status -517
[  320.562894] export_store: status -19

On all other modules this worked without a problem.

WIOCFG:

AT+WIOCFG?

+WIOCFG: 2,16,0,0,1,0,0
+WIOCFG: 4,3,0,0,1,0,0
+WIOCFG: 6,0,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

What could cause this behavior?
Thx!

there is no GPIO41 in +WIOCFG, probably this is non-MCU module

“status -16” means device busy:
https://docs.huihoo.com/doxygen/linux/kernel/3.7/errno-base_8h.html

Is this module having the same FW as other OK modules?
Have you cleared all the running application to compare with other OK modules?

I also don’t have GPIO41 in WIOCFG in all the other modules and all of them are flashed with the same FW.
The module is completely new and was never flahed before (it still had the greeting message to setup a password etc. when logged in the first time)

Is there a AT command to check if this is a non-MCU modul?

you can use ati3 and ati8

Ok, the module in question is missing the MCU Version:

Legato Ver: 19.11.6_517283b1c06805b15fde8ea3713be0bc
Yocto Ver:  SWI9X07Y_02.37.07.00 2023-03-05_10:47:58
OS Ver: Linux version 3.18.140 (oe-user@oe-host) (gcc version 7.3.0 (GCC) ) #1 PREEMPT Sun Mar 5 10:34:52 UTC 2023
LK Ver: SWI9X07Y_02.18.07.01
RootFS Ver: SWI9X07Y_02.37.07.00 2023-03-05_10:47:58
UserFS Ver: unknown
MCU Ver: unknown

Is there any chance, that this is just a software problem?

ok, I saw this on rebooting:

[    0.498897] i2c-msm-v2 78b8000.i2c: BUS ERROR:noisy bus/unexpected start/stop tag: msgs(n:1 cur:0 tx) bc(rx:0 tx:2) mode:FIFO slv_addr:0x3a MSTR_STS:0x001121c4 OPER:0x00000080
[    0.522744] i2c-msm-v2 78b8000.i2c: error timeout on polling for valid state. check core_clk
[    0.522786] mci_protocol_frame_send: write frame fail to I2C: -5 of 2
[    0.522814] swimcu_ping: Failed to send PING
[    0.523777] i2c-msm-v2 78b8000.i2c: BUS ERROR:noisy bus/unexpected start/stop tag: msgs(n:2 cur:0 tx) bc(rx:2 tx:2) mode:FIFO slv_addr:0x1a MSTR_STS:0x001121c4 OPER:0x00000000
[    0.547481] i2c-msm-v2 78b8000.i2c: error timeout on polling for valid state. check core_clk
[    0.547529] wm8944 4-001a: Failed to read ID register
[    0.551407] msm_bus_fabric_init_driver

that doesn’t look good, but could it still be a software problem? or is there any other way to find out if this is a groub B module?

what is the return of ati3 and ati8?

ati3

Manufacturer: Sierra Wireless, Incorporated
Model: WP7607
Revision: SWI9X07Y_02.37.03.05 52ddef jenkins 2021/12/22 04:24:24
IMEI: 359779080853647
IMEI SV: 16
FSN: V3213631440810
+GCAP: +CGSM

OK
ati8
ati8

Legato Ver: 19.11.6_4cd59c60702757f129681d3c8ea86fd1
Yocto Ver:  SWI9X07Y_02.37.07.00 2023-03-05_10:47:58
OS Ver: Linux version 3.18.140 (oe-user@oe-host) (gcc version 7.3.0 (GCC) ) #1 PREEMPT Sun Mar 5 10:34:52 UTC 2023
LK Ver: SWI9X07Y_02.18.07.01
RootFS Ver: SWI9X07Y_02.37.07.00 2023-03-05_10:47:58
UserFS Ver: unknown
MCU Ver: unknown

OK

WP7607 should have mcu …

can you compare the LK ver in ati8 with other OK modules?

Also can you measure the I2C CLK and I2C data pin and see if it has differences when compared with OK modules?

So, while debugging with the HW-team, we found a problem on I2C.

Now everything is working!

Thanks for the help @jyijyi