<?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>UART Async and Interrupt on different peripherals</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/107776/uart-async-and-interrupt-on-different-peripherals</link><description>I have an nRF5340 and I need to run two different peripherals. One uses the Modbus driver, which requires CONFIG_UART_INTERRUPT_DRIVEN, and another I&amp;#39;m writing but would like to use CONFIG_UART_ASYNC_API. 
 The Zephyr UART library page has a large warning</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 15 Feb 2024 23:54:34 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/107776/uart-async-and-interrupt-on-different-peripherals" /><item><title>RE: UART Async and Interrupt on different peripherals</title><link>https://devzone.nordicsemi.com/thread/469138?ContentTypeID=1</link><pubDate>Thu, 15 Feb 2024 23:54:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:99aaffee-e74b-447f-a424-7b7d360abd26</guid><dc:creator>Kyle</dc:creator><description>&lt;p&gt;Yep, so you can look them up if you already know about them, but they&amp;#39;re not documented anywhere that you would learn about them if you&amp;#39;re trying to solve this issue. I discovered them in digging through source code in the nRF Connect SDK.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART Async and Interrupt on different peripherals</title><link>https://devzone.nordicsemi.com/thread/468962?ContentTypeID=1</link><pubDate>Thu, 15 Feb 2024 09:17:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c9701b25-f624-4dd3-8bba-ecc7a0ead1a3</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Good work finding those configs,&lt;/p&gt;
&lt;p&gt;They are documented in the KConfig references documentation:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.2.0/kconfig/index.html#CONFIG_UART_ASYNC_API"&gt;CONFIG_UART_ASYNC_API&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.2.0/kconfig/index.html#CONFIG_UART_INTERRUPT_DRIVEN"&gt;CONFIG_UART_INTERRUPT_DRIVEN&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.2.0/kconfig/index.html#CONFIG_UART_0_ASYNC"&gt;CONFIG_UART_0_ASYNC&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.2.0/kconfig/index.html#CONFIG_UART_0_INTERRUPT_DRIVEN"&gt;CONFIG_UART_0_INTERRUPT_DRIVEN&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.2.0/kconfig/index.html#CONFIG_UART_1_INTERRUPT_DRIVEN"&gt;CONFIG_UART_1_INTERRUPT_DRIVEN&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.2.0/kconfig/index.html#CONFIG_UART_1_ASYNC"&gt;CONFIG_UART_1_ASYNC&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I agree that they should probably be mentioned in the documentation of the library somewhere,&lt;/p&gt;
&lt;p&gt;regards&lt;/p&gt;
&lt;p&gt;Jared&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART Async and Interrupt on different peripherals</title><link>https://devzone.nordicsemi.com/thread/468718?ContentTypeID=1</link><pubDate>Tue, 13 Feb 2024 22:28:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c50b8cca-2e81-4790-96a7-261e26e1b933</guid><dc:creator>Kyle</dc:creator><description>&lt;p&gt;Yes, I had the second UART enabled.&lt;/p&gt;
&lt;p&gt;I found the issue. It requires using these Kconfig options:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;# Enable both APIs
CONFIG_UART_ASYNC_API=y
CONFIG_UART_INTERRUPT_DRIVEN=y

# Flag UART0 as not ASYNC, but INTERRUPT
CONFIG_UART_0_ASYNC=n
CONFIG_UART_0_INTERRUPT_DRIVEN=y

