# UART flow control with WP7608

**URL:** <https://forum.legato.io/t/uart-flow-control-with-wp7608/4597>\
**Category:** Uncategorized\
**Created:** [July 29, 2019, 8:57am UTC](https://forum.legato.io/t/uart-flow-control-with-wp7608/4597 "2019-07-29T08:57:04Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![tanoue](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@tanoue](https://forum.legato.io/u/tanoue)\
**Post date:** [July 29, 2019, 8:57am UTC](https://forum.legato.io/t/uart-flow-control-with-wp7608/4597/1 "2019-07-29T08:57:04Z")

</div>

I want to use UART hardware flow control with WP7608.  
How can I read RTS, CTS, DSR and DTR pin states.  
It means I want to check each pin is high or low.

---

<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:** [July 29, 2019, 2:25pm UTC](https://forum.legato.io/t/uart-flow-control-with-wp7608/4597/2 "2019-07-29T14:25:19Z")

</div>

You can give a try on this one:

> [@Controlling DCD, DTR, DSR lines by legato application](https://forum.legato.io/t/controlling-dcd-dtr-dsr-lines-by-legato-application/3944):
>
> Hello, It is possible to control the DCD, DTR and DSR from my legato application, so I can use them like GPIO? !RIOWNER can be used only for Ring Indicator.

---

<div class="post-metadata">

**Author:** ![tanoue](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@tanoue](https://forum.legato.io/u/tanoue)\
**Post date:** [August 7, 2019, 6:40am UTC](https://forum.legato.io/t/uart-flow-control-with-wp7608/4597/3 "2019-08-07T06:40:27Z")

</div>

Hi, jyijyi.  
Thank you for your replying.

I tried to add some new GPIO according to the page.

> {“101”,xx,FUNCTION\_EMBEDDED\_HOST},  
> {“102”,xx,FUNCTION\_EMBEDDED\_HOST},  
> {“103”,xx,FUNCTION\_EMBEDDED\_HOST},

However,I don’t know what number I write in the first argument and the second one for RS232C’s pins(DTR, DSR, DCD, RI).

Did the conversation on the page stop?

Could you give me some advices or samples?

BR,  
Tanoue

---

<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:** [August 7, 2019, 7:21am UTC](https://forum.legato.io/t/uart-flow-control-with-wp7608/4597/4 "2019-08-07T07:21:24Z")

</div>

There is answer here:

> [@Controlling DCD, DTR, DSR lines by legato application](https://forum.legato.io/t/controlling-dcd-dtr-dsr-lines-by-legato-application/3944/13):
>
> Hi AE\_1, Try: DCD = GPIO24 DTR = GPIO17 DSR = GPIO36 BR, Chris

---

<div class="post-metadata">

**Author:** ![tanoue](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@tanoue](https://forum.legato.io/u/tanoue)\
**Post date:** [August 7, 2019, 7:31am UTC](https://forum.legato.io/t/uart-flow-control-with-wp7608/4597/5 "2019-08-07T07:31:21Z")

</div>

Hi, jyijyi.  
Thank you for your rapid answering.

I recognized that the first arguments are these GPIO numbers.

I want to know more information about the second argument “xx”.

> And map those xx number to the MDM CHIP UART DCD/DTR/DSR.

Where are “xx” written like Datasheet?

BR,  
Tanoue

---

<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:** [August 7, 2019, 7:44am UTC](https://forum.legato.io/t/uart-flow-control-with-wp7608/4597/6 "2019-08-07T07:44:51Z")

</div>

I think you should modify like this:  
//DTR  
{“101”,17,FUNCTION\_EMBEDDED\_HOST},  
//DCD  
{“102”,24,FUNCTION\_EMBEDDED\_HOST},  
//DSR  
{“103”,36,FUNCTION\_EMBEDDED\_HOST},

after that you can control the pins by :

echo 101 \> /sys/class/gpio/export  
echo out \> /sys/class/gpio/gpio101/direction  
echo 1 \> /sys/class/gpio/gpio101/value  
echo 102 \> /sys/class/gpio/export  
echo out \> /sys/class/gpio/gpio102/direction  
echo 1 \> /sys/class/gpio/gpio102/value  
echo 103 \> /sys/class/gpio/export  
echo out \> /sys/class/gpio/gpio103/direction  
echo 1 \> /sys/class/gpio/gpio103/value

---

<div class="post-metadata">

**Author:** ![tanoue](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@tanoue](https://forum.legato.io/u/tanoue)\
**Post date:** [August 8, 2019, 4:20am UTC](https://forum.legato.io/t/uart-flow-control-with-wp7608/4597/7 "2019-08-08T04:20:35Z")

</div>

Hi, jyijyi.

I tried your suggestion.

I could see GPIO pins.

> /sys/class/gpio/gpio101/  
> /sys/class/gpio/gpio102/  
> /sys/class/gpio/gpio103/

But these pin’s value is changed, each signal state of output is not changed (always high).  
I checked each signal state by linemonitor.

> echo 1 \> /sys/class/gpio/gpio101/value  
> echo 0 \> /sys/class/gpio/gpio101/value

Do you have any idea?

BR,  
Tanoue

---

<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:** [August 8, 2019, 6:32am UTC](https://forum.legato.io/t/uart-flow-control-with-wp7608/4597/8 "2019-08-08T06:32:14Z")

</div>

I don’t see problem on R12 with attached yocto image.  
You can have a try.  
[https://drive.google.com/file/d/1yv3ohNyaj0jFPH3JsyjDZfUgBXPJlB2w/view?usp=sharing](https://drive.google.com/file/d/1yv3ohNyaj0jFPH3JsyjDZfUgBXPJlB2w/view?usp=sharing)

---

<div class="post-metadata">

**Author:** ![tanoue](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@tanoue](https://forum.legato.io/u/tanoue)\
**Post date:** [August 20, 2019, 8:49am UTC](https://forum.legato.io/t/uart-flow-control-with-wp7608/4597/9 "2019-08-20T08:49:55Z")

</div>

I tried it again with your yocto image.  
However, the result is not changed.

If I use Legato API, will it solve?

---

<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:** [August 20, 2019, 9:01am UTC](https://forum.legato.io/t/uart-flow-control-with-wp7608/4597/10 "2019-08-20T09:01:31Z")

</div>

Legato is on top of the yocto, if yocto not working, probably legato api will not work.  
As i don’t see problem on mangoh green board, have you double check if you are measuring the correct pins?

---

<div class="post-metadata">

**Author:** ![TAK\_G](https://avatars.discourse-cdn.com/v4/letter/t/82dd89/32.png) [@TAK\_G](https://forum.legato.io/u/TAK_G)\
**Post date:** [August 22, 2019, 12:06am UTC](https://forum.legato.io/t/uart-flow-control-with-wp7608/4597/11 "2019-08-22T00:06:22Z")

</div>

Hi Iyiyi,

I’m TAK and FAE in Japan.

Thanks for your support.  
I think it is better that you provide sample source code including definition files.

Could you share it ?

Thank you.

–TAK

---

<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:** [August 22, 2019, 2:21am UTC](https://forum.legato.io/t/uart-flow-control-with-wp7608/4597/12 "2019-08-22T02:21:13Z")

</div>

Please see my modification on yocto/kernel/driver/gpio/gpiolib.c.  
[gpiolib-sysfs.c](https://forum.legato.io/uploads/short-url/nyElRDOmod5pxTdUZS5SFw6h5mj.c) (36.7 KB)

---

<div class="post-metadata">

**Author:** ![TAK\_G](https://avatars.discourse-cdn.com/v4/letter/t/82dd89/32.png) [@TAK\_G](https://forum.legato.io/u/TAK_G)\
**Post date:** [August 22, 2019, 3:29am UTC](https://forum.legato.io/t/uart-flow-control-with-wp7608/4597/13 "2019-08-22T03:29:06Z")

</div>

Hi, Tanoue-san

Could you check it and please let me know your concerned exactly here.

Thank you.

—TAK

---

<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:** [August 22, 2019, 6:43am UTC](https://forum.legato.io/t/uart-flow-control-with-wp7608/4597/14 "2019-08-22T06:43:30Z")

</div>

BTW, have you ever tried to read those pin status by ioctl() function?

> **[How to read the CTS and DSR of RS232 in Unix using C language?](https://www.unix.com/programming/12235-how-read-cts-dsr-rs232-unix-using-c-language.html)**
>
> Hello to all Gurus out there, Could you show me a source code in Unix platform using C language. I want to read the status or voltage level of the DSR | The UNIX and Linux Forums

---

<div class="post-metadata">

**Author:** ![tanoue](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@tanoue](https://forum.legato.io/u/tanoue)\
**Post date:** [August 22, 2019, 7:13am UTC](https://forum.legato.io/t/uart-flow-control-with-wp7608/4597/15 "2019-08-22T07:13:46Z")

</div>

I tried it again with the provided sample.  
The result is not changed.

Then, I did not yet try a way by jyijyi.  
If you have some sample, could you provide it for early resolution?

---

<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:** [August 22, 2019, 7:51am UTC](https://forum.legato.io/t/uart-flow-control-with-wp7608/4597/16 "2019-08-22T07:51:36Z")

</div>

are you testing on MangOH green board to measure the DTS/DSR/DCD?

---

<div class="post-metadata">

**Author:** ![tanoue](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@tanoue](https://forum.legato.io/u/tanoue)\
**Post date:** [August 22, 2019, 8:23am UTC](https://forum.legato.io/t/uart-flow-control-with-wp7608/4597/17 "2019-08-22T08:23:18Z")

</div>

I’m testing WP7608 on my prototype board made by our company.

It looks no connection DTS/DSR/DCD (only TX/RX/CTS/RTS) on MangOH green board.

Do you know how to check to measure the DTS/DSR/DCD on MangOH green board?

---

<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:** [August 22, 2019, 8:34am UTC](https://forum.legato.io/t/uart-flow-control-with-wp7608/4597/18 "2019-08-22T08:34:18Z")

</div>

from schematic, the pin for (DTR/DCD/DSR) are on CN600 connector pin 11,13,15.

---

<div class="post-metadata">

**Author:** ![tanoue](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@tanoue](https://forum.legato.io/u/tanoue)\
**Post date:** [August 30, 2019, 7:00am UTC](https://forum.legato.io/t/uart-flow-control-with-wp7608/4597/19 "2019-08-30T07:00:55Z")

</div>

Thank you for new information.

I wrote a program and ran it with our board and MangOH green board  
However, both results are that the state of RS232C’s pins(DTR, DSR, DCD, RI) did not change.

When I ran same program with UbuntuPC, these pins changed.

Do you have any idea?

---

<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:** [August 30, 2019, 7:27am UTC](https://forum.legato.io/t/uart-flow-control-with-wp7608/4597/20 "2019-08-30T07:27:19Z")

</div>

Let’s focus on setting DTR pin in mangOH green board (CN600 connector pin 11) first with my yocto image.

Here I have tried the following:

* * *

root@swi-mdm9x28-wp:~# cm info  
Device: WP7609  
IMEI: 359782080100373  
IMEISV: 6  
FSN: WA803370311610  
Firmware Version: SWI9X07Y\_02.25.02.01 000000 jenkins 2019/01/30 08:13:05  
Bootloader Version: SWI9X07Y\_02.25.02.01 000000 jenkins 2019/01/30 08:13:05  
MCU Version:  
PRI Part Number (PN): 9908102  
PRI Revision: 001.000  
Carrier PRI Name: GENERIC  
Carrier PRI Revision: 002.056\_000  
SKU: 1103843  
Last Reset Cause: Power Down  
Resets Count: Expected: 10 Unexpected: 1  
root@swi-mdm9x28-wp:~# legato version  
18.10.3\_0b50331a9f4d0ecc0fd816c2a1300436  
root@swi-mdm9x28-wp:~# microcom /dev/ttyAT  
ati3  
Manufacturer: Sierra Wireless, Incorporated  
Model: WP7609  
Revision: SWI9X07Y\_02.25.02.01 000000 jenkins 2019/01/30 08:13:05  
IMEI: 359782080100373  
IMEI SV: 6  
FSN: WA803370311610  
+GCAP: +CGSM

OK  
ati8  
Legato Ver: 18.10.3\_0b50331a9f4d0ecc0fd816c2a1300436  
Yocto Ver: SWI9X07Y\_02.25.02.01 2019-08-08\_12:54:14  
OS Ver: Linux version 3.18.122 (owner@CNHKG-EX-001367) (gcc version 6.2.0 (GCC) ) #2 PREEMPT Thu Aug 8 12:56:18 HKT 2019  
LK Ver: SWI9X07Y\_02.25.02.01  
RootFS Ver: SWI9X07Y\_02.25.02.01 2019-08-08\_12:54:14  
UserFS Ver: unknown  
MCU Ver: unknown

OK  
root@swi-mdm9x28-wp:~# echo 101 \> /sys/class/gpio/export  
root@swi-mdm9x28-wp:~# echo out \> /sys/class/gpio/gpio101/direction  
root@swi-mdm9x28-wp:~# echo 1 \> /sys/class/gpio/gpio101/value  
root@swi-mdm9x28-wp:~# echo 0 \> /sys/class/gpio/gpio101/value

* * *

I measure DTR pin in mangOH green board (CN600 connector pin 11), the status will change.  
If you cannot make this work, probably there is hardware problem on your side.

[Next page](https://forum.legato.io/t/uart-flow-control-with-wp7608/4597.md?page=2)
