<?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>Baud Rate change within program</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/91948/baud-rate-change-within-program</link><description>Hi Nordic, 
 
 1.I am running (C:\ncs\v2.1.0-rc2\zephyr\samples\drivers\uart\echo_bot) but i need to change baud rate within program 
 2. I Can Change my baud rate using overlay file 
 3. But I dont want overlay file i need to make changes within pro</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 21 Sep 2022 08:31:10 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/91948/baud-rate-change-within-program" /><item><title>RE: Baud Rate change within program</title><link>https://devzone.nordicsemi.com/thread/387218?ContentTypeID=1</link><pubDate>Wed, 21 Sep 2022 08:31:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:469927d2-f8ee-462d-a671-57fcab85937d</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Here is the modified sample I used for testing:&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/echo_5F00_bot_5F00_19200.zip"&gt;devzone.nordicsemi.com/.../echo_5F00_bot_5F00_19200.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I moved the changing of baud rate earlier in the application, so now all UART TX/RX will use 19200 baud rate.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Baud Rate change within program</title><link>https://devzone.nordicsemi.com/thread/386881?ContentTypeID=1</link><pubDate>Mon, 19 Sep 2022 12:48:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:86d2492d-e91c-4485-b39d-71c56ecebad0</guid><dc:creator>Tharak</dc:creator><description>&lt;p&gt;Hi Jorgen,&lt;/p&gt;
&lt;p&gt;Please share your zip file then i can know where it is wrong&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Baud Rate change within program</title><link>https://devzone.nordicsemi.com/thread/386565?ContentTypeID=1</link><pubDate>Fri, 16 Sep 2022 09:29:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2ac88a16-4163-4b2c-83bc-e53cb4f66d9d</guid><dc:creator>Tharak</dc:creator><description>&lt;p&gt;Hi Jorgen,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;1. Still i tried 100 of time its only taking default 115200 only&lt;/p&gt;
&lt;p&gt;2. I changed 9600 38400 57600 but its taking default&lt;/p&gt;
&lt;p&gt;3. i am wondering its working for you its not working for me&lt;/p&gt;
&lt;p&gt;4. i am using bl653_dvk board ncs v2.0.0 and west command and for flashing using tera term&lt;/p&gt;
&lt;p&gt;5. I attaching build/zephyr/zephyr.dts screenshot&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/mm.PNG" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Baud Rate change within program</title><link>https://devzone.nordicsemi.com/thread/386552?ContentTypeID=1</link><pubDate>Fri, 16 Sep 2022 08:59:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:34ef706d-d878-47df-a624-deca5a5a8e8d</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>[quote user="Tharak"]4. When i use your code and changed baud rate from 1000000 to 19200 its wont work&amp;nbsp;[/quote]
&lt;p&gt;What is not working? I tested it on my end and it works fine here.&lt;/p&gt;
[quote user="Tharak"]5. i think my problem you understood and i checked in build/zephyr/zephyr.dts file its showing 115200 baud rate&amp;nbsp;[/quote]
&lt;p&gt;This is expected, as the config from the devicetree will be used for initializing the UART. The updated baud rate will first take effect after you have run the code I provided.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Baud Rate change within program</title><link>https://devzone.nordicsemi.com/thread/386520?ContentTypeID=1</link><pubDate>Fri, 16 Sep 2022 06:59:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0ffe2f75-7195-4378-906e-71d091a2b52d</guid><dc:creator>Tharak</dc:creator><description>&lt;p&gt;Hi Jorgen,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;1. I tried the code after print_uart statement&lt;/p&gt;
&lt;p&gt;2. I didnt got anny errors thats fine&lt;/p&gt;
&lt;p&gt;3. But my ulitimate goal is i need to print the statement in 19200 baud rate&amp;nbsp;&lt;/p&gt;
&lt;p&gt;4. When i use your code and changed baud rate from 1000000 to 19200 its wont work&amp;nbsp;&lt;/p&gt;
&lt;p&gt;5. i think my problem you understood and i checked in build/zephyr/zephyr.dts file its showing 115200 baud rate&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Baud Rate change within program</title><link>https://devzone.nordicsemi.com/thread/386302?ContentTypeID=1</link><pubDate>Thu, 15 Sep 2022 07:51:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3d8cd48f-9325-4c5f-bd6c-0f500503f4eb</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>[quote user="Tharak"]1. When i paste this code in echo bot as you say at starting point&amp;nbsp;[/quote]
&lt;p&gt;I did not say that I pasted the code at the starting point of the sample, I said I used the sample as a starting point for adding this code.&lt;/p&gt;
[quote user="Tharak"]2. I got so many errors please check from your side and rectify the errors&amp;nbsp;[/quote]
&lt;p&gt;I did run the code at my end, and it is working properly (I used nRF Connect SDK v2.0.0). Put the code after &lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v3.0.99-ncs1/samples/drivers/uart/echo_bot/src/main.c#L86"&gt;this line&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;If you get any errors, you need to post the errors here if you want me to help you resolve them.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Baud Rate change within program</title><link>https://devzone.nordicsemi.com/thread/386283?ContentTypeID=1</link><pubDate>Thu, 15 Sep 2022 05:40:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c8b62bba-fba6-4a3d-9367-2fceb92ca265</guid><dc:creator>Tharak</dc:creator><description>&lt;p&gt;Hi Jorgen,&lt;br /&gt;&lt;br /&gt;Thank you for this code&lt;/p&gt;
&lt;p&gt;1. When i paste this code in echo bot as you say at starting point&amp;nbsp;&lt;/p&gt;
&lt;p&gt;2. I got so many errors please check from your side and rectify the errors&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Baud Rate change within program</title><link>https://devzone.nordicsemi.com/thread/386205?ContentTypeID=1</link><pubDate>Wed, 14 Sep 2022 13:33:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:edb9a97f-732c-478d-af53-37b612b29b83</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Using the echo_bot sample as a starting point, you can do something like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;struct uart_config uart_config_current;

