<?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>Zephyre BLE UART example reads wrong bytes ( Adafuit Feather nRF52840 )</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/115862/zephyre-ble-uart-example-reads-wrong-bytes-adafuit-feather-nrf52840</link><description>I am receiving bytes from a GPS module and passing them to BLE UART example app configured to use UARTE1 and asynchronous API. 
 After few minutes of running it starts leaking memory by not releasing RX buffers. Using RTT messages I identified it correspond</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 04 Nov 2024 10:25:27 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/115862/zephyre-ble-uart-example-reads-wrong-bytes-adafuit-feather-nrf52840" /><item><title>RE: Zephyre BLE UART example reads wrong bytes ( Adafuit Feather nRF52840 )</title><link>https://devzone.nordicsemi.com/thread/508918?ContentTypeID=1</link><pubDate>Mon, 04 Nov 2024 10:25:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:727b64ab-18ab-420b-9540-8659d2daa9a2</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;A couple suggestions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;As Susheel alreadt suggested, enable HWFC&lt;/li&gt;
&lt;li&gt;Check the supply voltage of the GPS module and make sure it matches the operating conditions of the module&amp;#39;s specifications.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyre BLE UART example reads wrong bytes ( Adafuit Feather nRF52840 )</title><link>https://devzone.nordicsemi.com/thread/508586?ContentTypeID=1</link><pubDate>Wed, 30 Oct 2024 18:13:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:15060f8a-61f9-48e9-a17f-d56972f698af</guid><dc:creator>TryingToTameNRF52</dc:creator><description>&lt;p&gt;Looks like it is a hardware problem on the GPS module side&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/frameError.png" /&gt;&lt;/p&gt;
&lt;p&gt;Will try to figure out how to handle it&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyre BLE UART example reads wrong bytes ( Adafuit Feather nRF52840 )</title><link>https://devzone.nordicsemi.com/thread/508254?ContentTypeID=1</link><pubDate>Tue, 29 Oct 2024 00:25:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b8d7ac74-c189-4ef9-9316-589bd834035c</guid><dc:creator>TryingToTameNRF52</dc:creator><description>&lt;p&gt;Hello,&lt;br /&gt;HWFC was disabled.&lt;/p&gt;
&lt;p&gt;UART1 related nodes:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;  uart1: uart@40028000 {
   compatible = &amp;quot;nordic,nrf-uarte&amp;quot;;
   reg = &amp;lt;0x40028000 0x1000&amp;gt;;
   interrupts = &amp;lt;40 1&amp;gt;;
   status = &amp;quot;disabled&amp;quot;;
  };

uart1_default: uart1_default {
    group1 {
    psels = &amp;lt;((((((0) * 32U) + (2)) &amp;amp; 0x1FFU) &amp;lt;&amp;lt; 0U) | ((0U &amp;amp; 0x7FFFU) &amp;lt;&amp;lt; 17U))&amp;gt;,
    &amp;lt;((((((0) * 32U) + (3)) &amp;amp; 0x1FFU) &amp;lt;&amp;lt; 0U) | ((1U &amp;amp; 0x7FFFU) &amp;lt;&amp;lt; 17U))&amp;gt;;
    };
};

uart1_sleep: uart1_sleep {
 group1 {
 psels = &amp;lt;((((((0) * 32U) + (2)) &amp;amp; 0x1FFU) &amp;lt;&amp;lt; 0U) | ((0U &amp;amp; 0x7FFFU) &amp;lt;&amp;lt; 17U))&amp;gt;,
 &amp;lt;((((((0) * 32U) + (3)) &amp;amp; 0x1FFU) &amp;lt;&amp;lt; 0U) | ((1U &amp;amp; 0x7FFFU) &amp;lt;&amp;lt; 17U))&amp;gt;;
 low-power-enable;
 };
};

