<?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>IO-Link driver using UARTE and EndTx event.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/50786/io-link-driver-using-uarte-and-endtx-event</link><description>I&amp;#39;m developing IO-Link driver using UARTE peripherial. 
 Is it possible to get event on end of transmition with EasyDMA Tx. Event ENDTX is fired before all transmited bytes are send. 
 
 Second question: Is it possible to disable Rx line while transmiting</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 14 Aug 2019 15:25:54 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/50786/io-link-driver-using-uarte-and-endtx-event" /><item><title>RE: IO-Link driver using UARTE and EndTx event.</title><link>https://devzone.nordicsemi.com/thread/204139?ContentTypeID=1</link><pubDate>Wed, 14 Aug 2019 15:25:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2284a1ca-972d-4080-872e-2db85b9bb7f5</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Would adding any hardcoded timing helps? Sorry that I&amp;#39;m not very familiar with IO-link.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: IO-Link driver using UARTE and EndTx event.</title><link>https://devzone.nordicsemi.com/thread/203744?ContentTypeID=1</link><pubDate>Tue, 13 Aug 2019 07:56:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5aa93cca-228b-46f7-8ba9-4f7cd89a765b</guid><dc:creator>robertfirma</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Yes, problem is that TXEND and TXDRDY are fired after last data bit and not after parity and stop bit witch is important in my situation.&lt;/p&gt;
&lt;p&gt;In IO-link and also in RS-485 communication you must enable transmiter before first byte was send (this is not a problem) and disable after all bits are sent including parity and stop bit.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: IO-Link driver using UARTE and EndTx event.</title><link>https://devzone.nordicsemi.com/thread/203629?ContentTypeID=1</link><pubDate>Mon, 12 Aug 2019 13:59:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d078621a-9f65-4fd5-8fc3-7571e4c8d145</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Robert,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I double checked the spec and it says:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;When all bytes in the TXD buffer, as specified in the TXD.MAXCNT register, have been transmitted, the&lt;/em&gt;&lt;br /&gt;&lt;em&gt;UARTE transmission will end automatically and an ENDTX event will be generated.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This meant the&amp;nbsp;&lt;span&gt;ENDTX&amp;nbsp;will be triggered after the last byte &lt;strong&gt;is clocked out. &lt;/strong&gt;Not when it&amp;#39;s transmitting.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;So ENDTX and the last TXDRDY will come at the same time. My last suggestion was wrong.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I did a logic trace here and it confirmed what in the spec:&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/745x128/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-88c7bbb1d6ab4828b98ec661663d6b93/pastedimage1565618039769v1.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;You can see that TXDRDY and ENDTX came at the same time. And they come after the last bit of the last byte is clocked. I&amp;#39;m not sure why in your question you mentioned &amp;quot;&amp;nbsp;&amp;nbsp;Event ENDTX is fired before all transmited bytes are send.&amp;quot;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: IO-Link driver using UARTE and EndTx event.</title><link>https://devzone.nordicsemi.com/thread/203429?ContentTypeID=1</link><pubDate>Sat, 10 Aug 2019 10:34:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8920a3e5-7025-4d83-8cc2-1f67617a9037</guid><dc:creator>robertfirma</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Yes, I do this sequence with ENDTX.&lt;/p&gt;
&lt;p&gt;1. Wait for ENDTX.&lt;/p&gt;
&lt;p&gt;2. Enable TXRDY interrupt and wait for them. But this interrupt never came.&lt;/p&gt;
&lt;p&gt;Regarding this picture I was shore that this interrupt came after ENDTX.&lt;/p&gt;
&lt;p&gt;Could you test, if this sequence work.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " height="202" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/Screenshot-2019_2D00_08_2D00_10-at-12.16.22.png" width="383" /&gt;&lt;/p&gt;
&lt;p&gt;Regarding this picture, I think that TXRDY interrupt must came after last stop bit was send.&lt;/p&gt;
&lt;p&gt;Is this true?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This is my interrupt service rutine. Code came only to EVENTS_ENDTX.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;inline void clNRF52Uart::isr (void)
{
	volatile u32_t dummy;
	volatile u32_t inten = port-&amp;gt;INTEN;

	/*if(port-&amp;gt;EVENTS_RXSTARTED){
		port-&amp;gt;EVENTS_RXSTARTED = 0;
		dummy = port-&amp;gt;EVENTS_RXSTARTED;
		//port-&amp;gt;RXD.PTR = (u32_t)buf1;
	}*/

	/*if(port-&amp;gt;EVENTS_RXDRDY){
		port-&amp;gt;EVENTS_RXDRDY = 0;
		dummy = port-&amp;gt;EVENTS_RXDRDY;
		//if(port-&amp;gt;EVENTS_ERROR == false){
			//port-&amp;gt;TASKS_FLUSHRX = 1;
			//LedBLUE-&amp;gt;OutToggle();
		//}
	}*/

	if(inten &amp;amp; (1&amp;lt;&amp;lt;17) ){
		if(port-&amp;gt;EVENTS_RXTO){
			port-&amp;gt;INTENCLR = (1&amp;lt;&amp;lt;17);
			port-&amp;gt;EVENTS_RXTO = 0;
			dummy = port-&amp;gt;EVENTS_RXTO;
			k_sem_give(&amp;amp;sem);
		}
	}

	if(inten &amp;amp; (1&amp;lt;&amp;lt;9) ){
		if(port-&amp;gt;EVENTS_ERROR){
			port-&amp;gt;INTENCLR = (1&amp;lt;&amp;lt;9);
			port-&amp;gt;EVENTS_ERROR = 0;
			dummy = port-&amp;gt;EVENTS_ERROR;
			comerr = port-&amp;gt;ERRORSRC;
			port-&amp;gt;ERRORSRC = comerr;
			port-&amp;gt;INTENSET = (1&amp;lt;&amp;lt;17);
			port-&amp;gt;TASKS_STOPRX = 1;
		}
	}

	if(inten &amp;amp; (1&amp;lt;&amp;lt;4) ){
		if(port-&amp;gt;EVENTS_ENDRX){
			port-&amp;gt;INTENCLR = (1&amp;lt;&amp;lt;4);
			port-&amp;gt;EVENTS_ENDRX = 0;
			dummy = port-&amp;gt;EVENTS_ENDRX;
			if(comerr == 0) k_sem_give(&amp;amp;sem);
			//q.Fire(&amp;amp;onrx, (void*)((u32_t)buf[0]));
		}
	}

	if(inten &amp;amp; (1&amp;lt;&amp;lt;20) ){
		if(port-&amp;gt;EVENTS_TXSTARTED){
			port-&amp;gt;INTENCLR = (1&amp;lt;&amp;lt;20);
			port-&amp;gt;EVENTS_TXSTARTED = 0;
			dummy = port-&amp;gt;EVENTS_TXSTARTED;
			//LedBLUE-&amp;gt;OutClr();
			//tc-&amp;gt;AlarmSet(txtime, 0, this);
		}
	}

	if(inten &amp;amp; (1&amp;lt;&amp;lt;7) ){
		if(port-&amp;gt;EVENTS_TXDRDY){
			port-&amp;gt;INTENCLR = (1&amp;lt;&amp;lt;7);
			port-&amp;gt;EVENTS_TXDRDY = 0;
			dummy = port-&amp;gt;EVENTS_TXDRDY;
			k_sem_give(&amp;amp;semtx);
		}
	}

	if(inten &amp;amp; (1&amp;lt;&amp;lt;8) ){
		if(port-&amp;gt;EVENTS_ENDTX){
			port-&amp;gt;INTENCLR = (1&amp;lt;&amp;lt;8);
			port-&amp;gt;EVENTS_ENDTX = 0;
			dummy = port-&amp;gt;EVENTS_ENDTX;

			port-&amp;gt;EVENTS_TXDRDY = 0;
			dummy = port-&amp;gt;EVENTS_TXDRDY;
			port-&amp;gt;INTENSET = (1&amp;lt;&amp;lt;7); // enable txdrdy
			//k_sem_give(&amp;amp;semtx);
			//tc-&amp;gt;AlarmSet(txtime, 0, this);
		}
	}

}

