# Script to set GPIO and UART within the AR7

**URL:** <https://forum.legato.io/t/script-to-set-gpio-and-uart-within-the-ar7/117>\
**Category:** Legato Application Framework\
**Created:** [March 25, 2015, 2:02pm UTC](https://forum.legato.io/t/script-to-set-gpio-and-uart-within-the-ar7/117 "2015-03-25T14:02:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![danielgomezdn](https://avatars.discourse-cdn.com/v4/letter/d/f9ae1b/32.png) [@danielgomezdn](https://forum.legato.io/u/danielgomezdn)\
**Post date:** [March 25, 2015, 2:02pm UTC](https://forum.legato.io/t/script-to-set-gpio-and-uart-within-the-ar7/117/1 "2015-03-25T14:02:51Z")

</div>

Hello,

I’m trying to do an script to configure some GPIOs and UART. In order to do that, I’ve created this script:

```auto
#!/bin/bash
echo "AT+WIOCFG=10,16" > /dev/smd8
echo "AT!MAPUART=17,1" > /dev/smd8
echo "AT!RESET" > /dev/smd8
echo "Finish"
```

The /dev/ttyAT driver configuration:

```auto
root@swi-mdm9x15:~# stty -F /dev/ttyAT -a
speed 38400 baud;stty: /dev/ttyAT
 line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon
-ixoff -iuclc -ixany -imaxbel -iutf8
-opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0
ff0
-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop
-echoprt -echoctl -echoke
```

Also, I’ve tried to configure the speed but it doesn’t work:

```auto
root@swi-mdm9x15:~# stty -F /dev/smd8 115200
stty: /dev/smd8: cannot perform all requested operations
```

What is the problem??

Thank you,

Daniel

---

<div class="post-metadata">

**Author:** ![lotam](https://avatars.discourse-cdn.com/v4/letter/l/958977/32.png) [@lotam](https://forum.legato.io/u/lotam)\
**Post date:** [March 27, 2015, 5:49am UTC](https://forum.legato.io/t/script-to-set-gpio-and-uart-within-the-ar7/117/2 "2015-03-27T05:49:46Z")

</div>

Hi Daniel,

How about below?

`#!/bin/sh
echo -en "AT+WIOCFG=10,16\r" > /dev/ttyAT
echo -en "AT!MAPUART=17,1\r" > /dev/ttyAT
echo -en "AT!RESET\r" > /dev/ttyAT
echo "Finish"`

Hope it helps.  
Thx

---

<div class="post-metadata">

**Author:** ![danielgomezdn](https://avatars.discourse-cdn.com/v4/letter/d/f9ae1b/32.png) [@danielgomezdn](https://forum.legato.io/u/danielgomezdn)\
**Post date:** [March 27, 2015, 10:08am UTC](https://forum.legato.io/t/script-to-set-gpio-and-uart-within-the-ar7/117/3 "2015-03-27T10:08:37Z")

</div>

Thanks lotam!!

It works! 🙂