# Flag UART1 as not INTERRUPT, but ASYNC
CONFIG_UART_1_INTERRUPT_DRIVEN=n
CONFIG_UART_1_ASYNC=y&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This tells it which APIs to use on which peripherals.&lt;/p&gt;
&lt;p&gt;These CONFIG_UART_# Kconfigs don&amp;#39;t seem to be documented anywhere and I only found them in digging through the source code. They&amp;#39;re part of the nRF Connect SDK, not Zephyr, so they should be documented by Nordic.&lt;/p&gt;
&lt;p&gt;Unless I&amp;#39;m missing where they&amp;#39;re already documented, in which case a link would be appreciated.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART Async and Interrupt on different peripherals</title><link>https://devzone.nordicsemi.com/thread/468376?ContentTypeID=1</link><pubDate>Mon, 12 Feb 2024 10:35:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f9d4cdbf-2844-49fd-9da5-cc2033b826b1</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Looking at the dts of the developer academy lesson 5, I see that only 1 instance of the UART peripheral has been enabled, namely UART0. Adding&amp;nbsp;CONFIG_UART_INTERRUPT_DRIVEN=y while&amp;nbsp;&lt;span&gt;CONFIG_UART_ASYNC_API=y already being defined will&amp;nbsp;violate the requirement of never using both for the same hw peripheral.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Did you enable another UART instance already?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;regards&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Jared&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART Async and Interrupt on different peripherals</title><link>https://devzone.nordicsemi.com/thread/467985?ContentTypeID=1</link><pubDate>Wed, 07 Feb 2024 22:43:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6c27ece7-f2f5-4a36-ba19-b6f67f9bf659</guid><dc:creator>Kyle</dc:creator><description>&lt;p&gt;Hi Jared,&lt;/p&gt;
&lt;p&gt;The simplest example is actually the &lt;a href="https://github.com/NordicDeveloperAcademy/ncs-fund/tree/main/v2.x.x/lesson5/fund_less5_exer1_solution"&gt;Developer Academy Lesson 5&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;If you add&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_UART_INTERRUPT_DRIVEN=y&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;to proj.conf, the `uart_callback_set` function (&lt;a href="https://github.com/NordicDeveloperAcademy/ncs-fund/blob/4620f4f4b19f9a68e8af6966dc5b9399b5e4a718/v2.x.x/lesson5/fund_less5_exer1_solution/src/main.c#L124"&gt;this line&lt;/a&gt;) will start returning a -ENOSYS (which, according to the &lt;a href="https://docs.zephyrproject.org/latest/hardware/peripherals/uart.html#c.uart_callback_set"&gt;documentation&lt;/a&gt;, means it &amp;quot;is not supported by the device&amp;quot;.&lt;/p&gt;
&lt;p&gt;After re-reading the Zephyr documentation, it says that you should only not use both&amp;nbsp;&lt;strong&gt;for the same hardware peripheral&lt;/strong&gt;. So, it seems that using both `CONFIG_UART_INTERRUPT_DRIVEN` and `CONFIG_UART_ASYNC_API` should be supported, yet it returns this error.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART Async and Interrupt on different peripherals</title><link>https://devzone.nordicsemi.com/thread/466444?ContentTypeID=1</link><pubDate>Mon, 29 Jan 2024 10:40:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7ca828c6-558d-4b0a-8ced-e4090e235e77</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;From our developers:&lt;em&gt;&amp;nbsp;&lt;span dir="ltr"&gt;when i greped zephyr code i see that UARTE driver is not using &lt;code&gt;CONFIG_UART_EXCLUSIVE_API_CALLBACKS&lt;/code&gt; at all, only UART (legacy peripheral present in nrf51/2). So I am not sure why run time error is seen.&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;span dir="ltr"&gt;Do you have a small example that you could share which would reproduce this?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span dir="ltr"&gt;regards&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span dir="ltr"&gt;Jared&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART Async and Interrupt on different peripherals</title><link>https://devzone.nordicsemi.com/thread/466265?ContentTypeID=1</link><pubDate>Fri, 26 Jan 2024 14:43:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4f8437ec-c93f-41df-9b4d-9a47562d8424</guid><dc:creator>Kyle</dc:creator><description>&lt;p&gt;No, I get runtime errors. When I try to add a UART callback (for async), it returns an error saying that the API is not supported on this system.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART Async and Interrupt on different peripherals</title><link>https://devzone.nordicsemi.com/thread/466182?ContentTypeID=1</link><pubDate>Fri, 26 Jan 2024 10:13:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:66549426-dbba-41ac-9764-fd83a86ccbe4</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;If you&amp;#39;re using two different UART instances for each, then it should be ok.&lt;/p&gt;
&lt;p&gt;Are you getting any build time errors when you do that, since you asked about disabling &lt;span&gt;CONFIG_UART_EXCLUSIVE_API_CALLBACKS&amp;nbsp;&lt;/span&gt;?&lt;/p&gt;
&lt;p&gt;regards&lt;br /&gt;Jared&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>