<?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>Data throughput between nrf52810 BLE &amp;amp; UART</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/58740/data-throughput-between-nrf52810-ble-uart</link><description>Hi, 
 In my application, I would like to transfer data from MCU ---(UART#1)---&amp;gt; BLE#1(Peripheral) ---&amp;gt; BLE#2(Central) ---(UART#2)---&amp;gt; PC. I start my code based on ble_app_uart_pca10040e_s112 &amp;amp; ble_app_uart_c_pca10040_s132. 
 The model I am using for BLE#1</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 12 Mar 2020 11:16:17 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/58740/data-throughput-between-nrf52810-ble-uart" /><item><title>RE: Data throughput between nrf52810 BLE &amp; UART</title><link>https://devzone.nordicsemi.com/thread/239505?ContentTypeID=1</link><pubDate>Thu, 12 Mar 2020 11:16:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d63b488d-1c13-4c3a-82e5-9fd6b426a92e</guid><dc:creator>sdtjoe</dc:creator><description>&lt;p&gt;Hi Hung Bui,&lt;br /&gt;&lt;br /&gt;Thank you very much!&lt;br /&gt;It&amp;#39;s really the problem of interrupt level.&lt;br /&gt;With UARTE, I can use up to 691k baud rate without any problem for Peripheral (UARTE -&amp;gt; BLE) and Central (BLE -&amp;gt; UARTE).&lt;/p&gt;
&lt;p&gt;To increase the through put, instead of sending 78 KB per 5ms through BLE, I have set double for it, which is 156 KB per 10 ms.&lt;br /&gt;&lt;br /&gt;But then I found another problem.&lt;br /&gt;The distance between the two BLE is very short (about 5 cm).&lt;br /&gt;If it is more then 5cm, the speed will become very slow or even being disconnected.&lt;br /&gt;I think it&amp;#39;s strange and should be some setting problem?&lt;br /&gt;&lt;br /&gt;Some settings I have changed which may be related:&lt;br /&gt;Tx Power to 4 for Peripheral&lt;br /&gt;Both TX RX Phy is BLE_GAP_PHY_2MBPS for both Peripheral and Central&lt;br /&gt;MIN_CONN_INTERVAL MSEC_TO_UNITS(8, UNIT_1_25_MS)&lt;br /&gt;MAX_CONN_INTERVAL MSEC_TO_UNITS(10, UNIT_1_25_MS)&lt;br /&gt;&lt;br /&gt;Thanks,&lt;br /&gt;Joe&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Data throughput between nrf52810 BLE &amp; UART</title><link>https://devzone.nordicsemi.com/thread/239338?ContentTypeID=1</link><pubDate>Wed, 11 Mar 2020 13:25:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7405d3bd-463d-4807-b515-8029d5f4c26a</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Joe,&amp;nbsp;&lt;br /&gt;I think it&amp;nbsp;was because the interrupt level. If you call the function inside an interrupt handler with more or equal priority to level 4 it will cause&amp;nbsp; a hardfault.&lt;br /&gt;Please have a look here:&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/sds_s132/SDS/s1xx/processor_avail_interrupt_latency/exception_mgmt_sd.html?cp=4_5_2_0_15_1"&gt;https://infocenter.nordicsemi.com/topic/sds_s132/SDS/s1xx/processor_avail_interrupt_latency/exception_mgmt_sd.html?cp=4_5_2_0_15_1&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;You need to configure the UARTE interrupt level to level 5 or above.&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/sds_s132/SDS/s1xx/processor_avail_interrupt_latency/exception_mgmt_sd.html?cp=4_5_2_0_15_1"&gt;&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;Please try to step into the code and check where you get the assert, it&amp;#39;s most likely because of the hvx API call.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Data throughput between nrf52810 BLE &amp; UART</title><link>https://devzone.nordicsemi.com/thread/239242?ContentTypeID=1</link><pubDate>Wed, 11 Mar 2020 02:47:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3d72f52e-a9e5-4b1c-95ba-becea4efae8b</guid><dc:creator>sdtjoe</dc:creator><description>&lt;p&gt;Sorry but I am quite urgent on resolving the problem of transmitting through BLE.&lt;br /&gt;Could anyone help on this?&lt;br /&gt;&lt;br /&gt;Thank you very much.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Data throughput between nrf52810 BLE &amp; UART</title><link>https://devzone.nordicsemi.com/thread/238985?ContentTypeID=1</link><pubDate>Tue, 10 Mar 2020 07:26:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e72ea562-d5a4-4c9d-ae3f-c83b7b9f0213</guid><dc:creator>sdtjoe</dc:creator><description>&lt;p&gt;Hi Hung Bui,&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Thank you for your suggestion and sample code. I&amp;nbsp;have tried with UARTE and now I am able to receive the data to buffer called uarte_buffer[200].&lt;/p&gt;
&lt;p&gt;So the next step is to pass the buffer content to BLE when the interrupt occurs, where NRF_UARTE0-&amp;gt;EVENTS_ENDRX == 1.&lt;/p&gt;
&lt;p&gt;I have reference the original UART sample code (it&amp;#39;s placed in function uart_event_handle, case APP_UART_DATA_READY):&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;do
{
	uint16_t length = (uint16_t)index;
	err_code = ble_nus_data_send(&amp;amp;m_nus, data_array, &amp;amp;length, m_conn_handle);
	if ((err_code != NRF_ERROR_INVALID_STATE) &amp;amp;&amp;amp;
		(err_code != NRF_ERROR_RESOURCES) &amp;amp;&amp;amp;
		(err_code != NRF_ERROR_NOT_FOUND))
	{
		APP_ERROR_CHECK(err_code);
	}
} while (err_code == NRF_ERROR_RESOURCES);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The above code works correctly , no matter BLE is connected or disconnected.&lt;br /&gt;When not connected it &amp;quot;do nothing&amp;quot;; When connected, it transmit to the connected BLE and I have confirmed I can view the data on the other side.&lt;/p&gt;
&lt;p&gt;However with my UARTE:&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void send_thru_ble(void)
{
    uint16_t length = (uint16_t)78;	// Data length is always is 78
    uint32_t       err_code;
	
	NRF_LOG_INFO(&amp;quot;START: send_thru_ble&amp;quot;);
	do
	{
		err_code = ble_nus_data_send(&amp;amp;m_nus, uarte_buffer, &amp;amp;length, m_conn_handle);
		if ((err_code != NRF_ERROR_INVALID_STATE) &amp;amp;&amp;amp;
			(err_code != NRF_ERROR_RESOURCES) &amp;amp;&amp;amp;
			(err_code != NRF_ERROR_NOT_FOUND))
		{
			APP_ERROR_CHECK(err_code);
		}
	} while (err_code == NRF_ERROR_RESOURCES);
	NRF_LOG_INFO(&amp;quot;FINISH: send_thru_ble&amp;quot;);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;When the interrupt function (UARTE0_UART0_IRQHandler) being called where NRF_UARTE0-&amp;gt;EVENTS_ENDRX == 1, I will call the above send_thru_ble().&lt;br /&gt;When there is no BLE connection, it does not transmit anything and both logs are viewable through RTT Viewer.&lt;br /&gt;However, if the BLE is connected, the system somehow looks hung there, and no log could be seen on RTT Viewer.&lt;br /&gt;I suspect there is some problem when running the ble_nus_data_send, but I don&amp;#39;t know how to figure it out.&lt;br /&gt;Because if I set breakpoint on the line err_code = ble_nus_data_send(...), the system will get into NRF_BREAKPOINT_COND; // On assert, the system can only recover with a reset.&lt;/p&gt;
&lt;p&gt;The differences of sdk_config.h are the following:&lt;br /&gt;UART:&lt;br /&gt;NRFX_PRS_ENABLED 1&lt;br /&gt;NRFX_UARTE0_ENABLED 0&lt;br /&gt;NRFX_UART_ENABLED 1&lt;br /&gt;UART_LEGACY_SUPPORT 1&lt;/p&gt;
&lt;p&gt;UARTE:&lt;br /&gt;NRFX_PRS_ENABLED 0&lt;br /&gt;NRFX_UARTE0_ENABLED 1&lt;br /&gt;NRFX_UART_ENABLED 0&lt;br /&gt;UART_LEGACY_SUPPORT 0&lt;/p&gt;
&lt;p&gt;Do you have any hint for me either on:&lt;br /&gt;1. How to debug it this case; or&lt;br /&gt;2. Any setting I have missed to make ble_nus_data_send work?&lt;br /&gt;&lt;br /&gt;Best Regards,&lt;br /&gt;Joe&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Data throughput between nrf52810 BLE &amp; UART</title><link>https://devzone.nordicsemi.com/thread/238516?ContentTypeID=1</link><pubDate>Fri, 06 Mar 2020 12:38:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eb31f622-5d23-46c2-afc9-c840d9ac9a21</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Joe,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;NRFX_UART is just to support the legacy UART peripheral (no EasyDMA), you can uncheck that.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you are using ble_app_uart, most likely you are using app_uart for handling UART communication. This library unfortunately not a best choice for application without HWFC and high baudrate.&lt;/p&gt;
&lt;p&gt;The reason is that due to the nature of UARTE, you don&amp;#39;t receive any event when a byte is received, and you only receive an event when the EasyDMA buffer is full, it has to set the EasyDMA buffer to 1 byte to receive an event for each byte. And this causes the problem when you don&amp;#39;t have HWFC and the CPU is busy for BLE.&amp;nbsp;No advantage of using EasyDMA in this implementation.&lt;/p&gt;
&lt;p&gt;We have a more advanced UARTE library called libuarte. You can find the example at&amp;nbsp;\examples\peripheral\libuarte. The documentation for the library is &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/lib_libuarte.html?cp=7_1_3_27"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This advance library uses a timer to&amp;nbsp;count&amp;nbsp;for the number of byte received. And the async library on top of the driver has a timer&amp;nbsp; to generate a timeout if there is no transaction. The trade off is that more PPI channel and TIMER(s) are needed.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In your case, you have all data fixed to 78 bytes, you can use the driver and don&amp;#39;t really need the async library. I think you can also use UARTE directly. An example of using UARTE directly can be found &lt;a href="https://github.com/andenore/NordicSnippets/blob/master/examples/uart/main.c"&gt;here &lt;/a&gt;(the example is for TX, but RX should be similar).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Data throughput between nrf52810 BLE &amp; UART</title><link>https://devzone.nordicsemi.com/thread/238417?ContentTypeID=1</link><pubDate>Fri, 06 Mar 2020 02:39:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8d9ffc19-321d-45a7-938e-33d77387a62e</guid><dc:creator>sdtjoe</dc:creator><description>&lt;p&gt;Hi Hung Bui,&lt;/p&gt;
&lt;p&gt;Thank you for your reply.&lt;/p&gt;
&lt;p&gt;I am currently busying on other stuffs, but I have a quick question about #3 first.&lt;/p&gt;
&lt;p&gt;As my application is basically a one way NUS (Nordic UART service) from MCU --UART--&amp;gt; BLE ---&amp;gt; BLE --UART--&amp;gt; PC, so I originally expect is just to increase the overall throughput.&lt;/p&gt;
&lt;p&gt;The MCU UART only have 2 pin so hardware flow control is not available.&lt;br /&gt;For the peripheral, I am using the example of nRF5SDK160098a08e2/examples/ble_peripheral/ble_app_uart.&lt;br /&gt;For the central, it is ble_central/ble_app_uart_c as its counterpart.&lt;br /&gt;Looks like the ble_app_uart example uses app_uart_fifo, and it takes 1 byte every time until the buffer is empty?&lt;/p&gt;
&lt;p&gt;I read several posts on DevZone and figure out that there are some config like NRFX_UART_ENABLED, NRFX_UART0_ENABLED, NRFX_UARTE_ENABLED, NRFX_UARTE0_ENABLED, UART_EASY_DMA_SUPPORT, UART0_CONFIG_USE_EASY_DMA etc.&lt;/p&gt;
&lt;p&gt;So my question is:&lt;br /&gt;#3a How do I enable / apply EasyDMA to the example? And how do I confirm if I am using EasyDMA?&lt;br /&gt;Seems just turning on the UART_EASY_DMA_SUPPORT or UART0_CONFIG_USE_EASY_DMA does not change.&lt;br /&gt;I am not quite sure if it is using EasyDMA or not.&lt;br /&gt;Or does the example does not support EasyDMA? so I have to write something myself?&lt;br /&gt;It will be helpful if there is any sample code I could reference.&lt;/p&gt;
&lt;p&gt;In sdk_config.h, the UART setting which looks related are as follow:&lt;br /&gt;NRFX_UARTE_ENABLED 1&lt;br /&gt;NRFX_UARTE0_ENABLED 0&lt;br /&gt;NRFX_UART_ENABLED 1&lt;br /&gt;NRFX_UART0_ENABLED 0&lt;br /&gt;UART_ENABLED 1&lt;br /&gt;UART_EASY_DMA_SUPPORT 1&lt;br /&gt;UART_LEGACY_SUPPORT 1&lt;br /&gt;UART0_ENABLED 1&lt;br /&gt;UART0_CONFIG_USE_EASY_DMA 1&lt;br /&gt;APP_UART_ENABLED 1&lt;/p&gt;
&lt;p&gt;#3b After looking for the above setting, I am quite confuse with UART, UART0, UARTE, UARTE0.&lt;br /&gt;Can you briefly explain whats the difference?&lt;/p&gt;
&lt;p&gt;Thank you very much.&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;br /&gt;Joe&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Data throughput between nrf52810 BLE &amp; UART</title><link>https://devzone.nordicsemi.com/thread/238329?ContentTypeID=1</link><pubDate>Thu, 05 Mar 2020 14:22:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:668f833d-758a-4113-9969-1ce287c034f9</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Joe,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;1. Could you please explain how you use UART ? Do you use Easy DMA ? Do you use any of our uart libraries ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Which UART baudrate did you actually operate at ? We support up to 1Mbps baud.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;2. To increase the throughput on BLE, it&amp;#39;s important to:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;- Transmit as much as possible (queue data as much as possible)&lt;/p&gt;
&lt;p&gt;- Low connection interval&lt;/p&gt;
&lt;p&gt;- Use Data length extension at least lager than&amp;nbsp;&lt;span&gt;NRF_SDH_BLE_GATT_MAX_MTU_SIZE&amp;nbsp;&lt;/span&gt; .&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Please check using our \examples\ble_central_and_peripheral\experimental\ble_app_att_mtu_throughput example to test. We observed around 600kbps using 1Mbps BLE PHY and about 1.2Mbps using 2Mbps BLE PHY.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;3. It&amp;#39;s hard to tell ,if you don&amp;#39;t use Easy DMA and if you don&amp;#39;t have HWFC missing byte would definitely happens if the CPU is busy doing something else.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>