# UART

Source: [https://docs.qualcomm.com/doc/80-70018-8/topic/uart.html](https://docs.qualcomm.com/doc/80-70018-8/topic/uart.html)

UART devices transmit data asynchronously. Hence, a clock signal doesn't synchronize the
            output of bits from the transmitting UART to the sampling of bits by the receiving UART.
            Instead of a clock signal, the transmitting UART adds start and stop bits to the data
            packet being transferred. These bits define the beginning and end of the data packet, so
            the receiving UART knows when to start reading the bits. When the receiving UART detects
            a start bit, it starts to read the incoming bits at a specific frequency known as the
            baud rate.

Figure : Data transfer between two UART devices
            
            <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by Microsoft Visio, SVG Export uart-data-transfer.svg Page-1 -->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:v="http://schemas.microsoft.com/visio/2003/SVGExtensions/" width="5.64589in" height="4.0752in" viewbox="0 0 406.504 293.414" xml:space="preserve" color-interpolation-filters="sRGB" class="st13" aria-label="Image illustrates data transfer between two UART devices."><v:documentproperties v:langid="1033" v:metric="true" v:viewmarkup="false">	<v:userdefs>		<v:ud v:nameu="msvNoAutoConnect" v:val="VT0(1):26"></v:ud>	</v:userdefs></v:documentproperties>
<style>.svg-1 .st1 { fill: #ffffff; stroke: none; stroke-linecap: round; stroke-linejoin: round; stroke-width: 0.75 }
.svg-1 .st2 { fill: #ffffff; stroke: #3253dc; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1 }
.svg-1 .st3 { fill: none; stroke: none; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1 }
.svg-1 .st4 { fill: #000000; font-family: Arial; font-size: 1.16666em; font-weight: bold }
.svg-1 .st5 { fill: #ffffff; stroke: #000000; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1 }
.svg-1 .st6 { fill: #000000; font-family: Arial; font-size: 1.00001em }
.svg-1 .st7 { stroke: #000000; stroke-linecap: butt; stroke-width: 2.21102 }
.svg-1 .st8 { fill: #000000 }
.svg-1 .st9 { stroke: none; stroke-linecap: butt; stroke-width: 1; visibility: hidden }
.svg-1 .st10 { stroke: #000000; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1 }
.svg-1 .st11 { marker-end: url("#mrkr13-92"); stroke: #000000; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1 }
.svg-1 .st12 { fill: #000000; fill-opacity: 1; stroke: #000000; stroke-opacity: 1; stroke-width: 0.28409090909091 }
.svg-1 .st13 { fill: none; fill-rule: evenodd; font-size: 12px; overflow: visible; stroke-linecap: square; stroke-miterlimit: 3 }</style>
<defs id="Markers">	<g id="lend13">		<path d="M 3 1 L 0 0 L 3 -1 L 3 1 " style="stroke:none"></path>	</g>	<marker id="mrkr13-92" class="st12" v:arrowtype="13" v:arrowsize="2" v:setback="10.56" refx="-10.56" orient="auto" markerunits="strokeWidth" overflow="visible">		<use xlink:href="#lend13" transform="scale(-3.52,-3.52) "></use>	</marker></defs><g v:mid="4" v:index="1" v:groupcontext="backgroundPage">	<v:userdefs>		<v:ud v:nameu="msvVisioCreated" v:prompt="" v:val="VT0(0):26"></v:ud>	</v:userdefs>	<title>VBackground-1</title>	<v:pageproperties width="5.64589" height="4.0752" v:drawingscale="0.0393701" v:pagescale="0.0393701" v:drawingunits="24" v:shadowoffsetx="8.50394" v:shadowoffsety="-8.50394"></v:pageproperties>	<g id="shape7-1" v:mid="7" v:groupcontext="shape">		<title>Solid</title>		<v:userdefs>			<v:ud v:nameu="Background" v:val="VT0(0):26"></v:ud>			<v:ud v:nameu="visVersion" v:val="VT0(15):26"></v:ud>			<v:ud v:nameu="msvShapeCategories" v:prompt="" v:val="VT4(DoNotContain)"></v:ud>			<v:ud v:nameu="msvVisioCreated" v:prompt="" v:val="VT0(0):26"></v:ud>		</v:userdefs>		<rect x="0" y="0" width="406.504" height="293.414" class="st1"></rect>	</g></g><g v:mid="0" v:index="2" v:groupcontext="foregroundPage">	<v:userdefs>		<v:ud v:nameu="GroundCount" v:prompt="" v:val="VT0(3):26"></v:ud>	</v:userdefs>	<title>Page-1</title>	<v:pageproperties v:drawingscale="0.0393701" v:pagescale="0.0393701" v:drawingunits="24" v:shadowoffsetx="8.50394" v:shadowoffsety="-8.50394"></v:pageproperties>	<v:layer v:name="Electrical" v:index="0"></v:layer>	<v:layer v:name="Connector" v:index="1"></v:layer>	<g id="shape2-3" v:mid="2" v:groupcontext="shape" transform="translate(19,-47.6427)">		<title>Rectangle</title>		<v:userdefs>			<v:ud v:nameu="visVersion" v:val="VT0(15):26"></v:ud>		</v:userdefs>		<rect x="0" y="66.6427" width="113.386" height="226.772" class="st2"></rect>	</g>	<g id="shape3-5" v:mid="3" v:groupcontext="shape" transform="translate(274.118,-47.6427)">		<title>Rectangle.3</title>		<v:userdefs>			<v:ud v:nameu="visVersion" v:val="VT0(15):26"></v:ud>		</v:userdefs>		<rect x="0" y="66.6427" width="113.386" height="226.772" class="st2"></rect>	</g>	<g id="shape6-7" v:mid="6" v:groupcontext="shape" transform="translate(19,-168.661)">		<title>Sheet.6</title>		<desc>Device A</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="38.9764" cy="278.532" width="77.96" height="29.7638"></v:textrect>		<rect x="0" y="263.651" width="77.9528" height="29.7638" class="st3"></rect>		<text x="9.4" y="282.73" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>Device A</text>		</g>	<g id="shape7-10" v:mid="7" v:groupcontext="shape" transform="translate(309.551,-168.661)">		<title>Sheet.7</title>		<desc>Device B</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="38.9764" cy="278.532" width="77.96" height="29.7638"></v:textrect>		<rect x="0" y="263.651" width="77.9528" height="29.7638" class="st3"></rect>		<text x="9.4" y="282.73" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>Device B</text>		</g>	<g id="shape8-13" v:mid="8" v:groupcontext="shape" transform="translate(125.593,-154.236)">		<title>Square</title>		<v:userdefs>			<v:ud v:nameu="visVersion" v:val="VT0(15):26"></v:ud>		</v:userdefs>		<rect x="0" y="279.829" width="13.5856" height="13.5856" class="st5"></rect>	</g>	<g id="shape9-15" v:mid="9" v:groupcontext="shape" transform="translate(267.325,-154.236)">		<title>Square.9</title>		<v:userdefs>			<v:ud v:nameu="visVersion" v:val="VT0(15):26"></v:ud>		</v:userdefs>		<rect x="0" y="279.829" width="13.5856" height="13.5856" class="st5"></rect>	</g>	<g id="shape10-17" v:mid="10" v:groupcontext="shape" transform="translate(125.593,-239.275)">		<title>Square.10</title>		<v:userdefs>			<v:ud v:nameu="visVersion" v:val="VT0(15):26"></v:ud>		</v:userdefs>		<rect x="0" y="279.829" width="13.5856" height="13.5856" class="st5"></rect>	</g>	<g id="shape11-19" v:mid="11" v:groupcontext="shape" transform="translate(125.593,-196.755)">		<title>Square.11</title>		<v:userdefs>			<v:ud v:nameu="visVersion" v:val="VT0(15):26"></v:ud>		</v:userdefs>		<rect x="0" y="279.829" width="13.5856" height="13.5856" class="st5"></rect>	</g>	<g id="shape12-21" v:mid="12" v:groupcontext="shape" transform="translate(125.593,-111.716)">		<title>Square.12</title>		<v:userdefs>			<v:ud v:nameu="visVersion" v:val="VT0(15):26"></v:ud>		</v:userdefs>		<rect x="0" y="279.829" width="13.5856" height="13.5856" class="st5"></rect>	</g>	<g id="shape13-23" v:mid="13" v:groupcontext="shape" transform="translate(125.593,-69.1964)">		<title>Square.13</title>		<v:userdefs>			<v:ud v:nameu="visVersion" v:val="VT0(15):26"></v:ud>		</v:userdefs>		<rect x="0" y="279.829" width="13.5856" height="13.5856" class="st5"></rect>	</g>	<g id="shape14-25" v:mid="14" v:groupcontext="shape" transform="translate(267.325,-69.1964)">		<title>Square.14</title>		<v:userdefs>			<v:ud v:nameu="visVersion" v:val="VT0(15):26"></v:ud>		</v:userdefs>		<rect x="0" y="279.829" width="13.5856" height="13.5856" class="st5"></rect>	</g>	<g id="shape15-27" v:mid="15" v:groupcontext="shape" transform="translate(267.325,-111.716)">		<title>Square.15</title>		<v:userdefs>			<v:ud v:nameu="visVersion" v:val="VT0(15):26"></v:ud>		</v:userdefs>		<rect x="0" y="279.829" width="13.5856" height="13.5856" class="st5"></rect>	</g>	<g id="shape16-29" v:mid="16" v:groupcontext="shape" transform="translate(267.325,-196.755)">		<title>Square.16</title>		<v:userdefs>			<v:ud v:nameu="visVersion" v:val="VT0(15):26"></v:ud>		</v:userdefs>		<rect x="0" y="279.829" width="13.5856" height="13.5856" class="st5"></rect>	</g>	<g id="shape17-31" v:mid="17" v:groupcontext="shape" transform="translate(267.325,-239.275)">		<title>Square.17</title>		<v:userdefs>			<v:ud v:nameu="visVersion" v:val="VT0(15):26"></v:ud>		</v:userdefs>		<rect x="0" y="279.829" width="13.5856" height="13.5856" class="st5"></rect>	</g>	<g id="shape18-33" v:mid="18" v:groupcontext="shape" transform="translate(282.622,-237.564)">		<title>Sheet.18</title>		<desc>Tx</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="24.0945" cy="285.619" width="48.19" height="15.5906"></v:textrect>		<rect x="0" y="277.824" width="48.189" height="15.5906" class="st3"></rect>		<text x="4" y="289.22" class="st6" v:langid="1033"><v:paragraph></v:paragraph><v:tablist></v:tablist>Tx</text>		</g>	<g id="shape19-36" v:mid="19" v:groupcontext="shape" transform="translate(282.622,-195.753)">		<title>Sheet.19</title>		<desc>Rx</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="24.0945" cy="285.619" width="48.19" height="15.5906"></v:textrect>		<rect x="0" y="277.824" width="48.189" height="15.5906" class="st3"></rect>		<text x="4" y="289.22" class="st6" v:langid="1033"><v:paragraph></v:paragraph><v:tablist></v:tablist>Rx</text>		</g>	<g id="shape20-39" v:mid="20" v:groupcontext="shape" transform="translate(282.622,-153.233)">		<title>Sheet.20</title>		<desc>CTS</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="24.0945" cy="285.619" width="48.19" height="15.5906"></v:textrect>		<rect x="0" y="277.824" width="48.189" height="15.5906" class="st3"></rect>		<text x="4" y="289.22" class="st6" v:langid="1033"><v:paragraph></v:paragraph><v:tablist></v:tablist>CTS</text>		</g>	<g id="shape21-42" v:mid="21" v:groupcontext="shape" transform="translate(282.622,-110.714)">		<title>Sheet.21</title>		<desc>RTS</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="24.0945" cy="285.619" width="48.19" height="15.5906"></v:textrect>		<rect x="0" y="277.824" width="48.189" height="15.5906" class="st3"></rect>		<text x="4" y="289.22" class="st6" v:langid="1033"><v:paragraph></v:paragraph><v:tablist></v:tablist>RTS</text>		</g>	<g id="shape22-45" v:mid="22" v:groupcontext="shape" transform="translate(282.622,-68.1939)">		<title>Sheet.22</title>		<desc>GND</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="24.0945" cy="285.619" width="48.19" height="15.5906"></v:textrect>		<rect x="0" y="277.824" width="48.189" height="15.5906" class="st3"></rect>		<text x="4" y="289.22" class="st6" v:langid="1033"><v:paragraph></v:paragraph><v:tablist></v:tablist>GND</text>		</g>	<g id="shape23-48" v:mid="23" v:groupcontext="shape" transform="translate(75.6929,-68.1939)">		<title>Sheet.23</title>		<desc>GND</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="24.0945" cy="285.619" width="48.19" height="15.5906"></v:textrect>		<rect x="0" y="277.824" width="48.189" height="15.5906" class="st3"></rect>		<text x="17.52" y="289.22" class="st6" v:langid="1033"><v:paragraph v:horizalign="2"></v:paragraph><v:tablist></v:tablist>GND</text>		</g>	<g id="shape24-51" v:mid="24" v:groupcontext="shape" transform="translate(75.6929,-110.714)">		<title>Sheet.24</title>		<desc>RTS</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="24.0945" cy="285.619" width="48.19" height="15.5906"></v:textrect>		<rect x="0" y="277.824" width="48.189" height="15.5906" class="st3"></rect>		<text x="20.19" y="289.22" class="st6" v:langid="1033"><v:paragraph v:horizalign="2"></v:paragraph><v:tablist></v:tablist>RTS</text>		</g>	<g id="shape25-54" v:mid="25" v:groupcontext="shape" transform="translate(75.6929,-195.753)">		<title>Sheet.25</title>		<desc>Rx</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="24.0945" cy="285.619" width="48.19" height="15.5906"></v:textrect>		<rect x="0" y="277.824" width="48.189" height="15.5906" class="st3"></rect>		<text x="29.52" y="289.22" class="st6" v:langid="1033"><v:paragraph v:horizalign="2"></v:paragraph><v:tablist></v:tablist>Rx</text>		</g>	<g id="shape26-57" v:mid="26" v:groupcontext="shape" transform="translate(75.6929,-153.233)">		<title>Sheet.26</title>		<desc>CTS</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="24.0945" cy="285.619" width="48.19" height="15.5906"></v:textrect>		<rect x="0" y="277.824" width="48.189" height="15.5906" class="st3"></rect>		<text x="20.19" y="289.22" class="st6" v:langid="1033"><v:paragraph v:horizalign="2"></v:paragraph><v:tablist></v:tablist>CTS</text>		</g>	<g id="shape27-60" v:mid="27" v:groupcontext="shape" transform="translate(75.6929,-238.273)">		<title>Sheet.27</title>		<desc>Tx</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="24.0945" cy="285.619" width="48.19" height="15.5906"></v:textrect>		<rect x="0" y="277.824" width="48.189" height="15.5906" class="st3"></rect>		<text x="30.86" y="289.22" class="st6" v:langid="1033"><v:paragraph v:horizalign="2"></v:paragraph><v:tablist></v:tablist>Tx</text>		</g>	<g id="group28-63" transform="translate(140.89,-19.2963)" v:mid="28" v:groupcontext="group" v:layermember="0">		<v:custprops>			<v:cp v:nameu="Label" v:lbl="Label" v:prompt="" v:type="0" v:format="@" v:sortkey="" v:invis="false" v:ask="false" v:langid="1033" v:cal="0" v:val="VT4()"></v:cp>		</v:custprops>		<v:userdefs>			<v:ud v:nameu="visVersion" v:val="VT0(15):26"></v:ud>			<v:ud v:nameu="visDescription" v:val="VT4(Represents a ground connection.)"></v:ud>			<v:ud v:nameu="Label" v:prompt="" v:val="VT4()"></v:ud>			<v:ud v:nameu="SolSH" v:prompt="" v:val="VT4({2EE3C7D2-E26E-4B72-9E9C-5170DDBF261A})"></v:ud>			<v:ud v:nameu="Label" v:prompt="" v:val="VT4(GND1)"></v:ud>		</v:userdefs>		<title>Ground</title>		<g id="shape29-64" v:mid="29" v:groupcontext="shape" v:layermember="0" transform="translate(8.51982,-0.914748)">			<title>Sheet.29</title>			<path d="M12.74 293.41 L7.08 293.41" class="st7"></path>			<path d="M16.98 288.95 L2.83 288.95" class="st7"></path>			<path d="M19.81 284.54 L-0 284.54" class="st7"></path>		</g>		<g id="shape30-69" v:mid="30" v:groupcontext="shape" v:layermember="0" transform="translate(17.6882,-10.6866)">			<title>Sheet.30</title>			<rect x="0" y="267.251" width="1.47402" height="26.1638" class="st8"></rect>			<rect x="0" y="267.251" width="1.47402" height="26.1638" class="st9"></rect>		</g>	</g>	<g id="group31-72" transform="translate(237.268,-19.2963)" v:mid="31" v:groupcontext="group" v:layermember="0">		<v:custprops>			<v:cp v:nameu="Label" v:lbl="Label" v:prompt="" v:type="0" v:format="@" v:sortkey="" v:invis="false" v:ask="false" v:langid="1033" v:cal="0" v:val="VT4()"></v:cp>		</v:custprops>		<v:userdefs>			<v:ud v:nameu="visVersion" v:val="VT0(15):26"></v:ud>			<v:ud v:nameu="visDescription" v:val="VT4(Represents a ground connection.)"></v:ud>			<v:ud v:nameu="Label" v:prompt="" v:val="VT4()"></v:ud>			<v:ud v:nameu="SolSH" v:prompt="" v:val="VT4({2EE3C7D2-E26E-4B72-9E9C-5170DDBF261A})"></v:ud>			<v:ud v:nameu="Label" v:prompt="" v:val="VT4(GND2)"></v:ud>		</v:userdefs>		<title>Ground.31</title>		<g id="shape32-73" v:mid="32" v:groupcontext="shape" v:layermember="0" transform="translate(8.51982,-0.914748)">			<title>Sheet.32</title>			<path d="M12.74 293.41 L7.08 293.41" class="st7"></path>			<path d="M16.98 288.95 L2.83 288.95" class="st7"></path>			<path d="M19.81 284.54 L-0 284.54" class="st7"></path>		</g>		<g id="shape33-78" v:mid="33" v:groupcontext="shape" v:layermember="0" transform="translate(17.6882,-10.6866)">			<title>Sheet.33</title>			<rect x="0" y="267.251" width="1.47402" height="26.1638" class="st8"></rect>			<rect x="0" y="267.251" width="1.47402" height="26.1638" class="st9"></rect>		</g>	</g>	<g id="shape35-81" v:mid="35" v:groupcontext="shape" v:layermember="1" transform="translate(268.596,-75.9891)">		<title>Dynamic connector.35</title>		<path d="M-1.27 293.41 L-12.9 293.41 L-12.9 313.26" class="st10"></path>	</g>	<g id="shape36-84" v:mid="36" v:groupcontext="shape" v:layermember="1" transform="translate(139.179,-75.9891)">		<title>Dynamic connector</title>		<path d="M0 293.41 L20.14 293.41 L20.14 313.26" class="st10"></path>	</g>	<g id="shape39-87" v:mid="39" v:groupcontext="shape" transform="translate(231.581,-231.138) rotate(18.3561)">		<title>Sheet.39</title>		<path d="M0 293.41 L124.46 293.41" class="st11"></path>	</g>	<g id="shape40-93" v:mid="40" v:groupcontext="shape" transform="translate(359.728,325.831) rotate(161.644)">		<title>Sheet.40</title>		<path d="M0 293.41 L124.46 293.41" class="st11"></path>	</g>	<g id="shape41-98" v:mid="41" v:groupcontext="shape" transform="translate(174.923,453.39) rotate(-161.644)">		<title>Sheet.41</title>		<path d="M0 293.41 L124.46 293.41" class="st11"></path>	</g>	<g id="shape42-103" v:mid="42" v:groupcontext="shape" transform="translate(46.776,-103.579) rotate(-18.3561)">		<title>Sheet.42</title>		<path d="M0 293.41 L124.46 293.41" class="st11"></path>	</g></g>
</svg>

The parameters that determine successful transmission are as follows:
- Baud rate
- Start bit
- Stop bit
- Parity bit
- Data bits
- Flow control

The following figure shows a sample UART data packet.
Figure : UART data packet
                
                <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by Microsoft Visio, SVG Export uart-data-packet.svg Page-1 -->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:v="http://schemas.microsoft.com/visio/2003/SVGExtensions/" width="8.08333in" height="3.62188in" viewbox="0 0 582 260.776" xml:space="preserve" color-interpolation-filters="sRGB" class="st7"><v:documentproperties v:langid="1033" v:viewmarkup="false">	<v:userdefs>		<v:ud v:nameu="msvNoAutoConnect" v:val="VT0(1):26"></v:ud>	</v:userdefs></v:documentproperties>
<style>.svg-2 .st1 { fill: #ffffff; stroke: none; stroke-linecap: round; stroke-linejoin: round; stroke-width: 0.75 }
.svg-2 .st2 { fill: #ffffff; stroke: #3253dc; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1 }
.svg-2 .st3 { fill: #000000; font-family: Arial; font-size: 1.00001em }
.svg-2 .st4 { font-size: 1em }
.svg-2 .st5 { stroke: #000000; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1 }
.svg-2 .st6 { fill: none; stroke: none; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1 }
.svg-2 .st7 { fill: none; fill-rule: evenodd; font-size: 12px; overflow: visible; stroke-linecap: square; stroke-miterlimit: 3 }</style>
<g v:mid="4" v:index="1" v:groupcontext="backgroundPage">	<v:userdefs>		<v:ud v:nameu="msvVisioCreated" v:prompt="" v:val="VT0(0):26"></v:ud>	</v:userdefs>	<title>VBackground-1</title>	<v:pageproperties width="8.08333" height="3.62188" v:drawingscale="1" v:pagescale="1" v:drawingunits="19" v:shadowoffsetx="9" v:shadowoffsety="-9"></v:pageproperties>	<g id="shape2-1" v:mid="2" v:groupcontext="shape">		<title>Solid</title>		<v:userdefs>			<v:ud v:nameu="Background" v:val="VT0(0):26"></v:ud>			<v:ud v:nameu="visVersion" v:val="VT0(15):26"></v:ud>			<v:ud v:nameu="msvShapeCategories" v:prompt="" v:val="VT4(DoNotContain)"></v:ud>			<v:ud v:nameu="msvVisioCreated" v:prompt="" v:val="VT0(0):26"></v:ud>		</v:userdefs>		<rect x="0" y="0" width="582" height="260.776" class="st1"></rect>	</g></g><g v:mid="0" v:index="2" v:groupcontext="foregroundPage">	<title>Page-1</title>	<v:pageproperties v:drawingscale="1" v:pagescale="1" v:drawingunits="19" v:shadowoffsetx="9" v:shadowoffsety="-9"></v:pageproperties>	<g id="shape1-3" v:mid="1" v:groupcontext="shape" transform="translate(18.5,-109.295)">		<title>Rectangle</title>		<desc>1 start bit</desc>		<v:userdefs>			<v:ud v:nameu="visVersion" v:val="VT0(15):26"></v:ud>		</v:userdefs>		<v:textblock v:margins="rect(4,4,4,4)"></v:textblock>		<v:textrect cx="34.9359" cy="242.539" width="69.88" height="36.4731"></v:textrect>		<rect x="0" y="224.302" width="69.8718" height="36.4731" class="st2"></rect>		<text x="10.26" y="246.14" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>1 start bit</text>		</g>	<g id="shape2-6" v:mid="2" v:groupcontext="shape" transform="translate(88.3718,-109.295)">		<title>Rectangle.2</title>		<desc>5 to 9 data bits</desc>		<v:userdefs>			<v:ud v:nameu="visVersion" v:val="VT0(15):26"></v:ud>		</v:userdefs>		<v:textblock v:margins="rect(4,4,4,4)"></v:textblock>		<v:textrect cx="153.718" cy="242.539" width="307.44" height="36.4731"></v:textrect>		<rect x="0" y="224.302" width="307.436" height="36.4731" class="st2"></rect>		<text x="114.36" y="246.14" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>5 to 9 data bits</text>		</g>	<g id="shape3-9" v:mid="3" v:groupcontext="shape" transform="translate(395.808,-109.295)">		<title>Rectangle.3</title>		<desc>0 to 1 parity bits</desc>		<v:userdefs>			<v:ud v:nameu="visVersion" v:val="VT0(15):26"></v:ud>		</v:userdefs>		<v:textblock v:margins="rect(4,4,4,4)"></v:textblock>		<v:textrect cx="41.9231" cy="242.539" width="83.85" height="36.4731"></v:textrect>		<rect x="0" y="224.302" width="83.8462" height="36.4731" class="st2"></rect>		<text x="10.57" y="238.94" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>0 to 1 parity <tspan x="32.59" dy="1.2em" class="st4">bits</tspan></text>		</g>	<g id="shape4-13" v:mid="4" v:groupcontext="shape" transform="translate(479.654,-109.295)">		<title>Rectangle.4</title>		<desc>1 to 2 stop bits</desc>		<v:userdefs>			<v:ud v:nameu="visVersion" v:val="VT0(15):26"></v:ud>		</v:userdefs>		<v:textblock v:margins="rect(4,4,4,4)"></v:textblock>		<v:textrect cx="41.9231" cy="242.539" width="83.85" height="36.4731"></v:textrect>		<rect x="0" y="224.302" width="83.8462" height="36.4731" class="st2"></rect>		<text x="13.9" y="238.94" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>1 to 2 stop <tspan x="32.59" dy="1.2em" class="st4">bits</tspan></text>		</g>	<g id="shape8-17" v:mid="8" v:groupcontext="shape" transform="translate(281.763,41.2797) rotate(90)">		<title>Left Brace</title>		<v:userdefs>			<v:ud v:nameu="visVersion" v:prompt="" v:val="VT0(15):26"></v:ud>		</v:userdefs>		<path d="M64.3 260.78 A86.0818 90.7894 0 0 1 32.15 206.52 L32.15 -10.48 L0 -10.48 L32.15 -10.48 L32.15 -227.49 A86.0818					 90.7894 0 0 1 64.3 -281.74" class="st5"></path>	</g>	<g id="shape9-20" v:mid="9" v:groupcontext="shape" transform="translate(135.032,216.386) rotate(-90)">		<title>Left Brace.9</title>		<v:userdefs>			<v:ud v:nameu="visVersion" v:prompt="" v:val="VT0(15):26"></v:ud>		</v:userdefs>		<path d="M56.28 260.78 A75.347 51.4494 0 0 1 28.14 230.03 L28.14 107.06 L0 107.06 L28.14 107.06 L28.14 -15.92 A75.347					 51.4494 0 0 1 56.28 -46.66" class="st5"></path>	</g>	<g id="shape11-23" v:mid="11" v:groupcontext="shape" transform="translate(257.32,-220.796)">		<title>Sheet.11</title>		<desc>Packet</desc>		<v:textblock v:margins="rect(4,4,4,4)"></v:textblock>		<v:textrect cx="34.9359" cy="250.036" width="69.88" height="21.4796"></v:textrect>		<rect x="0" y="239.296" width="69.8718" height="21.4796" class="st6"></rect>		<text x="16.59" y="253.64" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>Packet</text>		</g>	<g id="shape17-26" v:mid="17" v:groupcontext="shape" transform="translate(200.096,-18.5)">		<title>Sheet.17</title>		<desc>Data frame</desc>		<v:textblock v:margins="rect(4,4,4,4)"></v:textblock>		<v:textrect cx="41.9231" cy="247.888" width="83.85" height="25.7755"></v:textrect>		<rect x="0" y="235" width="83.8462" height="25.7755" class="st6"></rect>		<text x="12.25" y="251.49" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>Data frame</text>		</g></g>
</svg>

## UART features

Source: [https://docs.qualcomm.com/doc/80-70018-8/topic/uart.html](https://docs.qualcomm.com/doc/80-70018-8/topic/uart.html)

The following table describes the UART transfer modes for applications.

Table : UART transfer modes

| Subsystem | Transfer mode | Description |
| --- | --- | --- |
| Linux | <ul class="ul" id="uart_features__ul_xkv_gyg_rcc"><br>                                <li class="li">FIFO (low speed)</li><br><br>                                <li class="li">CPU DMA (high speed)</li><br><br>                            </ul> | <ul class="ul" id="uart_features__ul_hsh_lyg_rcc"><br>                                <li class="li">Supports baud rates from 300 bps up to 4 Mbps.</li><br><br>                                <li class="li">FIFO mode transfers data between its Rx/Tx buffers and system<br>                                    memory</li><br><br>                                <li class="li">DMA mode transfers data between its Rx/Tx buffers and system<br>                                    memory. Better performance is achieved with high-speed UART<br>                                    drivers supporting higher baud rates and bigger data packages.<br>                                    For example, the Bluetooth wireless technology connectivity<br>                                    module. </li><br><br>                            </ul> |
| Boot | FIFO | <ul class="ul" id="uart_features__ul_g5g_ryg_rcc"><br>                                <li class="li">Rx/Tx 5 bits to 8 bits per character.</li><br><br>                                <li class="li">Supports a maximum baud rate of 115200.</li><br><br>                            </ul> |
| aDSP | FIFO | <ul class="ul" id="uart_features__ul_ocm_tyg_rcc"><br>                                <li class="li">Rx/Tx 5 bits to 8 bits per character.</li><br><br>                                <li class="li">Supported baud rates: 115200, 230400, 460800, 921600, 1000000,<br>                                    3000000, and 6000000.</li><br><br>                            </ul> |

## UART interface

Source: [https://docs.qualcomm.com/doc/80-70018-8/topic/uart.html](https://docs.qualcomm.com/doc/80-70018-8/topic/uart.html)

The following table provides the paths of UART driver configurations for the different
            subsystems.

Table : UART interface: Linux

| File type | Description |
| --- | --- |
| Device tree source | <ul class="ul" id="uart_interface__ul_ysx_dgf_ncc"><br>                                    <li class="li">QCS6490 and QCS5430: <a href="https://git.linaro.org/kernel-org/linux-next.git/tree/arch/arm64/boot/dts/qcom/sc7280.dtsi" target="_blank" class="xref cursorpointer" onclick="Window.BookmapComponent.navigateExternalFile('https://git.linaro.org/kernel-org/linux-next.git/tree/arch/arm64/boot/dts/qcom/sc7280.dtsi')">https://git.linaro.org/kernel-org/linux-next.git/tree/arch/arm64/boot/dts/qcom/sc7280.dtsi</a></li><br><br>                                    <li class="li">QCS9075: <a href="https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/qcom/sa8775p.dtsi" target="_blank" class="xref cursorpointer" onclick="Window.BookmapComponent.navigateExternalFile('https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/qcom/sa8775p.dtsi')">https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/qcom/sa8775p.dtsi</a></li><br><br>                                </ul> |
| `Pinctrl` settings | <ul class="ul" id="uart_interface__ul_hsz_14w_41c"><br>                                    <li class="li">The pin control table for the corresponding QUP v3 serial<br>                                        engine is<br>                                            at <span class="ph filepath">&lt;workspace_path_of_LINUX_kernel_image&gt;/sources/kernel/kernel_platform/kernel/arch/arm64/boot/dts/qcom/&lt;chipset&gt;.dts</span>.</li><br><br>                                    <li class="li">For DTSI configuration examples to override the chip<br>                                        product, see the following DTSI files.<ul class="ul" id="uart_interface__ul_gdv_vhf_ncc"><br>                                            <li class="li">QCS6490 and QCS5430: <a href="https://git.linaro.org/kernel-org/linux-next.git/tree/arch/arm64/boot/dts/qcom/sc7280.dtsi" target="_blank" class="xref cursorpointer" onclick="Window.BookmapComponent.navigateExternalFile('https://git.linaro.org/kernel-org/linux-next.git/tree/arch/arm64/boot/dts/qcom/sc7280.dtsi')">https://git.linaro.org/kernel-org/linux-next.git/tree/arch/arm64/boot/dts/qcom/sc7280.dtsi</a></li><br><br>                                            <li class="li">QCS9075: <a href="https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/qcom/sa8775p.dtsi" target="_blank" class="xref cursorpointer" onclick="Window.BookmapComponent.navigateExternalFile('https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/qcom/sa8775p.dtsi')">https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/qcom/sa8775p.dtsi</a></li><br><br>                                        </ul><br></li><br><br>                                </ul> |
| Qualcomm TEE settings | <ul class="ul" id="uart_interface__ul_opt_vp3_vdc"><br>                                    <li class="li"><span class="ph filepath">/firmware/qualcomm-linux-spf-1-0_ap_standard_oem_nomodem/TZ.XF.5.0/trustzone_images/core/settings/buses/qup_accesscontrol/qupv3/config/&lt;chipset&gt;/QUPAC_Access.c</span></li><br><br>                                </ul><br>. |

Table : UART interface: Boot (UEFI-only)

| File type | Description |
| --- | --- |
| QUP v3 serial engine configuration | <ul class="ul" id="uart_interface__ul_hdm_wp3_vdc"><br>                                    <li class="li"><span class="ph filepath">/firmware/qualcomm-linux-spf-1-0_ap_standard_oem_nomodem/BOOT.MXF.1.0.c1/boot_images/boot/QcomPkg/SocPkg/&lt;chipset&gt;/Settings/UART/UartSettings.c</span></li><br><br>                                </ul> |
| Qualcomm TEE settings | <ul class="ul" id="uart_interface__ul_r21_xp3_vdc"><br>                                    <li class="li"><span class="ph filepath">/firmware/qualcomm-linux-spf-1-0_ap_standard_oem_nomodem/TZ.XF.5.0/trustzone_images/core/settings/buses/qup_accesscontrol/qupv3/config/&lt;chipset&gt;/QUPAC_Access.c</span></li><br><br>                                </ul> |

Table : UART interface: aDSP/SLPI

| File type | Description |
| --- | --- |
| QUP v3 serial engine configuration | <ul class="ul" id="uart_interface__ul_lrk_1hn_rzb"><br>                                    <li class="li"><span class="ph filepath">/firmware/qualcomm-linux-spf-1-0_ap_standard_oem_nomodem/ADSP.HT.5.5.c8/adsp_proc/core/settings/buses/qup_common/config/&lt;chipset&gt;/adsp/ssc/qup_devcfg.c</span></li><br><br>                                    <li class="li"><span class="ph filepath">/firmware/qualcomm-linux-spf-1-0_ap_standard_oem_nomodem/ADSP.HT.5.5.c8/adsp_proc/core/settings/buses/qup_fw/config/&lt;chipset&gt;/fw_devcfg.c</span></li><br><br>                                </ul> |
| Firmware configuration settings | <ul class="ul" id="uart_interface__ul_wpr_p5j_51c"><br>                                    <li class="li"><span class="ph filepath">/firmware/qualcomm-linux-spf-1-0_ap_standard_oem_nomodem/ADSP.HT.5.5.c8/adsp_proc/core/settings/buses/qup_fw/config/&lt;chipset&gt;/fw_devcfg.c</span></li><br><br>                                    <li class="li"><span class="ph filepath">/firmware/qualcomm-linux-spf-1-0_ap_standard_oem_nomodem/ADSP.HT.5.5.c8/adsp_proc/core/settings/buses/qup_fw/config/&lt;chipset&gt;/fw_devcfg.xml</span></li><br><br>                                </ul> |

### UART APIs

Source: [https://docs.qualcomm.com/doc/80-70018-8/topic/uart.html](https://docs.qualcomm.com/doc/80-70018-8/topic/uart.html)

UART APIs for the following subsystems are listed in this section.

- Linux: [https://github.com/torvalds/linux/blob/master/include/linux/tty.h](https://github.com/torvalds/linux/blob/master/include/linux/tty.h)
- Boot: QcomPkg/Include/HSUart.h
- aDSP: adsp\_proc/core/api/buses/uart.h

## UART software

Source: [https://docs.qualcomm.com/doc/80-70018-8/topic/uart.html](https://docs.qualcomm.com/doc/80-70018-8/topic/uart.html)

This section provides information on the UART device tree configuration, and
            documentation for the device nodes.

### Linux

For information about Kernel device instances, see [https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/serial/qcom%2Cserial-geni-qcom.yaml](https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/serial/qcom%2Cserial-geni-qcom.yaml).

For information about the UART driver
            files, see [https://github.com/torvalds/linux/blob/master/drivers/tty/serial/qcom_geni_serial.c](https://github.com/torvalds/linux/blob/master/drivers/tty/serial/qcom_geni_serial.c)

    uart7: serial@99c000 {
    /* Manufacturer model of serial driver */
    compatible = "qcom,geni-uart";
    /* SE address and size */
    reg = <0 0x0099c000 0 0x4000>;
    /*Clocks for SE */
    clocks = <&gcc GCC_QUPV3_WRAP0_S7_CLK>;
    clock-names = "se";
    /* pinctrl setting */
    pinctrl-names = "default";
    pinctrl-0 = <&qup_uart7_cts>, <&qup_uart7_rts>, <&qup_uart7_tx>, <&qup_uart7_rx>;
    interrupts = <GIC_SPI 608 IRQ_TYPE_LEVEL_HIGH>;
    power-domains = <&rpmhpd SC7280_CX>;
    operating-points-v2 = <&qup_opp_table>;
    interconnects = <&clk_virt MASTER_QUP_CORE_0 0 &clk_virt SLAVE_QUP_CORE_0 0>,
    <&gem_noc MASTER_APPSS_PROC 0 &cnoc2 SLAVE_QUP_0 0>;			interconnect-names = "qup-core", "qup-config";
    /* To enable QUPV3 serial engine instance for UART protocol, change Status to OK */			status = "disabled";		};	}Copy to clipboard

For configuration settings of the serial engine GPIOs, see the following
            DTSI files.
- QCS6490 and QCS5430: [https://git.linaro.org/kernel-org/linux-next.git/tree/arch/arm64/boot/dts/qcom/sc7280.dtsi](https://git.linaro.org/kernel-org/linux-next.git/tree/arch/arm64/boot/dts/qcom/sc7280.dtsi)
- QCS9075: [https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/qcom/sa8775p.dtsi](https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/qcom/sa8775p.dtsi)

    qup_uart7_cts: qup-uart7-cts-state {			pins = "gpio28";			function = "qup07";		};
    		qup_uart7_rts: qup-uart7-rts-state {			pins = "gpio29";			function = "qup07";		};
    		qup_uart7_tx: qup-uart7-tx-state {			pins = "gpio30";			function = "qup07";		};
    		qup_uart7_rx: qup-uart7-rx-state {			pins = "gpio31";			function = "qup07";		};
    Copy to clipboard

Note: The Qualcomm TEE configurations must be aligned in
                    the QUPAC\_Access.c file to ensure that the GPIO/QUP v3 can
                be used. You can access the Qualcomm TEE images
                    at /firmware/qualcomm-linux-spf-1-0\_ap\_standard\_oem\_nomodem/TZ.XF.5.0/trustzone\_images/core/settings/buses/qup\_accesscontrol/qupv3/config/&lt;chipset&gt;/QUPAC\_Access.c.
                Modify the required settings or see the default settings assigned for particular
                instances of the QUP v3 serial engine.

QUP v3 supports both 4-wire UART with flow-control enabled, and 2-wire UART without
                flow control enabled. The following example for Qualcomm TEE access, controls entry
                for both. The QUP v3 serial engine configurations to enable the UART protocol are as
                    follows:
- Default configuration enabled for SE7 as HS
                        UART

        { QUPV3_0_SE7, QUPV3_PROTOCOL_UART_4W, QUPV3_MODE_FIFO, AC_HLOS, TRUE, TRUE, FALSE }, Copy to clipboard
- 2-wire UART configuration for
                        SE5

        uart5: serial@994000 {
        compatible = "qcom,geni-uart";
        reg = <0 0x00994000 0 0x4000>;
        clocks = <&gcc GCC_QUPV3_WRAP0_S5_CLK>;
        clock-names = "se";
        pinctrl-names = "default";
        pinctrl-0 =  <&qup_uart5_tx>, <&qup_uart5_rx>;
        interrupts = <GIC_SPI 606 IRQ_TYPE_LEVEL_HIGH>;
        power-domains = <&rpmhpd SC7280_CX>;
        operating-points-v2 = <&qup_opp_table>;
        interconnects = <&clk_virt MASTER_QUP_CORE_0 0 &clk_virt SLAVE_QUP_CORE_0 0>,
            <&gem_noc MASTER_APPSS_PROC 0 &cnoc2 SLAVE_QUP_0 0>;
        interconnect-names = "qup-core", "qup-config";
        status = "disabled";
        };Copy to clipboard

        { QUPV3_0_SE5, QUPV3_PROTOCOL_UART_2W, QUPV3_MODE_FIFO,
        AC_HLOS, TRUE, FALSE, FALSE },Copy to clipboard

### Boot

The QUP v3 serial engine can be configured to UART in boot using
                    the /firmware/qualcomm-linux-spf-1-0\_ap\_standard\_oem\_nomodem/BOOT.MXF.1.0.c1/boot\_images/boot/QcomPkg/SocPkg/&lt;chipset&gt;/Settings/UART/UartSettings.c
                file.

    UART_PROPERTIES devices =
    {
       // MAIN_PORT
       0x00994000,    // Serial Engine Base address
       0x009C0000,// qup_common base address
       0x2001c161,  // GPIO TX pin Config
       0x2000c171,  // GPIO RX Pin Config
       0,           // gpio_cts_config
       0,           // gpio_rfr_config
       0,           // clock_id_index
       (void*)0,        // bus_clock_id
       (void*)CLK_QUPV3_WRAP0_S5,     // core_clock_id
       0,          // irq number not used
       0,  //TCSR base
       0,  // TCSR offset
       0   // TCSR value
    
    };
    Copy to clipboard

**GPIO configuration**
The GPIO configuration is listed in the
                    following table.

Table : UART GPIO configuration

| Bits | Parameters |
| :---: | --- |
| [0:3] | GPIO function |
| [4:13] | GPIO number |
| [14] | Direction |
| [15:17] | Pull type |
| [18:21] | Drive strength |

You must configure each GPIO based on the following bit
                    fields.

    <!--
    GPIO configuration calculation
    
    GPIO DIR values
    GPIO_INPUT = 0x0
    GPIO_OUTPUT = 0x1
    
    GPIO_PULL values
    GPIO_NO_PULL = 0, /**< -- Do not specify a pull. */
    GPIO_PULL_DOWN = 0x1, /**< -- Pull the GPIO down. */
    GPIO_KEEPER_ENABLE = 0x2, /**< -- Keeper Enable. */
    GPIO_PULL_UP = 0x3, /**< -- Pull the GPIO up. */
    
    GPIO_DRV_STRENGTH values
    GPIO_2P0MA = 0, /**< -- Specify a 2 mA drive. */
    GPIO_4P0MA = 0x1, /**< -- Specify a 4 mA drive. */
    GPIO_6P0MA = 0x2, /**< -- Specify a 6 mA drive. */
    GPIO_8P0MA = 0x3, /**< -- Specify a 8 mA drive. */
    
    GPIO_FUNC_SELECT_Value
    GPIO_FS_VAL =0, //Specifies GPIO function
    
    GPIO_FS_VAL =0X1, //Specify NON GPIO function( UART/SPI/I2C)
    GPIO configuration = (GPIO_NUM & 0xFF) << 0x10 |
    (GPIO_FS_VAL & 0xF) << 0xC |
    (GPIO_DRV_STRENGTH & 0xF) << 0x8 |
    (GPIO_PULL & 0xF) << 0x4 |
    (GPIO_DIR & 0xF)
    
    -->
    /*
    | RESERVED | GPIO NUM | DRIVE | FUNC | PULL | DIR |
    -------------------------------------------------------------------------
    | 0000 | 0000 | 0001 | 1110 | 0001 | 0001 | 0010 | 0001 |
    -------------------------------------------------------------------------
    */Copy to clipboard

### aDSP

The firmware loads SSC QUP during the bootup sequence of the aDSP subsystem. Hence,
                the configuration file is present in the aDSP build
                    at /firmware/qualcomm-linux-spf-1-0\_ap\_standard\_oem\_nomodem/ADSP.HT.5.5.c8/adsp\_proc/core/settings/buses/qup\_fw/config/&lt;chipset&gt;/fw\_devcfg.c.

The following configuration is a sample of SSC QUP SE5/6 loaded with the UART
                firmware in the FIFO
                mode.

                       offset,        protocol,   mode,  load_fw, dfs_mode
    se_cfg se0_cfg = { 0x80000, SE_PROTOCOL_I3C,    GSI,     TRUE, TRUE  };
    se_cfg se1_cfg = { 0x84000, SE_PROTOCOL_I2C,    GSI,     TRUE, TRUE  };
    se_cfg se2_cfg = { 0x88000, SE_PROTOCOL_I2C,    GSI,     TRUE, TRUE  };
    se_cfg se3_cfg = { 0x8C000, SE_PROTOCOL_I2C,    GSI,     FALSE, TRUE  };
    se_cfg se4_cfg = { 0x90000, SE_PROTOCOL_SPI,    GSI,     TRUE, TRUE };
    se_cfg se5_cfg = { 0x94000, SE_PROTOCOL_UART,   FIFO,    TRUE,FALSE };
    se_cfg se6_cfg = { 0x98000, SE_PROTOCOL_UART,   FIFO,    TRUE,FALSE  };
    Copy to clipboard

GPIO configuration: Each serial engine in the QUP common driver is configured with
                the default GPIO configuration per protocol. The QUP v3 common driver picks the GPIO
                configuration according to the protocol loaded in the serial engine
                    from /firmware/qualcomm-linux-spf-1-0\_ap\_standard\_oem\_nomodem/ADSP.HT.5.5.c8/adsp\_proc/core/settings/buses/qup\_common/config/&lt;chipset&gt;/adsp/ssc/qup\_instance\_mapping.c.

The default GPIO configuration can be overwritten as follows.

    {      .instance_id          =  6 ,         //Instance ID
            .qup              =  QUP_SSC,    //QUP Type
            .se_index         =  5,          //SE ID
            .se_data          =  NULL,       //devcfg_map
            .protocol_io_cfg  =  {
                                    TLMM_MAP(TLMM_GPIO_KEEPER ,TLMM_GPIO_2MA,TLMM_GPIO_KEEPER ),              //SLEEP CFG
                                    TLMM_MAP(TLMM_GPIO_NO_PULL,TLMM_GPIO_6MA,TLMM_GPIO_KEEPER ),              //SPI CFG
                                    TLMM_MAP(TLMM_GPIO_NO_PULL,TLMM_GPIO_2MA,TLMM_GPIO_NO_PULL),              //UART CFG
                                    TLMM_MAP(TLMM_GPIO_PULL_UP,TLMM_GPIO_2MA,TLMM_GPIO_NO_PULL),              //I2C CFG
                                    TLMM_MAP(TLMM_GPIO_PULL_UP,TLMM_GPIO_2MA,TLMM_GPIO_KEEPER )               //I3C CFG
                                 },
            .se_exclusive     =  TRUE,
    }
    Copy to clipboard

TLMM\_MAP is a macro to initialize the active and sleep state GPIO configurations. For
                example, sample usage of the TLMM\_MAP macro.

    TLMM_MAP (active state pull type, drive strength, sleep state pull type)Copy to clipboard

## Enable virtualization in UART 

Source: [https://docs.qualcomm.com/doc/80-70018-8/topic/uart.html](https://docs.qualcomm.com/doc/80-70018-8/topic/uart.html)

This section covers the high-level flow from a guest virtual machine client to the
            hardware port of the host machine, considering Kernel-based virtual machine (KVM) as the
            virtual machine. A foundational understanding of virtualization, hypervisor, and virtual
            machine technology is beneficial.

Table : Virtualization features

| Virtualization components | Feature description |
| --- | --- |
| VirtIO | <ul class="ul" id="uart-support-for-virtualisation__ul_gfg_t23_pdc"><br>                                <li class="li">Provides an abstraction for a set of common emulated devices in<br>                                    a paravirtualized hypervisor</li><br><br>                                <li class="li">Uses UART device ports and serve application requests. Ensure<br>                                    VirtIO support or virtual function I/O (VFIO) at the KVM</li><br><br>                                <li class="li">Provides a common front end for the device emulations to<br>                                    standardize the interface and increase code reuse across<br>                                    platforms.</li><br><br>                                <li class="li">Supports virtualization environments that implement the VirtIO<br>                                    standard, such as QEMU/KVM. </li><br><br>                            </ul> |
| Hypervisor | <ul class="ul" id="uart-support-for-virtualisation__ul_p1t_bf3_pdc"><br>                                <li class="li">Exports a common set of emulated devices for a common<br>                                    application programming interface (API).</li><br><br>                                <li class="li">Implements a common set of interfaces, with the particular<br>                                    device emulation behind a set of back-end drivers</li><br><br>                            </ul> |

### ZigBee use case over UART in guest virtual machine

To identify the device character name, enumerate the ZigBee interface in Linux as a
                serial interface. For example, if ZigBee is connected over UART, it's enumerated as
                    /dev/MSMx.

Note: This section uses /dev/MSM0 as an
                example. Replace it with the actual character device ID.

1. Disable SELinux by running the following
                    command.

        setenforce 0Copy to clipboard
2. To enable KVM, do the following:
    1. Boot the device to UEFI.
    2. Select option 17 in the BDS menu to enter UEFI
                            menu.
    3. Select option 25 to enter OS configuration
                            selection menu.
    4. Increment the OS type to 2 (Linux with KVM) with
                            up arrow.
    5. Select Enter Power Cycle device. Wait for the
                            device to be online.
    6. Verify the device node. 

            ls /dev/kvmCopy to clipboard
3. Push the KVM image from
                        workspace&gt;\builds\kvm\gunyah\_k2l\svm\lemans\_svm\svm\Image.gz.

        adb push Image /mnt/overlay/Copy to clipboard
4. Push the `initrd` boot image from
                        workspace&gt;pkondeti\builds\kvm\gunyah\_k2l\svm\lemans\_svm\svm\yocto.cpio.gz.

        adb push yocto.cpio /mnt/overlay/Copy to clipboard
5. To connect the device to the guest virtual machine, you can use one of the
                    following two options.
    - Option **A**: For quick emulator (QEMU) virtualizer, connect the
                                /dev/ttyMSM0 character device to the guest
                            virtual machine using the following command.

            qemu-system-aarch64 \
                    -M virt -m 2G \
                    -initrd <your_initrd> \
                    -kernel <your_kernel> \
                    -device virtio-serial-pci \
                    -chardev tty,path=/dev/ttyMSM0,id=char0 \
                    -device virtserialport,chardev=char0,name=zigbee \
                    -cpu host --enable-kvm -smp 4 -nographicCopy to clipboard
    - Option **B**: For `libvirt` virtualizer, copy the
                            following values into the file at [https://github.qualcomm.com/pkondeti/qli_virt_recipes/blob/main/example/hk-vm.xml](https://github.qualcomm.com/pkondeti/qli_virt_recipes/blob/main/example/hk-vm.xml).

            <channel type='dev'>                                                                                                                                       
                <source path='/dev/ttyMSM0'/>                                                                                                                            
                <target type='virtio' name='zigbee'/>                                                                                                                    
                <alias name='zigbee'/>                                                                                                                                   
                <address type='virtio-serial'/>                                                                                          
            </channel>Copy to clipboard
6. To locate and verify the `virtio-serial` virtual serial port, run
                    the following command to list all ports.

        ls /dev/virtio-ports/zigbeeCopy to clipboard
7. Verify the virtual port
                        connection.

        echo "hello from guest" >> /dev/virtio-ports/zigbeeCopy to clipboard

Output:

        Hello from guestCopy to clipboard

## UART tools

Source: [https://docs.qualcomm.com/doc/80-70018-8/topic/uart.html](https://docs.qualcomm.com/doc/80-70018-8/topic/uart.html)

This section provides information on various test tools and methods for the UART serial
            interface driver to confirm the UART data transfers.

### Linux

For more details, see [https://docs.kernel.org/admin-guide/serial-console.html](https://docs.kernel.org/admin-guide/serial-console.html).

## Enable UART in kernel

Source: [https://docs.qualcomm.com/doc/80-70018-8/topic/uart.html](https://docs.qualcomm.com/doc/80-70018-8/topic/uart.html)

This section provides information on how to enable UART in the kernel.

### Linux

The following driver kernel configurations are required to support the UART
                    interface.
- UART driver: [https://github.com/torvalds/linux/blob/master/drivers/tty/serial/qcom_geni_serial.c](https://github.com/torvalds/linux/blob/master/drivers/tty/serial/qcom_geni_serial.c)
- Kernel `defconfig` file path:
                            &lt;workspace\_path\_of\_LINUX\_kernel\_image&gt;/sources/kernel
                            /kernel\_platform/kernel/arch/arm64/configs/qcom\_defconfig

The following kernel configurations must be enabled.
- `CONFIG_QCOM_GENI_SE=y`
- `CONFIG_SERIAL_QCOM_GENI=y`

To enable a serial node for the loopback validation, apply the following patch to the
                    /arch/arm64/boot/dts/qcom/&lt;chipset&gt;.dtsi
                file.

    --- a/arch/arm64/boot/dts/qcom/<chipset>.dtsi
    +++ b/arch/arm64/boot/dts/qcom/<chipset>.dtsi
    @@ -70,6 +70,7 @@
     		spi13 = &spi13;
     		spi14 = &spi14;
     		spi15 = &spi15;
    +		serial1 = &uart7;
    }; 

    +
    +&uart7 {
    +	status = "ok";
    +}; 
    Copy to clipboard

Note: You should compile the kernel configuration and device tree
                changes. After compilation, you can load the images to the device to verify the
                interface. For information about interface verification, see the [Verify UART interface](https://docs.qualcomm.com/doc/80-70018-8/topic/uart.html#uart_verification) section.

### Boot/aDSP

For customizations, see the [UART software](https://docs.qualcomm.com/doc/80-70018-8/topic/uart.html#uart_software) section.

## UART customization

Source: [https://docs.qualcomm.com/doc/80-70018-8/topic/uart.html](https://docs.qualcomm.com/doc/80-70018-8/topic/uart.html)

For information about customizing UART software, see [QUP v3 access control customization](https://docs.qualcomm.com/doc/80-70018-8/topic/references.html#customize-access-control-of-qup).

## Verify UART interface

Source: [https://docs.qualcomm.com/doc/80-70018-8/topic/uart.html](https://docs.qualcomm.com/doc/80-70018-8/topic/uart.html)

This section describes the validation procedure for the UART drivers, and the test
            results for the Qualcomm drivers.

### Linux

To enable the UART nodes, do the following and compile the kernel configuration.
1. To change the UART status to OKand aliases to the
                        specific UART node, edit the following DTSI files.
    - QCS6490 and QCS5430: [https://git.linaro.org/kernel-org/linux-next.git/tree/arch/arm64/boot/dts/qcom/sc7280.dtsi](https://git.linaro.org/kernel-org/linux-next.git/tree/arch/arm64/boot/dts/qcom/sc7280.dtsi)
    - QCS9075: [https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/qcom/sa8775p.dtsi](https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/qcom/sa8775p.dtsi)

Note: Enable the SSH shell or use the ADB shell
                            to run the commands and display the output in the SSH shell (console)
                            window. For more information about how to run SSH, see the [Use SSH](https://docs.qualcomm.com/bundle/publicresource/topics/80-70018-254/how_to.html)
                        section.

        aliases {
        i2c0 = &i2c0;
        spi15 = &spi15;
        ++serial1 = &uart7;
        };
        uart7: serial@99c000 {
        compatible = "qcom,geni-uart";
        reg = <0 0x0099c000 0 0x4000>;
        clocks = <&gcc GCC_QUPV3_WRAP0_S7_CLK>;
        clock-names = "se";
        pinctrl-names = "default";
        pinctrl-0 = <&qup_uart7_cts>, <&qup_uart7_rts>, <&qup_uart7_tx>,
        <&qup_uart7_rx>;
        interrupts = <GIC_SPI 608 IRQ_TYPE_LEVEL_HIGH>;
        power-domains = <&rpmhpd SC7280_CX>;
        operating-points-v2 = <&qup_opp_table>;
        interconnects = <&clk_virt MASTER_QUP_CORE_0 0 &clk_virt SLAVE_QUP_CORE_0
        0>,
        <&gem_noc MASTER_APPSS_PROC 0 &cnoc2 SLAVE_QUP_0 0>;
        interconnect-names = "qup-core", "qup-config";
        ++status = "ok";
        };Copy to clipboard
2. Disable the `if` condition in
                            the qcom\_geni\_serial.c at [https://github.com/torvalds/linux/blob/master/drivers/tty/serial/qcom_geni_serial.c](https://github.com/torvalds/linux/blob/master/drivers/tty/serial/qcom_geni_serial.c) file for the loopback
                        test.

        //if (mctrl & TIOCM_LOOP) // Disabling the if condition for loopback test
        port->loopback = RX_TX_CTS_RTS_SORTED;Copy to clipboard

To validate the QUP v3 UART registration functionality in the Linux kernel, ensure
                that the UART is correctly registered with the TTY stack.

1. Disable the UART default use case in the following DTSI files.
    - QCS6490 and QCS5430: [https://git.linaro.org/kernel-org/linux-next.git/tree/arch/arm64/boot/dts/qcom/sc7280.dtsi](https://git.linaro.org/kernel-org/linux-next.git/tree/arch/arm64/boot/dts/qcom/sc7280.dtsi)
    - QCS9075: [https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/qcom/sa8775p.dtsi](https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/qcom/sa8775p.dtsi)

        bluetooth: bluetooth {
        
               ++      status = "disabled";
        Copy to clipboard

The following output is
                        displayed.

        ls /dev/ttyHS1
        /dev/ttyHS1
        dmesg | grep ttyH
        [    3.355487] 99c000.serial: ttyHS1 at MMIO 0x99c000 (irq = 137, base_baud = 0) is a MSMCopy to clipboard
2. To verify the UART driver, do the following:
    1. Open the SSH shell in permissive mode or use the ADB shell.
    2. Register the
                                UART.

            ls /dev/ttyHS*Copy to clipboard

The
                                following is a sample
                                output.

            ls /dev/ttyHS*
            /dev/ttyHS1
            Copy to clipboard

Map the `ttyHS1` port according to the
                                aliases added for the `serial1 = &uart7` and
                                enable the serial engine.

The UART devices registered in the kernel are listed. The UART driver follows the
                test sequence to enable loopback. After enabling the UART node in the DUT, run the
                following commands to verify that the UART instance is enabled in the DTSI file.
                    
Note: Open two SSH shells or use the ADB shell to write
                    and read the data for the UART loopback. For more information about how to run
                    SSH, see the [Use SSH](https://docs.qualcomm.com/bundle/publicresource/topics/80-70018-254/how_to.html) section.

1. Open the SSH shell in permissive mode or use the ADB shell.
2. Transfer data with the `echo`
                        command.

        echo "This Document Is Very Much Helpful" > /dev/ttyHS1Copy to clipboard
3. Read data in the UART device
                        node.

        cat /dev/ttyHS1Copy to clipboard

## Debug UART issues

Source: [https://docs.qualcomm.com/doc/80-70018-8/topic/uart.html](https://docs.qualcomm.com/doc/80-70018-8/topic/uart.html)

This section provides information about enabling the debug logs in the UART software
            driver.

### Linux

UART driver logging is enabled through the dynamic debugging method. Enable
                    `CONFIG_DYNAMIC_DEBUG`
                    in &lt;workspace\_path\_of\_LINUX\_kernel\_image&gt;/sources/kernel/kernel\_platform/kernel/arch/arm64/configs/qcom\_defconfig
                to support the dynamic debugging for kernel drivers.

To enable and view the UART driver logs in the kernel logs (`dmesg`),
                run the following
                command.

    mount -t debugfs none /sys/kernel/debug
    echo -n "file qcom_geni_serial.c +p" > /sys/kernel/debug/dynamic_debug/control
    echo -n "file qcom-geni-se.c +p" > /sys/kernel/debug/dynamic_debug/control
    echo -n "file serial_core.c +p" > /sys/kernel/debug/dynamic_debug/control
    echo -n "file gpi.c +p" > /sys/kernel/debug/dynamic_debug/control
    Copy to clipboard

## UART examples

Source: [https://docs.qualcomm.com/doc/80-70018-8/topic/uart.html](https://docs.qualcomm.com/doc/80-70018-8/topic/uart.html)

For information about the upstream device tree reference, see the following DTSI
                files.
- QCS6490 and QCS5430: [https://git.linaro.org/kernel-org/linux-next.git/tree/arch/arm64/boot/dts/qcom/sc7280.dtsi](https://git.linaro.org/kernel-org/linux-next.git/tree/arch/arm64/boot/dts/qcom/sc7280.dtsi)
- QCS9075: [https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/qcom/sa8775p.dtsi](https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/qcom/sa8775p.dtsi)

For information about device-tree node for the Qualcomm Linux hardware SoCs, see the
            following DTSI files.
- QCS6490 and QCS5430: [https://git.linaro.org/kernel-org/linux-next.git/tree/arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts](https://git.linaro.org/kernel-org/linux-next.git/tree/arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts)
- QCS9075: [https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/qcom/sa8775p.dtsi](https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/qcom/sa8775p.dtsi)

Last Published: Mar 26, 2025

[Previous Topic
Getting started: Set up device interface](https://docs.qualcomm.com/bundle/publicresource/80-70018-8/topics/get-started.md) [Next Topic
SPI](https://docs.qualcomm.com/bundle/publicresource/80-70018-8/topics/spi.md)