Script to set GPIO and UART within the AR7


#1

Hello,

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

#!/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:

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:

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

What is the problem??

Thank you,

Daniel


#2

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


#3

Thanks lotam!!

It works! :slight_smile: