<?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 Interrput in Zephyr nRF9160</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/69531/uart-interrput-in-zephyr-nrf9160</link><description>Zephyr version: 2.4.99 
 OS: Linux 
 Board : nrf9160dk 
 
 I am trying to read data on UART 1 with interrupt. I have below shown portion in my code for enabling UART 1. (I am keeping UART0 for debugging, printk/printf) 
 
 DTS file has below change: </description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 17 Dec 2020 09:58:31 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/69531/uart-interrput-in-zephyr-nrf9160" /><item><title>RE: UART Interrput in Zephyr nRF9160</title><link>https://devzone.nordicsemi.com/thread/285561?ContentTypeID=1</link><pubDate>Thu, 17 Dec 2020 09:58:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9d8fdaf7-6bc4-4306-927b-b2037ac66ddd</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="Vishwas Jain"]I am using UART in interrupt mode so I don&amp;#39;t think I can use &lt;em&gt;uart_rx_enable()&lt;/em&gt;. As well there is no argument for setting buffer size in &lt;em&gt;uart_irq_rx_enable(). &lt;/em&gt; Is there any Kconfig for UART DMA buffer size? Or is there any workaround?[/quote]
&lt;p&gt;&amp;nbsp;Yes, you&amp;#39;re right. You have both&amp;nbsp;CONFIG_UART_ASYNC_API and&amp;nbsp;CONFIG_UART_INTERRUPT_DRIVEN set, and the interrupt driven mode will get priority and thus blocks the async library of being used.&lt;/p&gt;
&lt;p&gt;You can disable the uart interrupt driven configuration, and use async uart in a dedicated thread, or you can use the nrfx_uarte driver directly to receive &amp;gt; 1 byte per transaction.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART Interrput in Zephyr nRF9160</title><link>https://devzone.nordicsemi.com/thread/285262?ContentTypeID=1</link><pubDate>Wed, 16 Dec 2020 09:44:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4e3508b6-9314-4744-86d5-2879325933f9</guid><dc:creator>Vishwas Jain</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thank for replying.&lt;/p&gt;
&lt;p&gt;Now it is understandable why UART is not getting bound to legacy UART driver. I still have a question.&lt;/p&gt;
&lt;p&gt;I am using UART in interrupt mode so I don&amp;#39;t think I can use &lt;em&gt;uart_rx_enable()&lt;/em&gt;. As well there is no argument for setting buffer size in &lt;em&gt;uart_irq_rx_enable(). &lt;/em&gt; Is there any Kconfig for UART DMA buffer size? Or is there any workaround?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART Interrput in Zephyr nRF9160</title><link>https://devzone.nordicsemi.com/thread/285250?ContentTypeID=1</link><pubDate>Wed, 16 Dec 2020 09:07:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7000d4f9-d07f-4074-8d43-d4e0023d9116</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]Even though I give 350 as 3rd param in &lt;em&gt;uart_fifo_read()&lt;/em&gt;, it only reads 1 byte. This is due to read function implementation in &lt;em&gt;uart_nrfx_uarte.c&lt;/em&gt; file which gets bounded in device_get_binding. The function only reads 1 byte. How can I not bind &lt;em&gt;uart_nrfx_uarte.c&lt;/em&gt; ? How can I bind &lt;em&gt;uart_nrfx_uart.c &lt;/em&gt;which has implementation of reading multiple bytes. What are the Kconfigs for this? I tried defining &lt;em&gt;&amp;quot; compatible = &amp;quot;nordic,nrf-uart&amp;quot; &amp;quot;&amp;nbsp; &lt;/em&gt;in DTS file but did not work.[/quote]
&lt;p&gt;&amp;nbsp;If you do not set the buffer length in&amp;nbsp;uart_rx_enable() function, it will read only 1 byte.&lt;/p&gt;
&lt;p&gt;The function which it resolves to is this one, where the DMA buffer is set here:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/master/drivers/serial/uart_nrfx_uarte.c#L630"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/master/drivers/serial/uart_nrfx_uarte.c#L630&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The compatible = &amp;quot;nordic,nrf-uart&amp;quot; will not work with nRF53 or nRF9160, as it does not have the legacy NRF_UART peripheral, it has the NRF_UARTE (DMA capable) peripheral.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you do not want to use the zephyr uart driver, you can use the NRFX_UARTE driver directly instead, by setting CONFIG_NRFX_UARTE=y&amp;nbsp;and manually use the UARTE1 peripheral, similar to how the uart example in the nrf5 sdk is setup.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]I also observed that only partial data was received. I suspect that might be due to buffer size. How can I increase the buffer size. I can neither find API nor Kconfig for this.[/quote]
&lt;p&gt;This could be a side effect of the 1 byte DMA setup. Have you checked if the rx_len accumulates to the expected bytes to receive? In case there&amp;#39;s something that overwrites the buffer (ie: one of your threads taking more time compared to the uart interrupt function)&lt;/p&gt;
[quote user=""]There are some Kconfig like CONFIG_UART_NRFX_UARTE1 which are not given in &lt;a href="https://docs.zephyrproject.org/latest/reference/kconfig/index-all.html"&gt;Zephyr documentation&lt;/a&gt;. How can I know all other Kconfigs specific to nrf series Soc?[/quote]
&lt;p&gt;Kconfig is a descriptive language, and if you do not enable certain modules; it will not expose them in the menuconfig either. If you search in the &amp;quot;menuconfig&amp;quot;, you can see all available kconfig entries, but do note that there&amp;#39;s quite alot of them.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>