<?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>How can I clear TXDRDY interrupt in uart?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/11320/how-can-i-clear-txdrdy-interrupt-in-uart</link><description>Hi,
I&amp;#39;m using nrf51822. After sending a data from TXD, I enable the TXDRDY interrupt by setting INTENSET register. Then I can get into TXDRDY interrupt handler function. But I don&amp;#39;t know how to clear the pending interrupt, then the interrupt handler</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 15 Jan 2016 02:43:16 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/11320/how-can-i-clear-txdrdy-interrupt-in-uart" /><item><title>RE: How can I clear TXDRDY interrupt in uart?</title><link>https://devzone.nordicsemi.com/thread/42582?ContentTypeID=1</link><pubDate>Fri, 15 Jan 2016 02:43:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:48a7d0b3-70aa-4bea-8edd-67197affc151</guid><dc:creator>leibin</dc:creator><description>&lt;p&gt;I got it! Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I clear TXDRDY interrupt in uart?</title><link>https://devzone.nordicsemi.com/thread/42581?ContentTypeID=1</link><pubDate>Fri, 15 Jan 2016 01:10:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e4509ca6-bb91-4392-bc7d-34cdb882927d</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;Well I assume the code which checks TXDREADY in the mbed library also clears the event and writes the next byte of data. You can&amp;#39;t both control it, either you&amp;#39;re handling the interrupt, writing the next load of data to transmit and clearing the event, or the mbed library is.&lt;/p&gt;
&lt;p&gt;If that event isn&amp;#39;t cleared by some piece of code, the interrupt will continue to fire until it is. Perhaps on interrupt you just need to call the mbed library which will then check the event, find it&amp;#39;s &amp;#39;1&amp;#39;, send out the next data and clear the event.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I clear TXDRDY interrupt in uart?</title><link>https://devzone.nordicsemi.com/thread/42580?ContentTypeID=1</link><pubDate>Thu, 14 Jan 2016 13:12:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1d970908-b67c-4ee6-8697-2a84a5eb381f</guid><dc:creator>leibin</dc:creator><description>&lt;p&gt;Hi RK,
Thanks for your quick reply!
I use mbed library for development. In the serial_write() API it checks if NRF_UART0-&amp;gt;EVENTS_TDXRDY == 1 firstly, if true then it&amp;#39;s writeable, else then will check it again and again until NRF_UART0-&amp;gt;EVENTS_TDXRDY becomes true. I think this checking it&amp;#39;s reasonable to avoid writing data into TXD before the previous data is sent out. If I add code NRF_UART0-&amp;gt;EVENTS_TDXRDY = 0 as you suggested, then the next serial_write()  calling will get into stuck on checking whether NRF_UART0-&amp;gt;EVENTS_TDXRDY  is true.&lt;/p&gt;
&lt;p&gt;Thanks,
BinLei&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I clear TXDRDY interrupt in uart?</title><link>https://devzone.nordicsemi.com/thread/42579?ContentTypeID=1</link><pubDate>Thu, 14 Jan 2016 11:04:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8bb8e686-b0af-4fb3-895d-38e2779fcdb3</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;You don&amp;#39;t need to clear the pending interrupt - the entry to the interrupt handler does that for you, you need to clear the task&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;NRF_UART0-&amp;gt;EVENTS_TDXRDY = 0
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can see this in the sample code too. Generally if an event is set up to generate an interrupt, the event needs to be cleared before you leave the interrupt handler or else it will trigger again.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>