# \[WP760x\]\[SW\] How to control as GPIO in unused IF

**URL:** <https://forum.legato.io/t/wp760x-sw-how-to-control-as-gpio-in-unused-if/4874>\
**Category:** Legato Application Framework\
**Created:** [November 27, 2019, 1:09am UTC](https://forum.legato.io/t/wp760x-sw-how-to-control-as-gpio-in-unused-if/4874 "2019-11-27T01:09:01Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![HIROKI11976](https://avatars.discourse-cdn.com/v4/letter/h/a9adbd/32.png) [@HIROKI11976](https://forum.legato.io/u/HIROKI11976)\
**Post date:** [November 27, 2019, 1:09am UTC](https://forum.legato.io/t/wp760x-sw-how-to-control-as-gpio-in-unused-if/4874/1 "2019-11-27T01:09:01Z")

</div>

Back Ground:  
You recommend that unused IF can be used as GPIO function.

* * *

[Sierra Answer]  
If just one GPIO is missing, how about using the previous recommendation to control UART2 RTS/CTS pins just like what we suggest in the forum for UART1?  
i.e.

1. using linux generic API ioctl() to control UART2\_CTS which is stated as output pin in PTS.
2. using AT command “AT!entercnd=“A710”;!BSGPIO?14” to read the UART2\_RTS status which is stated as input pin in PTS.

* * *

We try to control as GPIO function in UART2 IF, but we don’t know the way how to set AT command/legato command to operate it.

Question:  
Could you tell me AT command and legato command how to set, in order to control as GPIO function in UART2 IF?

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [November 27, 2019, 1:21am UTC](https://forum.legato.io/t/wp760x-sw-how-to-control-as-gpio-in-unused-if/4874/2 "2019-11-27T01:21:23Z")

</div>

According to Product technical specification, this is not allowed to change UART2 as GPIO.

---

<div class="post-metadata">

**Author:** ![HIROKI11976](https://avatars.discourse-cdn.com/v4/letter/h/a9adbd/32.png) [@HIROKI11976](https://forum.legato.io/u/HIROKI11976)\
**Post date:** [November 29, 2019, 9:50am UTC](https://forum.legato.io/t/wp760x-sw-how-to-control-as-gpio-in-unused-if/4874/3 "2019-11-29T09:50:58Z")

</div>

Hi, jyijyi

First, according to the following SFDC, UART2 can be used as GPIO function if the customer did not use UART2 IF.  
And you recommend to operate AT command or ioctl() to fulfill it.

[https://partnercommunity.sierrawireless.com/s/case/5001M00001PFDQxQAP/00933578-wp7605hw-increase-gpio-function-instead-of-unused-ifs](https://partnercommunity.sierrawireless.com/s/case/5001M00001PFDQxQAP/00933578-wp7605hw-increase-gpio-function-instead-of-unused-ifs)

Is my understanding correct?

Currently, we are insufficient GPIO pin total 2, so could you tell me your advise to increase GPIO pin?

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [November 29, 2019, 9:55am UTC](https://forum.legato.io/t/wp760x-sw-how-to-control-as-gpio-in-unused-if/4874/4 "2019-11-29T09:55:41Z")

</div>

yes, you can use AT command or ioctl() to have one more input and one more output.

---

<div class="post-metadata">

**Author:** ![HIROKI11976](https://avatars.discourse-cdn.com/v4/letter/h/a9adbd/32.png) [@HIROKI11976](https://forum.legato.io/u/HIROKI11976)\
**Post date:** [November 29, 2019, 10:11am UTC](https://forum.legato.io/t/wp760x-sw-how-to-control-as-gpio-in-unused-if/4874/5 "2019-11-29T10:11:23Z")

</div>

> > yes, you can use AT command or ioctl() to have one more input and one more output.

“one more input and one more output” means that UART2 can be used to control the value via UART2\_RTS(Input) and UART2\_CTS(Output), like a GPIO?

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [November 29, 2019, 10:15am UTC](https://forum.legato.io/t/wp760x-sw-how-to-control-as-gpio-in-unused-if/4874/6 "2019-11-29T10:15:01Z")

</div>

Yes, you are correct.

---

<div class="post-metadata">

**Author:** ![HIROKI11976](https://avatars.discourse-cdn.com/v4/letter/h/a9adbd/32.png) [@HIROKI11976](https://forum.legato.io/u/HIROKI11976)\
**Post date:** [December 2, 2019, 12:30am UTC](https://forum.legato.io/t/wp760x-sw-how-to-control-as-gpio-in-unused-if/4874/7 "2019-12-02T00:30:41Z")

</div>

Make sense, so could you tell me command to control UART2\_RTS as general input and UART2\_CTS as general output?

UART2\_RTS:  
(1) AT!ENTERCND=“A710”  
(2) ??

UART2\_CTS:  
(1() ioctl()??

==\> I would like to know the parameter and sequence as above exactly.

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [December 2, 2019, 1:21am UTC](https://forum.legato.io/t/wp760x-sw-how-to-control-as-gpio-in-unused-if/4874/8 "2019-12-02T01:21:52Z")

</div>

UART2\_RTS:  
(1) AT!ENTERCND=“A710”  
(2) using AT command “AT!entercnd=“A710”;!BSGPIO?14” to read the UART2\_RTS status which is stated as input pin in PTS.

UART2\_CTS:  
Please see the example here which is using UART1:

> [@UART flow control with WP7608](https://forum.legato.io/t/uart-flow-control-with-wp7608/4597/51):
>
> Maybe you can run my sample application attached here. It will change the status of CTS every three seconds. It is working on my WP7608 FW R12.[UART\_Test1.rar](https://forum.legato.io/uploads/short-url/4AvEFawZzHvfUcT1URfB8G3VPHu.rar) (99.5 KB)

You just need to change the opened port to /dev/ttyHS1 for UART2 in Component.cdef and UART\_Test1.c line 240. ( of course you need to change UART2 to data mode by AT!MAPUART=17,2)
