<?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>Config baud rate at Run time on the Thingy91</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/69112/config-baud-rate-at-run-time-on-the-thingy91</link><description>Hi Dev team, 
 I am working with the Thingy91 and I have connected it to an external sensor through UART-1. 
 I am connecting another sensor through the same UART but with a different baud rate. In order to make them both running through the same UART</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 14 Dec 2020 15:43:10 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/69112/config-baud-rate-at-run-time-on-the-thingy91" /><item><title>RE: Config baud rate at Run time on the Thingy91</title><link>https://devzone.nordicsemi.com/thread/284851?ContentTypeID=1</link><pubDate>Mon, 14 Dec 2020 15:43:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6a147f43-4e2f-4d93-b3a9-4285cee90b5d</guid><dc:creator>Adeel</dc:creator><description>&lt;p&gt;Hi Carl,&lt;/p&gt;
&lt;p&gt;Yes, this works :). Now , I am able to get the data after the baud rate change as well. Thanks for the help :).&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Adeel.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Config baud rate at Run time on the Thingy91</title><link>https://devzone.nordicsemi.com/thread/284788?ContentTypeID=1</link><pubDate>Mon, 14 Dec 2020 13:22:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:206b6709-5f21-427b-8baa-48bb32a8ba28</guid><dc:creator>Carl Richard</dc:creator><description>&lt;p&gt;Hi again.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Okay. I did some testing myself, and saw that things might be happening in the wrong order using the code I showed you earlier. The &amp;quot;disabling&amp;quot; must happen after RX is stopped. See the code below:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;//START BAUDRATE CHANGE
NRF_UARTE1_NS-&amp;gt;EVENTS_RXTO = 0; 
NRF_UARTE1_NS-&amp;gt;TASKS_STOPRX =1; 

while (NRF_UARTE1_NS-&amp;gt;EVENTS_RXTO == 0); // Wait for RXTO
NRF_UARTE1_NS-&amp;gt;ENABLE = UARTE_ENABLE_ENABLE_Disabled;
	
/* Do you stuff here*/
NRF_UARTE1_NS-&amp;gt;BAUDRATE = (UARTE_BAUDRATE_BAUDRATE_Baud9600 &amp;lt;&amp;lt; UARTE_BAUDRATE_BAUDRATE_Pos);

NRF_UARTE1_NS-&amp;gt;ENABLE = UARTE_ENABLE_ENABLE_Enabled;
NRF_UARTE1_NS-&amp;gt;TASKS_STARTRX =1; 

while (NRF_UARTE1_NS-&amp;gt;EVENTS_RXSTARTED==0); // Wait for RX start
//END BAUDRATE CHANGE