&amp;amp;uart1 {
        compatible = &amp;quot;nordic,nrf-uarte&amp;quot;;
        current-speed = &amp;lt;115200&amp;gt;;
        status = &amp;quot;okay&amp;quot;;
        pinctrl-0 = &amp;lt;&amp;amp;uart1_default&amp;gt;;
        pinctrl-1 = &amp;lt;&amp;amp;uart1_sleep&amp;gt;;
        pinctrl-names = &amp;quot;default&amp;quot;, &amp;quot;sleep&amp;quot;;
};

chosen {
  nordic,nus-uarte = &amp;amp;uart1;
};

&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The device:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static const struct device *uarte = DEVICE_DT_GET(DT_CHOSEN(nordic_nus_uarte));&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I suspect it is a memory leak as I track number of calls for&lt;/p&gt;
&lt;p&gt;k_malloc(sizeof(*buf)); // if (buf)&lt;/p&gt;
&lt;p&gt;k_free(buf); // appears twice in the code&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Difference between them should be number of buffers in use. The number of buffers in use rises to about 30 and after that the MCU starts calling: LOG_WRN(&amp;quot;Not able to allocate UART receive buffer&amp;quot;);&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyre BLE UART example reads wrong bytes ( Adafuit Feather nRF52840 )</title><link>https://devzone.nordicsemi.com/thread/508146?ContentTypeID=1</link><pubDate>Mon, 28 Oct 2024 12:38:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b20d688f-708a-475c-9073-8d75804582d2</guid><dc:creator>Susheel Nuguru</dc:creator><description>[quote user=""]After few minutes of running it starts leaking memory by not releasing RX buffers.[/quote]
&lt;p&gt;Also, how did you come to a conclusion that this is a memory leak issue?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyre BLE UART example reads wrong bytes ( Adafuit Feather nRF52840 )</title><link>https://devzone.nordicsemi.com/thread/508144?ContentTypeID=1</link><pubDate>Mon, 28 Oct 2024 12:38:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:84998674-48e4-46c3-8c5d-e4b4260d6d2b</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;is HWFC enabled, can you show your UART settings in your device tree?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyre BLE UART example reads wrong bytes ( Adafuit Feather nRF52840 )</title><link>https://devzone.nordicsemi.com/thread/508021?ContentTypeID=1</link><pubDate>Sat, 26 Oct 2024 20:46:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9b7c9f1f-27f2-4249-bc58-82d1714f78ac</guid><dc:creator>TryingToTameNRF52</dc:creator><description>&lt;p&gt;Forgot to add proj.conf&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_UART_ASYNC_API=y
CONFIG_NRFX_UARTE1=y
CONFIG_SERIAL=y
CONFIG_BT_NUS_UART_BUFFER_SIZE=240
CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=n
CONFIG_BT_BUF_ACL_RX_SIZE=251
CONFIG_BT_GATT_CLIENT=y
CONFIG_BT_ATT_PREPARE_COUNT=2
CONFIG_BT_CONN_TX_MAX=10
CONFIG_BT_L2CAP_TX_BUF_COUNT=10
CONFIG_BT_L2CAP_TX_MTU=247
CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
CONFIG_BT_CTLR_PHY_2M=y
CONFIG_BT_CTLR_RX_BUFFERS=2
CONFIG_BT_BUF_ACL_TX_COUNT=10
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_BT_NUS_UART_RX_WAIT_TIME=500
CONFIG_GDBSTUB=y
CONFIG_GPIO=y
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
CONFIG_HEAP_MEM_POOL_SIZE=8192
CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME=&amp;quot;Nordic_UART_Service&amp;quot;
CONFIG_BT_MAX_CONN=1
CONFIG_BT_MAX_PAIRED=1
CONFIG_BT_NUS=y
CONFIG_BT_SETTINGS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
CONFIG_NVS=y
CONFIG_SETTINGS=y
CONFIG_DK_LIBRARY=y
CONFIG_MAIN_STACK_SIZE=1152
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
CONFIG_LOG=y
CONFIG_USE_SEGGER_RTT=y
CONFIG_LOG_BACKEND_RTT=y
CONFIG_LOG_BACKEND_UART=n
CONFIG_LOG_PRINTK=n
CONFIG_ASSERT=y
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>