<?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>HCI and MCUMGR on the same UART</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/116093/hci-and-mcumgr-on-the-same-uart</link><description>Hello, 
 My board contains nRF9160 and nRF52840. The nRF52840 is a HCI controller (based on HCI lpuart example). nRF9160 communicates with nRF52840 over UART. I want to perform firmware update for nRF52840 with MCUMGR over the same pins that are used</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 12 Nov 2024 14:01:07 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/116093/hci-and-mcumgr-on-the-same-uart" /><item><title>RE: HCI and MCUMGR on the same UART</title><link>https://devzone.nordicsemi.com/thread/510125?ContentTypeID=1</link><pubDate>Tue, 12 Nov 2024 14:01:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2d5265e7-cef2-4bab-8faa-1fe9bd8936e3</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Ok, and any reason why you don&amp;#39;t want to use multithreading?&lt;/p&gt;
&lt;p&gt;If you send me the application, I can poke around, but it is a lot faster if I have a starting point, rather than having to set it all up myself.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HCI and MCUMGR on the same UART</title><link>https://devzone.nordicsemi.com/thread/510028?ContentTypeID=1</link><pubDate>Tue, 12 Nov 2024 07:49:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:afd7cc1c-ded4-40ca-b091-e0baa812d72f</guid><dc:creator>tdfilip</dc:creator><description>&lt;p&gt;It doesn&amp;#39;t build because uart_nrf_sw_lpuart.c uses function k_msleep in api_poll_out.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HCI and MCUMGR on the same UART</title><link>https://devzone.nordicsemi.com/thread/509838?ContentTypeID=1</link><pubDate>Mon, 11 Nov 2024 10:13:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:44c82ec5-6666-4273-9836-e3c4d96c04a5</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Does it build without it? If not, what does the build log say?&lt;/p&gt;
&lt;p&gt;BR,&lt;br /&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HCI and MCUMGR on the same UART</title><link>https://devzone.nordicsemi.com/thread/509484?ContentTypeID=1</link><pubDate>Thu, 07 Nov 2024 14:33:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:12b920d0-01fc-4208-b0af-f28b7f3df89d</guid><dc:creator>tdfilip</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Is it possible to enable lpuart in mcuboot without enabling CONFIG_MULTITHREADING?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HCI and MCUMGR on the same UART</title><link>https://devzone.nordicsemi.com/thread/509477?ContentTypeID=1</link><pubDate>Thu, 07 Nov 2024 14:15:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:21d725cb-1e90-4758-bc7a-f22fc3a2f017</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;This sounds like the mcumgr doesn&amp;#39;t really use the lpuart, but a normal UART. The difference between the two has to do with the flow control pins, and how they work.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you look at the hci lpuart sample found in: ncs\nrf\samples\bluetooth\hci_lpuart, you can see that this is mostly an empty project, with just some configuration files, and a CMakeLists.txt file pointing to the ncs\zephyr\samples\bluetooth\hci_uart&lt;/p&gt;
&lt;p&gt;So this is where the hci_uart sample get&amp;#39;s it&amp;#39;s lpuart settings from.&lt;/p&gt;
&lt;p&gt;For your case, the child image, mcuboot, is unaware that it should use lpuart instead of normal uart. To tell it, try creating a folder (if you don&amp;#39;t already have it) called child_image, and in there, create a file called mcuboot.overlay, where you can enter the devicetree information that the bootloader needs to know about. Pretty much like it is done here, except that here it tells the mcuboot that it has external flash available.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/hellesvik-nordic/samples_for_nrf_connect_sdk/blob/main/bootloader_samples/nrf5340/mcuboot_smp_ble_simultaneous/child_image/mcuboot.overlay"&gt;https://github.com/hellesvik-nordic/samples_for_nrf_connect_sdk/blob/main/bootloader_samples/nrf5340/mcuboot_smp_ble_simultaneous/child_image/mcuboot.overlay&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;What you need to add into this file is to change the default zephyr,uart-mcumgr instance from &amp;amp;uart0 to &amp;amp;lpuart. I think it is done by adding:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/ {
	chosen {
		zephyr,uart-mcumgr = &amp;amp;lpuart;
	};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;in your child_image/mcuboot.overlay file.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HCI and MCUMGR on the same UART</title><link>https://devzone.nordicsemi.com/thread/509233?ContentTypeID=1</link><pubDate>Wed, 06 Nov 2024 12:37:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:87021cd6-5c28-4c44-ab70-c639f13c3b86</guid><dc:creator>tdfilip</dc:creator><description>&lt;p&gt;Could you tell me how to configure the uart so it can be used by both bt-uart and uart_mcumgr?&lt;/p&gt;
&lt;p&gt;I try to configure it like that:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;chosen {
	zephyr,bt-uart=&amp;amp;lpuart;
	zephyr,uart_mcumgr = &amp;amp;uart2;
};
	
&amp;amp;pinctrl {
    uart2_default_alt: uart2_default_alt {
    	group1 {
    		psels = &amp;lt;NRF_PSEL(UART_TX, 0, 18)&amp;gt;,
    				&amp;lt;NRF_PSEL(UART_RX, 0, 17)&amp;gt;;
    	};
    };
    
    uart2_sleep_alt: uart2_sleep_alt {
    	group1 {
    		psels = &amp;lt;NRF_PSEL(UART_TX, 0, 18)&amp;gt;,
    				&amp;lt;NRF_PSEL(UART_RX, 0, 17)&amp;gt;;
    		low-power-enable;
    	};
    };
};

&amp;amp;uart2 {
	current-speed = &amp;lt;250000&amp;gt;;
	status = &amp;quot;okay&amp;quot;;
	/delete-property/ hw-flow-control;

	pinctrl-0 = &amp;lt;&amp;amp;uart2_default_alt&amp;gt;;
	pinctrl-1 = &amp;lt;&amp;amp;uart2_sleep_alt&amp;gt;;
	pinctrl-names = &amp;quot;default&amp;quot;, &amp;quot;sleep&amp;quot;;
	lpuart: nrf-sw-lpuart {
		compatible = &amp;quot;nordic,nrf-sw-lpuart&amp;quot;;
		status = &amp;quot;okay&amp;quot;;
		req-pin = &amp;lt;20&amp;gt;;
		rdy-pin = &amp;lt;21&amp;gt;;
	};
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;That results in a secure fault right after the application start.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;EDIT&lt;/p&gt;
&lt;p&gt;I changed &lt;br /&gt;zephyr,uart_mcumgr = &amp;amp;uart2;&lt;br /&gt;to&lt;br /&gt;&lt;span&gt;zephyr,uart_mcumgr = &amp;amp;lpuart;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The application starts and bluetooth works. I then put HCI controller to mcuboot using another pin and I try to communicate over mcumgr but it doesn&amp;#39;t work. I keep receiving:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;lt;wrn&amp;gt; lpuart: req pin low when expected high
&amp;lt;err&amp;gt; lpuart: Empty receiver state:4
&amp;lt;wrn&amp;gt; lpuart: Tx timeout&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Do I have to manually make the&amp;nbsp;HCI stop using lpuart and mcumgr start using it?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HCI and MCUMGR on the same UART</title><link>https://devzone.nordicsemi.com/thread/509221?ContentTypeID=1</link><pubDate>Wed, 06 Nov 2024 11:18:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5f2f9856-a4c0-4043-b227-ec357dabcaa9</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello Filip,&lt;/p&gt;
&lt;p&gt;I remember that there was a lot more information on what you already did in this ticket. Unfortunately, I can only see that you edited the ticket 9 times, but I can&amp;#39;t see the information about what you took away.&lt;/p&gt;
&lt;p&gt;But if I understand you correctly, you want to change the GPIOs used by the UART, and you had some devicetree overlay files, right? That is at least the correct approach, to set up several pinctrl combinations, like uart0_default and uart0_sleep, similar to what I think you initially posted in this ticket.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;As for using the same UART instance for HCI and DFU, that is possible. But you need to tell the nRF52840 when to enter DFU mode somehow. One way to do this is to write a custom HCI command, and when the nRF52840 receives this, it knows that it should enter DFU mode (serial recovery mode). Another way is to use an additional pin that it can use to trigger DFU mode. This doesn&amp;#39;t require a custom HCI command and handler, but it requires an additional GPIO.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>