printk(&amp;quot;Value of baudrate register : %d \n&amp;quot;,NRF_UARTE1-&amp;gt;BAUDRATE);
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Could you try it out and see if it works?&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Carl Richard&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Config baud rate at Run time on the Thingy91</title><link>https://devzone.nordicsemi.com/thread/284705?ContentTypeID=1</link><pubDate>Mon, 14 Dec 2020 08:51:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:817e9cda-5847-4e1f-97fe-24ad4f59dead</guid><dc:creator>Adeel</dc:creator><description>&lt;p&gt;Hi Carl,&lt;/p&gt;
&lt;p&gt;Yes, I have 2 sensors connected to my UART_1.&lt;/p&gt;
[quote userid="68044" url="~/f/nordic-q-a/69112/config-baud-rate-at-run-time-on-the-thingy91/284696#284696"]How are they wired and how did you test them individually?[/quote]
&lt;p&gt;I tested them individually and they work perfectly. I changed my baud rate in my overlay file to 1200 and tested the 1st sensor, and again changed it manually to 9600 in overlay and tested the second sensor. They work pretty well individually.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I have used the test pads TP32 (P0.13) for Tx and TP33 for Rx (P0.16) for wiring. I have 1 sensor that only receives data when powered on so I have that sensor Rx connected directly to TP33. The other sensor has Tx on TP32 and Rx on TP33.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;My overlay file is :&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;amp;uart1 {
	current-speed = &amp;lt;1200&amp;gt;; 
	status = &amp;quot;okay&amp;quot;;
	tx-pin = &amp;lt;13&amp;gt;;
	rx-pin = &amp;lt;16&amp;gt;;
	rts-pin = &amp;lt;14&amp;gt;;
	//cts-pin = &amp;lt;05&amp;gt;;	
};&lt;/pre&gt;&lt;/p&gt;
[quote userid="68044" url="~/f/nordic-q-a/69112/config-baud-rate-at-run-time-on-the-thingy91/284696#284696"]but I wonder, have you considered to use two UARTs instead?[/quote]
&lt;p&gt;I am working on the Thingy91, and I have only 2 UART&amp;#39;s to use (UART_0 and UART_1). UART_0 is for logging and serial port to view the logs I believe, that&amp;#39;s why I did not try to use UART_0. So, I was left with the option of only UART_1.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Adeel.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Config baud rate at Run time on the Thingy91</title><link>https://devzone.nordicsemi.com/thread/284696?ContentTypeID=1</link><pubDate>Mon, 14 Dec 2020 08:39:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0e2c85b0-d335-45b4-959a-df247e75f0b5</guid><dc:creator>Carl Richard</dc:creator><description>&lt;p&gt;Hi again, Adeel!&lt;br /&gt;&lt;br /&gt;Just to get some clarification here: you have two sensors connected to UART1?&amp;nbsp;How are they wired and how did you test them individually?&lt;br /&gt;&lt;br /&gt;I will see if there is some other way to change it properly, but I wonder, have you considered to use two UARTs instead?&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Carl Richard&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Config baud rate at Run time on the Thingy91</title><link>https://devzone.nordicsemi.com/thread/284599?ContentTypeID=1</link><pubDate>Fri, 11 Dec 2020 15:59:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:521a14b3-752e-4748-b4e9-d6724967ee99</guid><dc:creator>Adeel</dc:creator><description>&lt;p&gt;Hi Carl,&lt;/p&gt;
&lt;p&gt;Not sure if this is a closed ticket, but I was facing issues while trying out the above configuration for uart_1 on Thingy91.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I have a sensor running at 9600 baud and another at 1200 baud. When I manually configure the baud rates in the overlay file (1200 once and 9600 next time), the data is received perfectly when I work around with the sensors individually.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;However, now I tried to configure baud rate in runtime through the above config as I needed both sensors data simultaneously. The overlay config is set to 9600, so by default, I get my first sensor data which is at 9600 baud. But when I set the baud rate to 1200 using the above config in my code, the baud rate does set to 1200 as I see in the printk() but I dont receive any data from my sensor that works on 1200 baud. Not sure what could be the issue here as I was expecting my data to be received when the baud rate changed. Is there any additional thing to be done other than this ?&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Adeel.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Config baud rate at Run time on the Thingy91</title><link>https://devzone.nordicsemi.com/thread/283953?ContentTypeID=1</link><pubDate>Wed, 09 Dec 2020 07:28:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b8dcee9e-31d0-4ebe-af6c-340eedab617f</guid><dc:creator>Carl Richard</dc:creator><description>&lt;p&gt;Good to hear, Adeel!&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Carl Richard&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Config baud rate at Run time on the Thingy91</title><link>https://devzone.nordicsemi.com/thread/283882?ContentTypeID=1</link><pubDate>Tue, 08 Dec 2020 15:39:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ca43da4a-6f7d-49d4-9349-6da5db22c358</guid><dc:creator>Adeel</dc:creator><description>&lt;p&gt;Hi Carl,&lt;/p&gt;
&lt;p&gt;Thanks a lot for clearing things up :). I understood how its done now.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Adeel.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Config baud rate at Run time on the Thingy91</title><link>https://devzone.nordicsemi.com/thread/283867?ContentTypeID=1</link><pubDate>Tue, 08 Dec 2020 15:03:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:17b48e50-acc6-455a-a00e-084de9bad2e3</guid><dc:creator>Carl Richard</dc:creator><description>&lt;p&gt;Hi, Adeel!&lt;br /&gt;&lt;br /&gt;My pleasure. I was maybe unclear; the code I shared earlier is what you must do each time you change the baudrate. I demonstrated for 9600, but if you want to change to 1200 the line is as follows:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;NRF_UARTE1-&amp;gt;BAUDRATE = (UARTE_BAUDRATE_BAUDRATE_Baud1200 &amp;lt;&amp;lt; UARTE_BAUDRATE_BAUDRATE_Pos);&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Carl Richard&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Config baud rate at Run time on the Thingy91</title><link>https://devzone.nordicsemi.com/thread/283788?ContentTypeID=1</link><pubDate>Tue, 08 Dec 2020 11:56:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4c73f2cc-9c9d-4cf2-89f5-76b1ae654d9b</guid><dc:creator>Adeel</dc:creator><description>&lt;p&gt;Hi Carl,&lt;/p&gt;
&lt;p&gt;Thanks for the explanation. While I understood most of the part, I couldn&amp;#39;t clearly get what Line 7 of the code does.&lt;/p&gt;
&lt;p&gt;Does it change the baud rate from what is assigned initially in the overlay file to 9600 ? For my requirement, I need the baud rate to keep changing from 1200 to 9600 and to keep repeating this as and when I call the different sensors.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Adeel.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Config baud rate at Run time on the Thingy91</title><link>https://devzone.nordicsemi.com/thread/283617?ContentTypeID=1</link><pubDate>Mon, 07 Dec 2020 15:21:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1e3b002c-a9bd-46d0-a9e4-062bfb9eda40</guid><dc:creator>Carl Richard</dc:creator><description>&lt;p&gt;Hi, Adeel!&lt;br /&gt;&lt;br /&gt;This should be no problem! I&amp;#39;ve attached a simple demonstration below that updates the baudrate to 9600. Notice how the peripheral must be disabled properly before the register can be updated.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;pre class="ui-code" data-mode="text"&gt;NRF_UARTE1-&amp;gt;ENABLE = UARTE_ENABLE_ENABLE_Disabled;
NRF_UARTE1-&amp;gt;EVENTS_RXTO = 0; 
NRF_UARTE1-&amp;gt;TASKS_STOPRX =1; 

while (NRF_UARTE1-&amp;gt;EVENTS_RXTO == 0); // Wait for RXTO 
/* Do you stuff here*/
NRF_UARTE1-&amp;gt;BAUDRATE = (UARTE_BAUDRATE_BAUDRATE_Baud9600 &amp;lt;&amp;lt; UARTE_BAUDRATE_BAUDRATE_Pos);
printk(&amp;quot;Value of baudrate register : %d \n&amp;quot;,NRF_UARTE1-&amp;gt;BAUDRATE);

NRF_UARTE1-&amp;gt;ENABLE = UARTE_ENABLE_ENABLE_Enabled;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Carl Richard&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>