int clNRF52Uart::Write ( u8_t * Data , u16_t Size )
{
	port-&amp;gt;EVENTS_ENDTX = 0;
	volatile u32_t dummy = port-&amp;gt;EVENTS_ENDTX;
	port-&amp;gt;INTENSET = (1&amp;lt;&amp;lt;8); //enable endtx

	//txtime = tc-&amp;gt;TicksFrom_us(420);
	port-&amp;gt;TXD.PTR = (u32_t)Data;
	port-&amp;gt;TXD.MAXCNT = Size;
	port-&amp;gt;TASKS_STARTTX = 1;

	k_sem_take(&amp;amp;semtx, K_FOREVER);

	return port-&amp;gt;TXD.AMOUNT;
}
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: IO-Link driver using UARTE and EndTx event.</title><link>https://devzone.nordicsemi.com/thread/203343?ContentTypeID=1</link><pubDate>Fri, 09 Aug 2019 13:41:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:71423d29-fac8-43dc-a69a-1485c340f944</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Robert,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You are right, ENDTX comes when the last byte is being clocked out. But the TXDRDY event of the last byte should come after the byte is clocked. Maybe you can catch the TXDRDY after you receive ENDTX. It will be the TXDRDY of the last byte.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not aware of that RX buffer is being affected even TASK_STARTRX is not called. Is it possible to reproduce it using our example ? Have you made sure there is no PPI or SHORT that can trigger the task ?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>