<?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>UART the best way to exploit the full bandwith of nRF52840 Dongle? Send images with UART?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/64535/uart-the-best-way-to-exploit-the-full-bandwith-of-nrf52840-dongle-send-images-with-uart</link><description>Hello, 
 
 I am using a nRF52840 dongle to communicate between a laptop running Ubuntu and a phone running Android. 
 
 Right now I set up a UART-BLE communication using an adapted version of the usbd_ble_uart example from the Nordic nRF5_SDK: 
 - A small</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 14 Aug 2020 12:26:49 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/64535/uart-the-best-way-to-exploit-the-full-bandwith-of-nrf52840-dongle-send-images-with-uart" /><item><title>RE: UART the best way to exploit the full bandwith of nRF52840 Dongle? Send images with UART?</title><link>https://devzone.nordicsemi.com/thread/264619?ContentTypeID=1</link><pubDate>Fri, 14 Aug 2020 12:26:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c41da95e-5561-4453-95a4-949ec9ba4305</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;You welcome &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART the best way to exploit the full bandwith of nRF52840 Dongle? Send images with UART?</title><link>https://devzone.nordicsemi.com/thread/264491?ContentTypeID=1</link><pubDate>Thu, 13 Aug 2020 13:40:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b6f19c30-f435-45aa-87f5-fe1843136108</guid><dc:creator>Researcher123</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks for&amp;nbsp;the responses and clarifications!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART the best way to exploit the full bandwith of nRF52840 Dongle? Send images with UART?</title><link>https://devzone.nordicsemi.com/thread/263607?ContentTypeID=1</link><pubDate>Fri, 07 Aug 2020 12:29:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f5649d7c-a8b8-49b5-95f6-4a5920555014</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Hugh&lt;/p&gt;
&lt;p&gt;It is true that the example is set up to handle ASCII strings, but with some changes to the handler you can make pass through the data more indiscriminately.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;As for maximizing throughput this is not really dependent on which services or characteristics are used, as long as the example is set up to utilize larger attributes, long data length (aka data length extension), and the 2M high speed mode when available on the phone side.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It is also important to set up the USB handlers to buffer the data into longer packets, to make the BLE communication more efficient.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART the best way to exploit the full bandwith of nRF52840 Dongle? Send images with UART?</title><link>https://devzone.nordicsemi.com/thread/263304?ContentTypeID=1</link><pubDate>Wed, 05 Aug 2020 17:19:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eda6f8f8-4a6a-49ee-b0cd-32b15ee6102f</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;Ah, would that be the case &amp;lt;sigh&amp;gt;, but this is a Dongle and I expect it is using the USB uart (if not ignore this post :-) So yes the BLE transmission is just data bytes, but in this case the &amp;quot;uart&amp;quot; is actually USB and the Nordic USB handler helpfully messes up non-ascii data. Look for this line in main.c:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define ENDLINE_STRING &amp;quot;\r\n&amp;quot;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Here is how it&amp;#39;s used:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void nus_data_handler(ble_nus_evt_t * p_evt)
{
    if (p_evt-&amp;gt;type == BLE_NUS_EVT_RX_DATA)
    {
        bsp_board_led_invert(LED_BLE_NUS_RX);
        NRF_LOG_DEBUG(&amp;quot;Received data from BLE NUS. Writing data on CDC ACM.&amp;quot;);
        NRF_LOG_HEXDUMP_DEBUG(p_evt-&amp;gt;params.rx_data.p_data, p_evt-&amp;gt;params.rx_data.length);
        memcpy(m_nus_data_array, p_evt-&amp;gt;params.rx_data.p_data, p_evt-&amp;gt;params.rx_data.length);
        // Add endline characters
        uint16_t length = p_evt-&amp;gt;params.rx_data.length;
        if (length + sizeof(ENDLINE_STRING) &amp;lt; BLE_NUS_MAX_DATA_LEN)
        {
            memcpy(m_nus_data_array + length, ENDLINE_STRING, sizeof(ENDLINE_STRING));
            length += sizeof(ENDLINE_STRING);
        }
        // Send data through CDC ACM
        ret_code_t ret = app_usbd_cdc_acm_write(&amp;amp;m_app_cdc_acm,
                                                m_nus_data_array,
                                                length);
        if(ret != NRF_SUCCESS)
        {
            NRF_LOG_INFO(&amp;quot;CDC ACM unavailable, data received: %s&amp;quot;, m_nus_data_array);
        }
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;.. and here:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;        case APP_USBD_CDC_ACM_USER_EVT_RX_DONE:
        {
            ret_code_t ret;
            static uint8_t index = 0;
            index++;
            do
            {
                if ((m_cdc_data_array[index - 1] == &amp;#39;\n&amp;#39;) ||
                    (m_cdc_data_array[index - 1] == &amp;#39;\r&amp;#39;) ||
                    (index &amp;gt;= (m_ble_nus_max_data_len)))
                {
                    if (index &amp;gt; 1)
                    {
                        bsp_board_led_invert(LED_CDC_ACM_RX);
                        NRF_LOG_DEBUG(&amp;quot;Ready to send data over BLE NUS&amp;quot;);
                        NRF_LOG_HEXDUMP_DEBUG(m_cdc_data_array, index);
                        do
                        {
                            uint16_t length = (uint16_t)index;
                            if (length + sizeof(ENDLINE_STRING) &amp;lt; BLE_NUS_MAX_DATA_LEN)
                            {
                                memcpy(m_cdc_data_array + length, ENDLINE_STRING, sizeof(ENDLINE_STRING));
                                length += sizeof(ENDLINE_STRING);
                            }&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This is in &lt;em&gt;.\examples\peripheral\usbd_ble_uart\main.c&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;This caught me out a while back; best to remove the end-of-line insertion.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART the best way to exploit the full bandwith of nRF52840 Dongle? Send images with UART?</title><link>https://devzone.nordicsemi.com/thread/263301?ContentTypeID=1</link><pubDate>Wed, 05 Aug 2020 16:57:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6289e925-7771-464d-a50f-17be178c43bb</guid><dc:creator>awneil</dc:creator><description>[quote userid="92462" url="~/f/nordic-q-a/64535/uart-the-best-way-to-exploit-the-full-bandwith-of-nrf52840-dongle-send-images-with-uart"]Is it also possible to send/receive images with UART?[/quote]
&lt;p&gt;Yes.&lt;/p&gt;
&lt;p&gt;It just send &lt;em&gt;&lt;strong&gt;bytes&lt;/strong&gt; &lt;/em&gt;- it neither knows nor cares what those bytes represent&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>