<?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>Using UARTE - eDMA</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/89288/using-uarte---edma</link><description>Hi guys, 
 I am currently trying to make my uart work with eDMA functionality. 
 Up to this point I am able to read using polling, and as second method using IRQ with a message queue. 
 Unfortunately I could not find any concrete examples regarding eDMA</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 07 Jul 2022 12:16:23 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/89288/using-uarte---edma" /><item><title>RE: Using UARTE - eDMA</title><link>https://devzone.nordicsemi.com/thread/376005?ContentTypeID=1</link><pubDate>Thu, 07 Jul 2022 12:16:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:77655c9a-0c23-4e33-b0b7-83072211a7d2</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
[quote user="DorianN"]So what we are trying to do is get the data from the UART with DMA without involving the cpu at all. Our next step would be to feed that data to I2C using also DMA.[/quote]
&lt;p&gt;Yes, this is possible to do, but I am a bit uncertain about what you mean &amp;quot;without involving the cpu at all&amp;quot;. Could you explain this? Because the processor will at least be involved in setting up and controlling in and output to the peripherals&lt;/p&gt;
[quote user="DorianN"]You pointed out that both are using DMA right?[/quote]
&lt;p&gt;Yes, Nordic UART Service (NUS), which the samples are based on, uses UART with eDMA by default.&lt;/p&gt;
[quote user="DorianN"]Is the async architecture required for DMA[/quote]
&lt;p&gt;It is not a requirement for DMA, but it is for UART (Universal asynchronous receiver-transmitter)&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using UARTE - eDMA</title><link>https://devzone.nordicsemi.com/thread/375747?ContentTypeID=1</link><pubDate>Wed, 06 Jul 2022 11:08:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2e381e0e-e047-45fa-8205-0f54b169bfaf</guid><dc:creator>DorianN</dc:creator><description>&lt;p&gt;Hey Andreas,&lt;/p&gt;
&lt;p&gt;I started checking the 2 examples you pointed me to, central and peripheral_uart. The are quite different. The peripheral_art uses the async implementation and quite more complex than the central example.&lt;/p&gt;
&lt;p&gt;You pointed out that both are using DMA right? What would be a better starting point? Is the async architecture required for DMA or it could be done the same way as the central example?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using UARTE - eDMA</title><link>https://devzone.nordicsemi.com/thread/375465?ContentTypeID=1</link><pubDate>Tue, 05 Jul 2022 07:57:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:463fd1c9-8fce-40d6-95f3-28cc0b529eb3</guid><dc:creator>DorianN</dc:creator><description>&lt;p&gt;Hi Andreas,&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Thanks for getting back to me.&lt;br /&gt;So what we are trying to do is get the data from the UART with DMA without involving the cpu at all. Our next step would be to feed that data to I2C using also DMA.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;void zedF9_write_queue_cb(const struct device *dev, void *user_data)
{
	uint8_t cnt = 0;
	// current char
	uint8_t cc;
	struct DataPack *dp = user_data;

	if(!uart_irq_update(dev)) {
		return;
	}

	while (uart_irq_rx_ready(dev)) {
		uart_fifo_read(dev, &amp;amp;cc, 1);

		uint16_t cnt = dp-&amp;gt;buffer_pos;
		char cp = 0;

		//if(cnt &amp;gt; 0)
		//	cp = dp-&amp;gt;buffer[dp-&amp;gt;buffer_pos - 1];

		if ((cc  == &amp;#39;\n&amp;#39;)) {
			/* terminate string */
			dp-&amp;gt;buffer[dp-&amp;gt;buffer_pos    ] = cc;
			dp-&amp;gt;buffer[dp-&amp;gt;buffer_pos + 1] =  0;
			k_msgq_put(&amp;amp;(dp-&amp;gt;z9_queue), dp-&amp;gt;buffer, K_NO_WAIT);
			dp-&amp;gt;buffer_pos = 0;
		} 
		else if(dp-&amp;gt;buffer_pos &amp;lt; (sizeof(dp-&amp;gt;buffer) - 1)) {
			dp-&amp;gt;buffer[dp-&amp;gt;buffer_pos++] = cc;
		}
	}
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;This is the code we are using currently. Fairly simple we just put the characters to a message queue and consume them in another function (main). This method works fine no issues whatsoever. We just wanted to see if it&amp;#39;s possible to do the same with DMA passing from memory to memory -- UART to I2C&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using UARTE - eDMA</title><link>https://devzone.nordicsemi.com/thread/375045?ContentTypeID=1</link><pubDate>Fri, 01 Jul 2022 10:32:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2573e88e-4d44-4489-a28e-4d3c3cee8dcb</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;Apologies for the delay in answer time. We are currently in the main summer vacation period here in Norway so we are running with a reduced support staff which might cause some increase in answer time&lt;/p&gt;
&lt;p&gt;On newer devices such as the nRF5340 or nRF9160 UARTE (UART with eDMA) is the default UART peripheral, and non-eDMA does not exist. Every sample in NCS that uses the uart, such as the&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/bluetooth/central_uart/README.html"&gt;central_uart&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/bluetooth/peripheral_uart/README.html?highlight=peripheral_uart"&gt;peripheral_uart&lt;/a&gt;&amp;nbsp;contains board files that sets up the sample such that the UARTE peripheral is used. Thus for the nRF5340DK, which you are using, every sample is using UARTE. If you want to use it without eDMA (Only for 52-devices or older), you can follow what Heidi explains in the ticket I linked in a previous reply.&lt;/p&gt;
&lt;p&gt;I recommend that you examine those two samples, and if you have 2 boards/a board and a phone you can test them.&lt;/p&gt;
[quote user=""]I tried something psoted 3 years ago but it doesn&amp;#39;t seem to work.[/quote]
&lt;p&gt;The thing you tried which were posted 3 years ago might be out of date. Can you link or explain what you tried? It could be that the API/documentation you were following does not apply at all&lt;/p&gt;
[quote user=""]I am not crashing anything but the callback doesn&amp;#39;t seem to trigger.[/quote]
&lt;p&gt;Can you attach the code you have written for this?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using UARTE - eDMA</title><link>https://devzone.nordicsemi.com/thread/374795?ContentTypeID=1</link><pubDate>Wed, 29 Jun 2022 16:42:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3366c5f2-3b58-4d7a-8078-f453b26f9246</guid><dc:creator>DorianN</dc:creator><description>&lt;p&gt;Hi Andreas,&lt;/p&gt;
&lt;p&gt;Thanks for the help!&lt;/p&gt;
&lt;p&gt;Let me know when/if you find something.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using UARTE - eDMA</title><link>https://devzone.nordicsemi.com/thread/374786?ContentTypeID=1</link><pubDate>Wed, 29 Jun 2022 14:59:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6a712431-904b-4bab-8909-1e83be191be8</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;It looks like you are correct. I jumped some hoops when referring to the case in my previous answer, which says &amp;quot;&lt;strong&gt;&lt;/strong&gt;UART &lt;strong&gt;without&lt;/strong&gt; easyDMA is not available on the nRF9160 or nRF5340&amp;quot;, and not the other way around. I will have to do some more digging into your case and I will come back before the weekend with a more definite answer!&lt;br /&gt;&lt;br /&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using UARTE - eDMA</title><link>https://devzone.nordicsemi.com/thread/374748?ContentTypeID=1</link><pubDate>Wed, 29 Jun 2022 13:19:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:62a9ee51-99cc-4a76-8da9-77dce9278800</guid><dc:creator>DorianN</dc:creator><description>&lt;p&gt;Hi Andreas,&lt;/p&gt;
&lt;p&gt;So the nRF5340 doesn&amp;#39;t offer any kind of DMA?&lt;/p&gt;
&lt;p&gt;The thing is that under the documentation eDMA is listed under the following:&lt;/p&gt;
&lt;div class="help_breadcrumbs"&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/struct_nrf53/struct/nrf53.html"&gt;nRF53 Series&lt;/a&gt; &amp;gt; &lt;a href="https://infocenter.nordicsemi.com/topic/struct_nrf53/struct/nrf5340.html"&gt;nRF5340&lt;/a&gt; &amp;gt; &lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf5340/keyfeatures_html5.html"&gt;nRF5340 Product Specification&lt;/a&gt; &amp;gt; &lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf5340/chapters/soc_overview/doc/instantiation.html"&gt;Peripherals&lt;/a&gt;&lt;/div&gt;
&lt;div class="help_breadcrumbs"&gt;&lt;/div&gt;
&lt;div class="help_breadcrumbs"&gt;So now I am a bit confused whether it really does or not. If it does not then the data we get will be parsed by the CPU.&lt;/div&gt;
&lt;div class="help_breadcrumbs"&gt;Otherwise eDMA would be really handy&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using UARTE - eDMA</title><link>https://devzone.nordicsemi.com/thread/374167?ContentTypeID=1</link><pubDate>Fri, 24 Jun 2022 13:09:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:962ee936-5707-4fa2-89a0-b485764f6260</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Is it correct that you are developing for nRF5340? To my knowledge, eDMA is not available for the nRF5340 and the nRF9160 (&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/77652/with-nrf-connect-sdk-how-to-i-change-uart0-to-nrf-uart-without-easydma"&gt;see this related case)&lt;/a&gt;. In case you are developing for a 52 nRF52 series chip, eDMA is available, and that ticket should lead you towards your destination.&lt;/p&gt;
&lt;p&gt;Let me know if this answers your question!&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>