<?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>Maximum Bytes sent through BLE limited to 20</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/101121/maximum-bytes-sent-through-ble-limited-to-20</link><description>I&amp;#39;m using nRF 52832 to collect data from sensor through the SAADC and send it through BLE to nRF 52840 dongle connected to the PC. The SAADC is configured for 4 single ended channels with 100Hz sampling rate and everything works fine. I wish to increase</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 29 Jun 2023 15:35:07 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/101121/maximum-bytes-sent-through-ble-limited-to-20" /><item><title>RE: Maximum Bytes sent through BLE limited to 20</title><link>https://devzone.nordicsemi.com/thread/433753?ContentTypeID=1</link><pubDate>Thu, 29 Jun 2023 15:35:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:60693b4d-d4f6-46f8-8fff-9339addddc71</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;You have take few things into consideration.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Make sure that you have buffer with enough size to hold the actual data to be transmitted over BLE like Naeem pointed out.&lt;/li&gt;
&lt;li&gt;You need to check if the MTU size is correctly set to be able send the 40 bytes of data in the same connection event,&amp;nbsp;&lt;span&gt;See&amp;nbsp;&lt;/span&gt;&lt;a title="GATTC ATT_MTU Exchange" href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v6.0.0/group___b_l_e___g_a_t_t_c___m_t_u___e_x_c_h_a_n_g_e.html?cp=2_3_1_1_0_2_2_3_0"&gt;GATTC ATT_MTU Exchange&lt;/a&gt;&lt;span&gt;&amp;nbsp;and&amp;nbsp;&lt;/span&gt;&lt;a title="GATTS ATT_MTU Exchange" href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v6.0.0/group___b_l_e___g_a_t_t_s___m_t_u___e_x_c_h_a_n_g_e.html?cp=2_3_1_1_0_2_4_3_1"&gt;GATTS ATT_MTU Exchange&lt;/a&gt;&lt;span&gt;,&amp;nbsp;&lt;/span&gt;&lt;a title="sd_ble_cfg_set" href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v6.0.0/group___b_l_e___c_o_m_m_o_n___f_u_n_c_t_i_o_n_s.html?cp=2_3_1_1_0_2_0_2_2_0#ga4edae2bac8c68b672c0fa101ed2c687f"&gt;sd_ble_cfg_set&lt;/a&gt;&lt;span&gt;,&amp;nbsp;&lt;/span&gt;&lt;a title="sd_ble_gattc_exchange_mtu_request" href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v6.0.0/group___b_l_e___g_a_t_t_c___f_u_n_c_t_i_o_n_s.html?cp=2_3_1_1_0_2_2_2_6#ga269894b0415de8c4ae76343b74f6e655"&gt;sd_ble_gattc_exchange_mtu_request&lt;/a&gt;&lt;span&gt;, and&amp;nbsp;&lt;/span&gt;&lt;a title="sd_ble_gatts_exchange_mtu_reply" href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v6.0.0/group___b_l_e___g_a_t_t_s___f_u_n_c_t_i_o_n_s.html?cp=2_3_1_1_0_2_4_2_3#gacb80e44fb1309fe388c6baf747f6f994"&gt;sd_ble_gatts_exchange_mtu_reply&lt;/a&gt;&lt;span&gt;.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Add some air sniffer to see what data is tranmitted over air and what you are doing to post process that data on the receiving end.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span&gt;The use case you have is quite simple apart from the difference that you are multiplexing different raw data into one buffer (which is quite ok). I do not see any other complications in what you wanting to achieve.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Maximum Bytes sent through BLE limited to 20</title><link>https://devzone.nordicsemi.com/thread/433302?ContentTypeID=1</link><pubDate>Tue, 27 Jun 2023 15:06:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ce40203d-c8b7-44fc-af5f-f11e184cb26f</guid><dc:creator>Aarun</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;This is the example I&amp;#39;m using. I simply wish to sample 4 channels (SAADC) at 200Hz and send them over BLE&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/NordicPlayground/nRF52-ADC-examples/tree/master/ble_app_uart__saadc_timer_driven__scan_mode"&gt;nRF52-ADC-examples/ble_app_uart__saadc_timer_driven__scan_mode at master &amp;middot; NordicPlayground/nRF52-ADC-examples &amp;middot; GitHub&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Maximum Bytes sent through BLE limited to 20</title><link>https://devzone.nordicsemi.com/thread/433252?ContentTypeID=1</link><pubDate>Tue, 27 Jun 2023 13:07:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6c4d8b06-94fd-420e-9726-0f37e9b5d044</guid><dc:creator>Naeem Maroof</dc:creator><description>&lt;p&gt;There are few things I could mention related to the code:&lt;/p&gt;
[quote user=""] After padding the bytes needed to be sent through a packet is 40 bytes[/quote]
&lt;p&gt;the nus_string is not of size 40&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;//custom code for sending 2 packet flag in BLE
uint8_t nus_string[]=&amp;quot;aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&amp;quot;;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;In the saadc_callback(), what you are doing here:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;else {
    uint8_t nus2[25];
    int i,j;
    sprintf(nus2, &amp;quot;%d %d %d %d! /&amp;quot;,p_event-&amp;gt;data.done.p_buffer[0],p_event-&amp;gt;data.done.p_buffer[1],p_event-&amp;gt;data.done.p_buffer[2],p_event-&amp;gt;data.done.p_buffer[3]);
    for(i=0;nus_string[i]!=&amp;#39;/&amp;#39;;i++);   
    for(int j=0;nus2[j]!=&amp;#39;/&amp;#39;;j++)
    {     
        nus_string[i]=nus2[j];  
        i++;
    } 
    bytes_to_send = sprintf(nus_string, &amp;quot;%s&amp;quot;,nus_string);
    err_code = ble_nus_data_send(&amp;amp;m_nus, nus_string, &amp;amp;bytes_to_send, m_conn_handle);
    if ((err_code != NRF_ERROR_INVALID_STATE) &amp;amp;&amp;amp; (err_code != NRF_ERROR_NOT_FOUND))
    {
        APP_ERROR_CHECK(err_code);
    }
    m_adc_evt_counter++;
    sprintf(nus_string,&amp;quot;aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&amp;quot;);
}&lt;/pre&gt;You have declared nus2 as 25 byte, and you are writing 8 bytes of data (from buffer 0,1,2,3) to the nus2 and some characters?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I think you are trying to copy the contents (data / integers) 2 times into the nus_string. But I think you are not doing it correctly here.&lt;/p&gt;
&lt;p&gt;You are putting first copy in the if statement&lt;/p&gt;
&lt;p&gt;And you are putting the second copy in the else statement (by first putting data into nus2)&lt;/p&gt;
&lt;p&gt;Only one of these statements (if or the else) will be true, and hence you will only have one copy.&lt;/p&gt;
&lt;p&gt;Also, why the rest of the code is within else block. I think it should be outside of the if-else.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Naeem&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Maximum Bytes sent through BLE limited to 20</title><link>https://devzone.nordicsemi.com/thread/433229?ContentTypeID=1</link><pubDate>Tue, 27 Jun 2023 12:18:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:07cba8b5-d9e9-4ef7-9602-594dcf8a034e</guid><dc:creator>Naeem Maroof</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I am sorry I am not able to understand your code.&lt;/p&gt;
&lt;p&gt;I was also not able to compile and test it fully.&lt;/p&gt;
&lt;p&gt;I am not sure what you are doing (in code) and how you are testing. Is your code based on some nordic sample.&lt;/p&gt;
&lt;p&gt;If you start with a Nordic sample, and then incorporate changes into it and let me know where and what you are changing for your desired outcome, then I can dig into it why it is not working so.&lt;/p&gt;
&lt;p&gt;If you are not limited to use older (nrf5) SDK, I suggest you to try Nordic Connect SDK along with VS Code.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Naeem&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Maximum Bytes sent through BLE limited to 20</title><link>https://devzone.nordicsemi.com/thread/432722?ContentTypeID=1</link><pubDate>Fri, 23 Jun 2023 13:56:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:26bacadc-ebd9-43c2-b9a9-5cf1ea87bc2d</guid><dc:creator>Aarun</dc:creator><description>&lt;p&gt;Sorry, this should work&amp;nbsp;&lt;a href="https://drive.google.com/file/d/1TLQHzSahc1JU5fny0WuPiI66_ylOhMNM/view?usp=sharing"&gt;https://drive.google.com/file/d/1TLQHzSahc1JU5fny0WuPiI66_ylOhMNM/view?usp=sharing&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Maximum Bytes sent through BLE limited to 20</title><link>https://devzone.nordicsemi.com/thread/432713?ContentTypeID=1</link><pubDate>Fri, 23 Jun 2023 13:32:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ac32b0f5-05d4-432a-bd57-a8750f4bdfe7</guid><dc:creator>Naeem Maroof</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;I am not able to open and compile your project successfully.&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1687527081032v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;I can also see that there is no &amp;quot;main.c&amp;quot; file in the folder you have shared.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>