if(uart_config_get(uart_dev, &amp;amp;uart_config_current) != 0)
{
	printk(&amp;quot;uart_config_get() returned error&amp;quot;);
}

uart_config_current.baudrate = 1000000;

if(uart_configure(uart_dev, &amp;amp;uart_config_current) != 0)
{
	printk(&amp;quot;uart_configure() returned error&amp;quot;);
}
else
{
	printk(&amp;quot;UART baudrate changed successfully&amp;quot;);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;If you then run a serial terminal at 1M baudrate, it should output some &amp;quot;garbage&amp;quot; (from the initial output at 115200 baudrate) and then print &amp;quot;UART baudrate changed successfully&amp;quot;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Baud Rate change within program</title><link>https://devzone.nordicsemi.com/thread/386190?ContentTypeID=1</link><pubDate>Wed, 14 Sep 2022 12:58:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:86b05212-bda8-4a00-9989-8ec616d74db7</guid><dc:creator>Tharak</dc:creator><description>&lt;p&gt;Hi Jorgen,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;1.Sorry for telling i am little bit confused about api uart_configure and all&amp;nbsp;&lt;/p&gt;
&lt;p&gt;2. My Suggestion is could you provide a example with example code if possible&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Baud Rate change within program</title><link>https://devzone.nordicsemi.com/thread/386186?ContentTypeID=1</link><pubDate>Wed, 14 Sep 2022 12:51:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dcd120fc-ceb1-4713-8017-fa04251b529f</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You can try the API &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.0.2/zephyr/hardware/peripherals/uart.html#c.uart_configure"&gt;uart_configure&lt;/a&gt;&lt;span&gt;() to change the baudrate. You can get the current config using &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.0.2/zephyr/hardware/peripherals/uart.html#c.uart_config_get"&gt;uart_config_get&lt;/a&gt;(), store this in a &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.0.2/zephyr/hardware/peripherals/uart.html#c.uart_config"&gt;uart_config&lt;/a&gt;&amp;nbsp;struct, change the baud rate in this struct, and set the config again.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;br /&gt;Jørgen&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>