<?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>nRF51822 PCA10001 uart RX interrupt does not trigger</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/1003/nrf51822-pca10001-uart-rx-interrupt-does-not-trigger</link><description>Hello, 
 I am trying to get the RX interrupt to trigger on the PCA10001 board using the segger debugger as my serial terminal. 
 My hardware setup consists of a PCA10001 connected to a windows PC and using teraterm pro as my serial terminal program</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 02 Feb 2019 08:44:28 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/1003/nrf51822-pca10001-uart-rx-interrupt-does-not-trigger" /><item><title>RE: nRF51822 PCA10001 uart RX interrupt does not trigger</title><link>https://devzone.nordicsemi.com/thread/169148?ContentTypeID=1</link><pubDate>Sat, 02 Feb 2019 08:44:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ffff1b70-d54e-491b-85d5-976613ddba2c</guid><dc:creator>Maunik Patel</dc:creator><description>&lt;p&gt;Thank you very much for this post, bart.&lt;br /&gt;It helped me to resolve issue while receiving data in non-blocking mode.&lt;br /&gt;In my case, I want to transmit the same data received from UART (ending with &amp;#39;\n&amp;#39; or &amp;#39;\r&amp;#39;).&lt;br /&gt;But some how, my code transmits only 1st byte from the butter and it doesn&amp;#39;t generate&amp;nbsp;EVENTS_TXDRDY event.&lt;br /&gt;Can you help to solve it?&lt;br /&gt;&lt;br /&gt;Other configurations are same except the Flow control. I am not using it.&lt;br /&gt;&lt;br /&gt;UART0_IRQHandler(),&amp;nbsp;simple_uart_put() and&amp;nbsp;simple_uart_get() are as below:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;uint8_t simple_uart_get(void)
{
    /*
      while (NRF_UART0-&amp;gt;EVENTS_RXDRDY != 1)
      {
        // Wait for RXD data to be received
      }
    */
  NRF_UART0-&amp;gt;EVENTS_RXDRDY = 0;
  return (uint8_t)NRF_UART0-&amp;gt;RXD;
}

void simple_uart_put(uint8_t data)
{
    /*
      while (NRF_UART0-&amp;gt;EVENTS_TXDRDY != 1)
      {
        // Wait for TXD data to be transmitted
      }
    */  
  NRF_UART0-&amp;gt;EVENTS_TXDRDY = 0;
  NRF_UART0-&amp;gt;TXD = data;
}

void UART0_IRQHandler(void)
{ 

	if(NRF_UART0-&amp;gt;EVENTS_RXDRDY == 1){
		uart_buffer[uart_buf_head] = simple_uart_get();
		uart_buf_head++;
		if(uart_buffer[uart_buf_head-1] == &amp;#39;\r&amp;#39; || uart_buffer[uart_buf_head-1] == &amp;#39;\n&amp;#39;){
			NRF_UART0-&amp;gt;TASKS_STOPRX = 1;
			NRF_UART0-&amp;gt;TASKS_STARTTX = 1;
			simple_uart_put(uart_buffer[uart_buf_tail]);
			uart_buf_tail++;
		}
		if(uart_buf_head &amp;gt; UART_BUF_SIZE)
			uart_buf_head = 0;
	}
	
	if(NRF_UART0-&amp;gt;EVENTS_TXDRDY == 1){
		simple_uart_put(uart_buffer[uart_buf_tail]);
		uart_buf_tail++;
		if((uart_buf_tail &amp;gt; UART_BUF_SIZE) || (uart_buf_tail &amp;gt; uart_buf_head)){
			NRF_UART0-&amp;gt;TASKS_STOPTX = 0;
			uart_buf_head = uart_buf_tail = 0;
			NRF_UART0-&amp;gt;TASKS_STARTRX = 1;
		}
	}
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF51822 PCA10001 uart RX interrupt does not trigger</title><link>https://devzone.nordicsemi.com/thread/4741?ContentTypeID=1</link><pubDate>Mon, 03 Mar 2014 17:52:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8fc15bbc-a79a-47ef-9840-79d7780cfdc5</guid><dc:creator>Erik Sanchez</dc:creator><description>&lt;p&gt;bart,&lt;/p&gt;
&lt;p&gt;Thanks for posting the very clearly defined problem and then answering with your solution!  It has helped me get my UART interface up and running.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF51822 PCA10001 uart RX interrupt does not trigger</title><link>https://devzone.nordicsemi.com/thread/4740?ContentTypeID=1</link><pubDate>Wed, 27 Nov 2013 16:30:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:33c4964b-b37c-454c-8b3c-e632b14d79af</guid><dc:creator>bart</dc:creator><description>&lt;p&gt;@Ole Morten&lt;/p&gt;
&lt;p&gt;You are right, these calls where made before enabling the softdevice. Typical case of &amp;quot;user has not read spec&amp;quot; error ;-). Good thing that the softdevice preserves setup NVIC and ISR when being enabled.&lt;/p&gt;
&lt;p&gt;Will be adding the checks from now on with all softdevice functions.&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF51822 PCA10001 uart RX interrupt does not trigger</title><link>https://devzone.nordicsemi.com/thread/4739?ContentTypeID=1</link><pubDate>Wed, 27 Nov 2013 16:24:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9ca61106-35e9-4541-8843-257ee65bbec2</guid><dc:creator>Ole Morten</dc:creator><description>&lt;p&gt;Great that you found the solution on your own! You may have use in reading this for information on the differences between sd_nvic_* and NVIC_&lt;em&gt;: &lt;a target="_blank" href="https://devzone.nordicsemi.com/index.php/use-app_gpiote-with-softdevice" rel="nofollow"&gt;https://devzone.nordicsemi.com/index.php/use-app_gpiote-with-softdevice&lt;/a&gt;
Note especially that the sd_nvic_&lt;/em&gt; API is only available when the softdevice is enabled.&lt;/p&gt;
&lt;p&gt;In general, you should also always make sure to check error codes on your softdevice call, in which case I guess you would have gotten back NRF_ERROR_SOFTDEVICE_NOT_ENABLED with your original code. :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF51822 PCA10001 uart RX interrupt does not trigger</title><link>https://devzone.nordicsemi.com/thread/4738?ContentTypeID=1</link><pubDate>Wed, 27 Nov 2013 16:19:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:53cab9c1-990c-4f0f-9f3d-4b89743ea232</guid><dc:creator>bart</dc:creator><description>&lt;p&gt;After verifying that the characters are really sent by the segger uart chip. I was a bit stumped so I went back to the btle app uart example provided on devzone. After a command by command example I noticed that the only difference was the interrupt initialization:&lt;/p&gt;
&lt;p&gt;Old:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
	sd_nvic_SetPriority(UART0_IRQn, APP_IRQ_PRIORITY_LOW);
	sd_nvic_EnableIRQ(UART0_IRQn);

&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;New:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
	NVIC_SetPriority(UART0_IRQn, APP_IRQ_PRIORITY_LOW);
        NVIC_EnableIRQ(UART0_IRQn);

&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Changing this did the trick!&lt;/p&gt;
&lt;p&gt;I always assumed that touching peripherals that the softdevice stack uses needed to be done via the sd_$peripheral functions to prevent conflicts. In the btle app uart example this is done. Is my assumption incorrect? Or does this only hold for interrupts used by the softdevice (that you are not supposed to touch)? Any idea what I did wrong?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>