<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>How to configure the parity, stop_bits, data_bits, flow_ctrl parameters of the UART in the xx.overlay file in NCS？</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/81177/how-to-configure-the-parity-stop_bits-data_bits-flow_ctrl-parameters-of-the-uart-in-the-xx-overlay-file-in-ncs</link><description>I want to know how to configure parity, stop_bits, data_bits, flow_ctrl parameters in UART in the xx.overlay file. 
 Although these parameters can be configured through the uart_configure interface, I prefer to configure them through overlay files or</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 02 Nov 2021 06:18:23 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/81177/how-to-configure-the-parity-stop_bits-data_bits-flow_ctrl-parameters-of-the-uart-in-the-xx-overlay-file-in-ncs" /><item><title>RE: How to configure the parity, stop_bits, data_bits, flow_ctrl parameters of the UART in the xx.overlay file in NCS？</title><link>https://devzone.nordicsemi.com/thread/336968?ContentTypeID=1</link><pubDate>Tue, 02 Nov 2021 06:18:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:95a93605-dd4d-49db-b2a3-ff1791b260aa</guid><dc:creator>Jim</dc:creator><description>&lt;p&gt;thank you for your reply.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to configure the parity, stop_bits, data_bits, flow_ctrl parameters of the UART in the xx.overlay file in NCS？</title><link>https://devzone.nordicsemi.com/thread/336485?ContentTypeID=1</link><pubDate>Thu, 28 Oct 2021 12:49:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:02f0254a-ffa8-430f-afc1-9ef94335a58d</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;In this answer I assume&amp;nbsp;&lt;span&gt;you&amp;#39;re setting &lt;code&gt;compatible=&amp;quot;nordic,nrf-uarte&amp;quot;&lt;/code&gt; in the uart node instance&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;To configure &lt;strong&gt;parity&lt;/strong&gt;, use the configuration&amp;nbsp;&lt;span&gt;CONFIG_UART_&amp;lt;instance&amp;gt;_NRF_PARITY_BIT&lt;/span&gt;
&lt;ul&gt;
&lt;li&gt;E.g. if you set&amp;nbsp;&amp;nbsp;&lt;span&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/15be5e615498377e9326cb2eb5819c7c62005299/drivers/serial/Kconfig.nrfx#L61"&gt;CONFIG_UART_0_NRF_PARITY_BIT&lt;/a&gt;=y, &lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v2.6.99-ncs1/drivers/serial/uart_nrfx_uarte.c#L2040-L2042"&gt;an even parity bit will be used for UART0, otherwise, no parity will be used&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;It does not seem like setting the field &lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v2.6.99-ncs1/dts/bindings/serial/uart-controller.yaml#L22"&gt;parity&lt;/a&gt; to &lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v2.6.99-ncs1/dts/bindings/serial/uart-controller.yaml#L29-L31"&gt;&amp;quot;none&amp;quot;, &amp;quot;odd&amp;quot; or &amp;quot;even&amp;quot;&lt;/a&gt;&lt;span style="font-family:monospace;"&gt;&amp;nbsp;&lt;/span&gt;will have any effect, since the driver uart_nrfx_uarte.c does not get it from the device tree&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;To&amp;nbsp;enable&amp;nbsp;&lt;span&gt;RTS/CTS &lt;strong&gt;flow control,&lt;/strong&gt;&amp;nbsp;add the field&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v2.6.99-ncs1/dts/bindings/serial/uart-controller.yaml#L18"&gt;hw-flow-control&lt;/a&gt;&amp;nbsp;to your UART instance. Like it&amp;#39;s done in the &lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/v1.7.0/applications/serial_lte_modem/nrf9160dk_nrf9160_ns.overlay"&gt;serial_lte model example&lt;/a&gt;&lt;/span&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v2.6.99-ncs1/drivers/serial/uart_nrfx_uarte.c#L2043"&gt;uart_nrfx_uarte.c will then use the macro UARTE_PROP&lt;/a&gt; to get it from the devicetree/overlay&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;If you want to set it to e.g. DTR/DSR, you have to use the&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v2.6.99-ncs1/include/drivers/uart.h#L716"&gt;uart_configure()&lt;/a&gt;&lt;span&gt;&amp;nbsp;function&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;To set the &lt;strong&gt;baudrate&lt;/strong&gt;, set the field &lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v2.6.99-ncs1/dts/bindings/serial/nordic%2Cnrf-uart-common.yaml#L47"&gt;current-speed&lt;/a&gt;&amp;nbsp;to any of &lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v2.6.99-ncs1/dts/bindings/serial/nordic%2Cnrf-uart-common.yaml#L52-L69"&gt;these values&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v2.6.99-ncs1/drivers/serial/uart_nrfx_uarte.c#L2037"&gt;uart_nrfx_uarte.c will then use the macro UARTE_PROP&lt;/a&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;to get it from the devicetree/overlay&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;To set the &lt;strong&gt;data bits and stop bits&lt;/strong&gt;, you have to use the &lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v2.6.99-ncs1/include/drivers/uart.h#L716"&gt;uart_configure()&lt;/a&gt; function, like it&amp;#39;s done in&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v2.6.99-ncs1/subsys/mgmt/osdp/src/osdp.c#L211-L213"&gt;zephyr/subsys/mgmt/osdp/src/osdp.c&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v2.6.99-ncs1/subsys/mgmt/osdp/src/osdp.c#L211-L213"&gt;The uart_nrfx_uarte.c driver will set the&amp;nbsp;data bits and the stop bits to some default values 8 and 1&lt;/a&gt;, so it will not have any effect setting this in the device tree. However, I could not find any fields for these properties in any bindings files regardless.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>