<?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>Losing uart characters - activating UART in place of UARTE in nRF52840</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/105313/losing-uart-characters---activating-uart-in-place-of-uarte-in-nrf52840</link><description>I am receiving characters on the UART of nRF52840. In my application I receive characters at 115 kbaud. As I must inspect each character I set the the receive buffer size to 1 so I receive an interrupt for each character received. I then set a flag of</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 13 Nov 2023 16:01:52 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/105313/losing-uart-characters---activating-uart-in-place-of-uarte-in-nrf52840" /><item><title>RE: Losing uart characters - activating UART in place of UARTE in nRF52840</title><link>https://devzone.nordicsemi.com/thread/455383?ContentTypeID=1</link><pubDate>Mon, 13 Nov 2023 16:01:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:98c86450-159d-43d9-9a5f-304b38b31c23</guid><dc:creator>Malcolm</dc:creator><description>&lt;p&gt;Thank you. I figured that there was a timer conflict and experimented with different values and settled on RTC2 and TIMER2. I have made some progress, although I now receive a hard fault. I will look at your links to see if there is an answer.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Losing uart characters - activating UART in place of UARTE in nRF52840</title><link>https://devzone.nordicsemi.com/thread/455366?ContentTypeID=1</link><pubDate>Mon, 13 Nov 2023 15:06:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f25ea1a0-9940-41b2-9ddd-d48ef5ff7e58</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;How did you configure libuarte? The sample does not use the SoftDevice and use&amp;nbsp;instances that are not allowed in an application that use it. So you should pick another timer than TIMER0, and also avoid both RTC0 (SoftDevice) and RTC1 (app timer). See &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/67204/use-libuarte-together-with-softdevice/275147"&gt;this post&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Losing uart characters - activating UART in place of UARTE in nRF52840</title><link>https://devzone.nordicsemi.com/thread/455236?ContentTypeID=1</link><pubDate>Mon, 13 Nov 2023 07:39:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0a47becb-7e5f-4362-94f8-4c447e3ae3c2</guid><dc:creator>Malcolm</dc:creator><description>&lt;p&gt;I have ported LIBUARTE into my application and it is now working when I test the uart in isolation, However when I enable the BLE stack I receive an initialisation error of 0x1001, which indicates a NRF_ERROR_SDM_INCORRECT_INTERRUPT_CONFIGURATION. As I am using the default values from LIBUART and ble init, what would cause this conflict and how to correct?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Losing uart characters - activating UART in place of UARTE in nRF52840</title><link>https://devzone.nordicsemi.com/thread/454597?ContentTypeID=1</link><pubDate>Wed, 08 Nov 2023 08:42:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:289a41a4-5811-40fe-b504-55521563fcd5</guid><dc:creator>Malcolm</dc:creator><description>&lt;p&gt;I appear to have encountered a second problem with missing interrupts and characters. I am sure there is not hardware FIFO for the uarte, rather it relies on direct DMA transfer to a buffer. In my case I must process every incoming character. Therefore I will need to ensure that DMA double buffering is configured. I will try libuart to determine if it is a fix.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Losing uart characters - activating UART in place of UARTE in nRF52840</title><link>https://devzone.nordicsemi.com/thread/454513?ContentTypeID=1</link><pubDate>Tue, 07 Nov 2023 14:59:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f40d05d8-8431-4509-81fa-69a76dbb1511</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;I see. I am not able to say what the issue is based on what I know, but an important limitation of the serial port library you are using is that it does not do EasyDMA double buffering. So when the buffer is full, you get a&amp;nbsp;NRF_SERIAL_EVENT_RX_DATA event, and only after that has been handled the library start Rx again (using the same old Rx buffer). You can see this from the&amp;nbsp;implementation of&amp;nbsp;uart_event_handler() in nrf_serial.c. So if you spend too long time&amp;nbsp;handling the received bytes, or something else prevents the library from starting Rx again, you can loose incoming data. (This is one of the things that has improved in libuarte).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Losing uart characters - activating UART in place of UARTE in nRF52840</title><link>https://devzone.nordicsemi.com/thread/454142?ContentTypeID=1</link><pubDate>Mon, 06 Nov 2023 10:00:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b99e9bdb-db37-4510-bf3d-147925c9c6e3</guid><dc:creator>Malcolm</dc:creator><description>&lt;p&gt;Hi Einor&lt;/p&gt;
&lt;p&gt;Whilst there may be isues in V16 I have not encountered, and we are close to release of software for a pjoect so I do not want to do a complete migration to a new version unless absolutely essential as I have hacked some of the code.&lt;/p&gt;
&lt;p&gt;The issue that remains appears to be that characters are not being buffered in a FIFO and are lost or corrupted by missing parts. I can send an image of a capture from a scope that best illustrates. I cannot upload the image as it pdf file and not allowed.&lt;/p&gt;
&lt;p&gt;I think the main issue for me is that code somewhere disables interrupts for an extended period, and I must find and solve that problem.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Losing uart characters - activating UART in place of UARTE in nRF52840</title><link>https://devzone.nordicsemi.com/thread/454131?ContentTypeID=1</link><pubDate>Mon, 06 Nov 2023 09:20:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c4042624-7a11-4b8c-b09c-10c3e6b19cb8</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Malcolm,&lt;/p&gt;
&lt;p&gt;Ah, I see. That is why I did not find this. The Serial port library has some issues and was removed from SDK 17.x.x. I would recommend that you use &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/lib_libuarte.html?cp=9_5_1_3_27"&gt;libuarte&lt;/a&gt; instead, which is it&amp;#39;s replacement. This is also present in SDK 16 (though I would consider migrating to 17.1.0).&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Losing uart characters - activating UART in place of UARTE in nRF52840</title><link>https://devzone.nordicsemi.com/thread/454020?ContentTypeID=1</link><pubDate>Fri, 03 Nov 2023 15:20:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8b1e314c-2a8f-4bd8-990e-2d811f24f97c</guid><dc:creator>Malcolm</dc:creator><description>&lt;p&gt;The code is from SDK 16&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Losing uart characters - activating UART in place of UARTE in nRF52840</title><link>https://devzone.nordicsemi.com/thread/454019?ContentTypeID=1</link><pubDate>Fri, 03 Nov 2023 15:18:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:22c7233f-f7de-48d2-99d9-2761641dd658</guid><dc:creator>Malcolm</dc:creator><description>&lt;p&gt;I have done a scope capture of the issue to explain the problem, but I do not know how I can upload.&lt;/p&gt;
&lt;p&gt;In the trace the first character is missed altogether. I receive 6 characters, but there are only 5 interrupts.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Losing uart characters - activating UART in place of UARTE in nRF52840</title><link>https://devzone.nordicsemi.com/thread/453976?ContentTypeID=1</link><pubDate>Fri, 03 Nov 2023 13:12:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:efae2083-eac9-4d27-a67f-c971d4721008</guid><dc:creator>Malcolm</dc:creator><description>&lt;p&gt;This is library code from Nordic. I add the full initialisation. I do not recall where this comes from originally, but it remains in the Nordic library.&lt;/p&gt;
&lt;p&gt;This code appears to work by accepting writes to the FIFO (circular buffer) and then copies into the BUFF_TX (linear buffer) for transmission. RX is similar and on an interrupt incoming characters are written to the FIFO_RX and can be taken out by a scheduled task - this keeps the interrupt routine short and allows interrupts to be reenabled.&lt;/p&gt;
&lt;p&gt;I am happy that this works as intended, except that it misses some characters when interrupts are disabled. I was expecting characters to be buffered in the FIFO and be released when interrupts are re-enabled.&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Malcolm&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;define RTS_PIN_DISCONNECTED NRF_UART_PSEL_DISCONNECTED&lt;br /&gt;#define&amp;nbsp;&amp;nbsp; &amp;nbsp;CTS_PIN_DISCONNECTED NRF_UART_PSEL_DISCONNECTED&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;static void readGprsByteEvent(void * p_event_data, uint16_t event_size);&lt;br /&gt;static void writeGprsConfirm();&lt;br /&gt;static void gprsUartEventHandler(struct nrf_serial_s const * p_serial,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nrf_serial_event_t event);&lt;br /&gt;&lt;br /&gt;#define SERIAL_GPRS_FIFO_TX_SIZE 64&lt;br /&gt;#define SERIAL_GPRS_FIFO_RX_SIZE 64&lt;br /&gt;&lt;br /&gt;NRF_SERIAL_QUEUES_DEF(serial_gprs_queues, SERIAL_GPRS_FIFO_TX_SIZE, SERIAL_GPRS_FIFO_RX_SIZE);&lt;br /&gt;&lt;br /&gt;#define SERIAL_GPRS_BUFF_TX_SIZE 16&lt;br /&gt;#define SERIAL_GPRS_BUFF_RX_SIZE 1&lt;br /&gt;&lt;br /&gt;NRF_SERIAL_BUFFERS_DEF(serial_gprs_buffs, SERIAL_GPRS_BUFF_TX_SIZE, SERIAL_GPRS_BUFF_RX_SIZE);&lt;br /&gt;&lt;br /&gt;NRF_SERIAL_CONFIG_DEF(serial_gprs_config, NRF_SERIAL_MODE_DMA,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;serial_gprs_queues, &amp;amp;serial_gprs_buffs, gprsUartEventHandler, NULL);&lt;br /&gt;&lt;br /&gt;#define UART_GPRS_INSTANCE_NUMBER 0&lt;br /&gt;&lt;br /&gt;NRF_SERIAL_UART_DEF(serial_gprs_uart, UART_GPRS_INSTANCE_NUMBER);&lt;br /&gt;&lt;br /&gt;#define GPRS_UART_CONFIG_IRQ_PRIORITY UART_DEFAULT_CONFIG_IRQ_PRIORITY&lt;br /&gt;&lt;br /&gt;//#define GPRS_UART_CONFIG_IRQ_PRIORITY 2&lt;br /&gt;&lt;br /&gt;static volatile bool gprsRxPending;&lt;br /&gt;static volatile bool gprsRxPendingCount;&lt;br /&gt;static volatile bool gprsUartError;&lt;br /&gt;//static uint8_t serial_gprs_buffer2;&lt;br /&gt;&lt;br /&gt;/***********************************************************************************&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Init GPRS, register GPRS callbacks.&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Parameters:&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;none&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Return:&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;none&lt;br /&gt;&lt;br /&gt;&amp;nbsp;***********************************************************************************/&lt;br /&gt;PROGMEM_DECLARE_CONST(char) gprsUartMsgOpenError[]={&amp;quot;*** GPRS uart open error\n&amp;quot;};&lt;br /&gt;&lt;br /&gt;void appStartGprsUsartManager(nrf_uart_baudrate_t baudrate)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ret_code_t ret;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;nrf_drv_uart_config_t m_uarte_gprs_drv_config;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;m_uarte_gprs_drv_config.baudrate = baudrate;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;m_uarte_gprs_drv_config.hwfc = NRF_UART_HWFC_DISABLED;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;m_uarte_gprs_drv_config.interrupt_priority = GPRS_UART_CONFIG_IRQ_PRIORITY;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;m_uarte_gprs_drv_config.parity = NRF_UART_PARITY_EXCLUDED;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;m_uarte_gprs_drv_config.pselcts = CTS_PIN_DISCONNECTED;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;m_uarte_gprs_drv_config.pselrts = RTS_PIN_DISCONNECTED;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;m_uarte_gprs_drv_config.pselrxd = UART_GPRS_RX_PIN;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;m_uarte_gprs_drv_config.pseltxd = UART_GPRS_TX_PIN;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;gprsRxPending = false;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;gprsRxPendingCount = 0;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;gprsUartError = false;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ret = nrf_serial_init(&amp;amp;serial_gprs_uart, &amp;amp;m_uarte_gprs_drv_config, &amp;amp;serial_gprs_config);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;APP_ERROR_CHECK(ret);&lt;br /&gt;}&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Losing uart characters - activating UART in place of UARTE in nRF52840</title><link>https://devzone.nordicsemi.com/thread/453884?ContentTypeID=1</link><pubDate>Fri, 03 Nov 2023 07:51:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4585ff9e-7038-4cff-9272-03c80c0f26da</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;I see. But I don&amp;#39;t really understand your config or what you are doing, partly because the code snippets refer to code that is not provided by us so I can only assume what the configs does. Can you elaborate more about your exact configuration and what you are seeing?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Losing uart characters - activating UART in place of UARTE in nRF52840</title><link>https://devzone.nordicsemi.com/thread/453830?ContentTypeID=1</link><pubDate>Thu, 02 Nov 2023 17:54:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a4e8bbd1-20a0-48a6-a307-04c1eb27af06</guid><dc:creator>Malcolm</dc:creator><description>&lt;p&gt;I have set SERIAL1_BUFF_RX_SIZE to 1, so this generates an interrupt for each character. However I do not get an interrupt for some characters, and instead I get uart error (no stop bit). I have scope trace to demonstrate the issue.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Losing uart characters - activating UART in place of UARTE in nRF52840</title><link>https://devzone.nordicsemi.com/thread/453747?ContentTypeID=1</link><pubDate>Thu, 02 Nov 2023 13:45:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:201575f9-c181-4232-949f-f4667e3b9274</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user=""]This would be the behaviour of the UART, which has 6 deep hardware fifo, and would capture all the incoming characters and release them each time RX is read.[/quote]
&lt;p&gt;You are rigth that the UART RX FIFO is 6 bytes. The UARTE use DMA however, so the data is written directly to a buffer that is as large as needed, offloading the CPU. This means that for most real applications (where the application is not only handlig UART), the UARTE is better, and I struggle to see why you want to use the&amp;nbsp;deprecated UART peripheral instead?&lt;/p&gt;
[quote user=""]My question: Does the UARTE also use the hardware fifo to capture incoming characters that can be transferred to memory by DMA and interrupt generated for each character?[/quote]
&lt;p&gt;The FIFO is still there, but you cannot get an interrupt for each received byte. That is a limitation in UARTE, and if you need to know the number of received bytes before the Rx buffer is full, you may want to have a look at &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/lib_libuarte.html"&gt;libuarte&lt;/a&gt;, which use a TIEMR in counter mode and PPI to count received bytes.&lt;/p&gt;
[quote user=""]How do I use UART in place of UARTE, as all the code forces UARTE even if NRF_SERIAL_MODE_IRQ is selected[/quote]
&lt;p&gt;I do not immediately recognize these code snippets. Where does it come from? That said, I can think of few applications where it would make sense to use the legacy UART peripheral.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>