<?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>Sending a CSV File over ble Gatt connection</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/59222/sending-a-csv-file-over-ble-gatt-connection</link><description>Hi, 
 I need to send data from a CSV file on the nordic board(Via fatfs library). I have presently gotten a Gatt service up and running. 
 I have a mobile application which, can see the gatt service and write to the characteristics. From a specific write</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 23 Apr 2020 11:03:52 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/59222/sending-a-csv-file-over-ble-gatt-connection" /><item><title>RE: Sending a CSV File over ble Gatt connection</title><link>https://devzone.nordicsemi.com/thread/246220?ContentTypeID=1</link><pubDate>Thu, 23 Apr 2020 11:03:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b0726072-e151-4ba9-bf21-0a09a49f9798</guid><dc:creator>Edvin</dc:creator><description>[quote user="ThomasMorris"]When I try to send 1800 it gets stuck and when I cancel the connection it crashes. I am not sure why.[/quote]
&lt;p&gt;&amp;nbsp;I assume it is an APP_ERROR_CHECK(err_code) that receives an err_code != 0. Which one is it? Does your log say something like &amp;quot;fatal error&amp;quot;? If you define DEBUG in your preprocessor defines, the log should say where it is. So where does it point to?&lt;/p&gt;
&lt;p&gt;When you find out where it points to, see if you can figure out why the function call that returned the err_code returned that err_code.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You need to check this yourself. If I just figure out each and every case for you, I basically have to develop the entire application for you. It is better (and faster) if you learn how to deal with the error handler yourself.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending a CSV File over ble Gatt connection</title><link>https://devzone.nordicsemi.com/thread/246208?ContentTypeID=1</link><pubDate>Thu, 23 Apr 2020 10:32:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6b776534-c0f7-4b11-9e79-fbfb13f79a2b</guid><dc:creator>Thomas</dc:creator><description>&lt;p&gt;Thanks for the psudo code. I have adapted it and added to my SD card reading code so I read a block of data and then send 60 lines of data before re reading the data. This code does not seem to crash when processing upto 1000 data.&lt;/p&gt;
&lt;p&gt;However, it crashes when I try to send more data I&amp;#39;ve tried to test 1800. I am not sure why this is.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;For transferring 1000 data (CSV lines) it takes about 30seconds. When I try to send 1800 it gets stuck and when I cancel the connection it crashes. I am not sure why.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void NEW_SEND_CSV()//Send the CSV file chop off when it gets to \r\n
{
    ret_code_t err_code;
   
    uint16_t data_length = 0;
    uint16_t offset_length = 11;
    data_length =(sizeof(ble_csv_data)-offset_length);//Only send 40 bytes

    if(End_of_file == 1)//End of the file
    {
        uint8_t End_of_file_data[1]={0x78}; /*End of file*/
        uint16_t end_of_file_length = sizeof(End_of_file_data);
        err_code = ble_cus_send_csv(&amp;amp;m_cus, End_of_file_data,&amp;amp;end_of_file_length, m_conn_handle);
        APP_ERROR_CHECK(err_code);
    }
    else
    {
        while(End_of_file != 1)//Loop this till end of file is reached
        {
            {
              SD_CARD_READ_DATA();//Read 1 min of data
              #define  LINE_SIZE 51//Single line of data
              #define  DATA_SIZE 3060//1 min of data
              for(int index = 0; index &amp;lt; DATA_SIZE; index += LINE_SIZE)
              {
                    uint8_t data_to_send[LINE_SIZE];//Create an array of 51 bytes to store a single line
                    memcpy(data_to_send, &amp;amp;ble_csv_data_minute[index],LINE_SIZE);//Copy 51 bytes at a time
                    //Send code
                    err_code = ble_cus_send_csv(&amp;amp;m_cus, data_to_send,&amp;amp;data_length, m_conn_handle);
                    if(err_code == NRF_ERROR_RESOURCES)
                    {
                        //Wait
                        while(Ble_gatts_evt_hvn_tx_complete_flag == false)//Gets set to true from interrupt
                        {
                            //Wait here
                        }
                        Ble_gatts_evt_hvn_tx_complete_flag = false;
                        err_code = ble_cus_send_csv(&amp;amp;m_cus, data_to_send,&amp;amp;data_length, m_conn_handle);//Error code has passed re send this data
                        if(err_code == NRF_ERROR_RESOURCES)
                        {
                            while(Ble_gatts_evt_hvn_tx_complete_flag == false)//Gets set to true from interrupt
                            {
                                //Wait here
                            }
                            Ble_gatts_evt_hvn_tx_complete_flag = false;
                            err_code = ble_cus_send_csv(&amp;amp;m_cus, data_to_send,&amp;amp;data_length, m_conn_handle);//Error code has passed re send this data
                        }
                        APP_ERROR_CHECK(err_code);
                    }
                }
            }
        }
    }    
}&lt;/pre&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending a CSV File over ble Gatt connection</title><link>https://devzone.nordicsemi.com/thread/245287?ContentTypeID=1</link><pubDate>Fri, 17 Apr 2020 15:06:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:59f0e1d1-459a-4187-9b04-2de8e9efe5b9</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;If it returns NRF_ERROR_RESOURCES, the packet isn&amp;#39;t lost. It is never queued. Only packets that are queued with the return value NRF_SUCCESS will be sent. The last snippet you sent will not work, because if it returns NRF_ERROR_RESOURCES then this packet is lost in your case, because I assume your function&amp;nbsp;SD_CARD_Read_Line() will read the next line each time. Do you see where I&amp;#39;m going with this?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Why don&amp;#39;t you try to start over with this state machine. Set a variable saying whether or not the last line you read using&amp;nbsp;SD_CARD_Read_Line() was successfully sent or not, and only read a new line from your file when the previous packet was sent successfully.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;volatile bool tx_complete_flag = true;
volatile bool last_line_queued = true;

event TX_COMPLETE:
tx_complete_flag = true;

...

send_data(void)
{
    ret_code_t err_code = NRF_SUCCESS;
    
    while (err_code = NRF_SUCCESS)
    {
        err_code = ble_cus_data_send(...);
        if (last_line_queued == true)
        {
            last_line_queued = false;
            SD_CARD_Read_Line();
        }
        if (err_code == NRF_SUCCESS)
        {
            last_line_queued = true;
        }
    }
    if (err_code != NRF_ERROR_RESOURCES)
    {
        APP_ERROR_CHECK(err_code);
    }
    else
    {
        tx_complete_flag = false;
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This is pseudo code, but hopefully you get the idea.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending a CSV File over ble Gatt connection</title><link>https://devzone.nordicsemi.com/thread/245189?ContentTypeID=1</link><pubDate>Fri, 17 Apr 2020 10:07:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:761a8b4f-147d-4ed5-b0fa-9a4faceba6ef</guid><dc:creator>Thomas</dc:creator><description>&lt;p&gt;Ok So i need to wait for&amp;nbsp;BLE_GATTS_EVT_HVN_TX_COMPLETE twice?&lt;/p&gt;
&lt;p&gt;When I get 533 out of 600. I does have the&amp;nbsp;NRF_ERROR_RESOURCES after I have waited for the flag from my&amp;nbsp;BLE_GATTS_EVT_HVN_TX_COMPLETE flag.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;case BLE_GATTS_EVT_HVN_TX_COMPLETE:
              Ble_gatts_evt_hvn_tx_complete_flag = true;//Set the flag
              break;&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending a CSV File over ble Gatt connection</title><link>https://devzone.nordicsemi.com/thread/245188?ContentTypeID=1</link><pubDate>Fri, 17 Apr 2020 10:02:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7296348a-0cd1-4efa-accd-9797e6d4adeb</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;If the new packet is longer than the one that was ACKed (in the TX_COMPLETE event), then this still may return NRF_ERROR_RESOURCES. The queue isn&amp;#39;t a number of packets, but number of bytes. Wait for the next TX_COMPLETE event if it still returns NRF_ERROR_RESOURCES.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="ThomasMorris"]When I store this data to my phone I receive 533 data out of 600 in my CSV file. [/quote]
&lt;p&gt;&amp;nbsp;Do you have any idea of why you are missing some files? When you called ble_cus_send_csv with these lines, did it return NRF_SUCCESS, or something else?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending a CSV File over ble Gatt connection</title><link>https://devzone.nordicsemi.com/thread/245177?ContentTypeID=1</link><pubDate>Fri, 17 Apr 2020 09:32:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6daf8ef6-0186-44a9-980b-4d42ff59d6fe</guid><dc:creator>Thomas</dc:creator><description>&lt;p&gt;I have tried adding the parts for BLE_GATTS_EVT_HVN_TX_COMPLETE and setting a volatile bool to true when this event runs. However, I then try to queue up another packet and it still returns&amp;nbsp;NRF_ERROR_RESOURCES.&lt;/p&gt;
&lt;p&gt;When I store this data to my phone I receive 533 data out of 600 in my CSV file. Below is my loop code. What is incorrect here. Not my notifyflag runs once every 10ms. Without it I store 524 data.&lt;/p&gt;
&lt;p&gt;Note I terminate the reading with an end of file packet.(Just an X)&lt;pre class="ui-code" data-mode="c_cpp"&gt;void SEND_CSV()//Send the CSV file chop off when it gets to \r\n
{
    ret_code_t err_code;
    uint16_t data_length = 0;
    uint16_t offset_length = 11;
    data_length =(sizeof(ble_csv_data)-offset_length);//Only send 40 bytes

    if(End_of_file == 1)//End of the file
    {
        uint8_t End_of_file_data[1]={0x78}; /*End of file*/
        uint16_t end_of_file_length = sizeof(End_of_file_data);
        err_code = ble_cus_send_csv(&amp;amp;m_cus, End_of_file_data,&amp;amp;end_of_file_length, m_conn_handle);
        APP_ERROR_CHECK(err_code);
        End_of_file =0;//Allows it to be re-read
    }
    else
    {
        while(End_of_file != 1)//Loop this till end of file is reached
        {
        if(notify_flag == true)
            {
                SD_CARD_Read_Line();//Gets a line of 51bytes of data
                err_code = ble_cus_send_csv(&amp;amp;m_cus, ble_csv_data,&amp;amp;data_length, m_conn_handle);
                if(err_code == NRF_ERROR_RESOURCES)
                {
                    //Wait
                    while(Ble_gatts_evt_hvn_tx_complete_flag == false)//Gets set to true from interrupt
                    {
                        //Wait here
                    }
                    Ble_gatts_evt_hvn_tx_complete_flag = false;
                    err_code = ble_cus_send_csv(&amp;amp;m_cus, ble_csv_data,&amp;amp;data_length, m_conn_handle);//Error code has passed re send this data
                    //APP_ERROR_CHECK(err_code);//This still returns nrf_error_resources
                }
                
               
              notify_flag = false;
            }
        }
    }
 
     
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending a CSV File over ble Gatt connection</title><link>https://devzone.nordicsemi.com/thread/244978?ContentTypeID=1</link><pubDate>Thu, 16 Apr 2020 12:10:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:409b808e-6ec8-46d8-9e13-f79081704dd3</guid><dc:creator>Thomas</dc:creator><description>&lt;p&gt;So therefore, My bullet point code shown above works via queuing?&lt;/p&gt;
&lt;p&gt;This means then I don&amp;#39;t need a flag to make it loop 10 times a second.&lt;/p&gt;
&lt;p&gt;Therefore, I just need to queue up all my data?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending a CSV File over ble Gatt connection</title><link>https://devzone.nordicsemi.com/thread/244975?ContentTypeID=1</link><pubDate>Thu, 16 Apr 2020 12:06:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0a1b4887-c9b1-4a0c-b5aa-f5be44264c0b</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Your function ble_cus_send() is calling sd_ble_gatts_hvx(). This is what I mean by queuing. ble_cus_send() = queuing.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending a CSV File over ble Gatt connection</title><link>https://devzone.nordicsemi.com/thread/244967?ContentTypeID=1</link><pubDate>Thu, 16 Apr 2020 11:52:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ac224cd5-5bd8-4e77-8edf-699579c91f98</guid><dc:creator>Thomas</dc:creator><description>&lt;p&gt;I am not quite sure what you mean by queue. Presently I am sending all my data (10 CSV lines for testing like below)&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Receive notification command&lt;/li&gt;
&lt;li&gt;Loop
&lt;ul&gt;
&lt;li&gt;If flag = true(set by notification timer 10 times a second)&lt;/li&gt;
&lt;li&gt;Read sd card line&lt;/li&gt;
&lt;li&gt;send data (ble_cus_send)&lt;/li&gt;
&lt;li&gt;Check error&lt;/li&gt;
&lt;li&gt;reset flag&lt;/li&gt;
&lt;li&gt;Exit condition is all CSV read&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This works but is this queuing? If so how can I speed it up atm its 510bytes per second.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending a CSV File over ble Gatt connection</title><link>https://devzone.nordicsemi.com/thread/244951?ContentTypeID=1</link><pubDate>Thu, 16 Apr 2020 11:02:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ac6fc62d-943b-4aae-b9af-80ff4541f4d6</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;If you want this to happen fast, you can just queue up as many packets as you like. Queue one using the sd_ble_gatts_hvx function, which you already do, and if that returns NRF_SUCCESS, try to queue another one immediately. Do this as long as it returns NRF_SUCCESS. Eventually, it will return NRF_ERROR_RESOURCES, which means that the buffer is full. When this happens, you must wait for the&amp;nbsp;BLE_GATTS_EVT_HVN_TX_COMPLETE event (add this to your ble_evt_handler()). When you receive this event, you can continue to queue packets until it returns NRF_ERROR_RESOURCES.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Remember that the packet you queue that returns NRF_ERROR_RESOURCES isn&amp;#39;t queued, so this would be the first packet you try to queue after the &lt;span&gt;BLE_GATTS_EVT_HVN_TX_COMPLETE&amp;nbsp;&lt;/span&gt;event.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending a CSV File over ble Gatt connection</title><link>https://devzone.nordicsemi.com/thread/244883?ContentTypeID=1</link><pubDate>Thu, 16 Apr 2020 07:58:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:33914aa2-1eda-4cec-8466-74c779ad4dca</guid><dc:creator>Thomas</dc:creator><description>&lt;p&gt;Thanks, that did seem to fix it. I have another question. I am now reading my CSV file by manually each time calling my function send CSV. This is working however, I want it to be automatic.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Therefore I presume I can loop this until all my data is sent. My question is: Is there a way to confirm each time data is sent it is received before sending the next data?&lt;/p&gt;
&lt;p&gt;I need this as I want to send my full log of data. This will be done using the notifications and, checking for a notification value change.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending a CSV File over ble Gatt connection</title><link>https://devzone.nordicsemi.com/thread/244375?ContentTypeID=1</link><pubDate>Tue, 14 Apr 2020 09:37:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:070c7dff-c897-40db-a3d5-b7a6c5d6505b</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Don&amp;#39;t pass it into the error handler by commenting out the line saying APP_ERROR_HANDLER(...):&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;        case APP_UART_COMMUNICATION_ERROR:
            //APP_ERROR_HANDLER(p_event-&amp;gt;data.error_communication);
            break;&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending a CSV File over ble Gatt connection</title><link>https://devzone.nordicsemi.com/thread/244340?ContentTypeID=1</link><pubDate>Tue, 14 Apr 2020 07:56:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:81763f70-0984-4402-b29d-17f78af582a1</guid><dc:creator>Thomas</dc:creator><description>&lt;p&gt;How would I go about ignoring it. Or better yet how do I prevent the overrun? This crash occurs seemingly around a couple of minutes after i disconnect.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending a CSV File over ble Gatt connection</title><link>https://devzone.nordicsemi.com/thread/244026?ContentTypeID=1</link><pubDate>Wed, 08 Apr 2020 09:23:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dcbb4adb-d03a-48a2-a232-761e49b67ef7</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;I tried to point to the app_uart_evt_t-&amp;gt;data.error_communication, which is an uint32_t, but I wanted you to check the description of this event in app_uart.h line 117.&lt;/p&gt;
&lt;p&gt;Does it say anything about the value of the error_communication?&lt;/p&gt;
&lt;p&gt;From app_uart.h:&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;uint32_t error_communication; /**&amp;lt; Field used if evt_type is: APP_UART_COMMUNICATION_ERROR. This field contains the value in the ERRORSRC register for the UART peripheral. The UART_ERRORSRC_x defines from nrf5x_bitfields.h can be used to parse the error code. See also the \nRFXX Series Reference Manual for specification. */&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;You are using the nRF52840, so I suggest you check the ERRORSRC register for the UART on the nRF52840:&lt;br /&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/uart.html?cp=4_0_0_5_32_9#topic"&gt;https://infocenter.nordicsemi.com/topic/ps_nrf52840/uart.html?cp=4_0_0_5_32_9#topic&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;A value of 1 means&amp;nbsp;&lt;span&gt;OVERRUN. Perhaps this is to be expected when you disable and/or enable the UART when there is UART data traffic ongoing? Have you tried to ignore the APP_UART_COMMUNICATION_ERROR when you are enabling and disabling the UART?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending a CSV File over ble Gatt connection</title><link>https://devzone.nordicsemi.com/thread/244016?ContentTypeID=1</link><pubDate>Wed, 08 Apr 2020 08:57:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:29f6fac4-13b4-4535-a593-056faa693a0c</guid><dc:creator>Thomas</dc:creator><description>&lt;p&gt;The type is app_uart_evt_t* is is an APP_UART_COMMUNICATION_ERROR.&lt;/p&gt;
&lt;p&gt;I disable the uart in my gatt connection when a connection is made. Then I restart it when I disconnect. This error comes some time after i disconnect.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending a CSV File over ble Gatt connection</title><link>https://devzone.nordicsemi.com/thread/243889?ContentTypeID=1</link><pubDate>Tue, 07 Apr 2020 11:59:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5ad7935a-1141-4598-870b-ccd285578e57</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;For the UART event handler, the suggestion that the error handler comes with (in this case NRF_ERROR_SVC_HANDLER_MISSING) is not correct. The err_code is 1. You must look at the event description. What sort of type is p_event-&amp;gt;data.error_communication? See if you can find the declaration of the error_communication in a header file, and see if you can see what it means when this is set to 1.&lt;/p&gt;
&lt;p&gt;Hint: What type is p_event? Right click and click go to definition.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending a CSV File over ble Gatt connection</title><link>https://devzone.nordicsemi.com/thread/243875?ContentTypeID=1</link><pubDate>Tue, 07 Apr 2020 11:25:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9b633ea0-78a7-4213-93d1-42be40d911fa</guid><dc:creator>Thomas</dc:creator><description>&lt;p&gt;Just a quick one:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I left my system running and got this,&lt;/p&gt;
&lt;p&gt;ERROR 1 [NRF_ERROR_SVC_HANDLER_MISSING] at D:\Segger projects\Segger Projects\SDKFOLDER\examples\ble_peripheral\gatt_issue\custom_files\Uart_comms.c:27&lt;br /&gt;00&amp;gt; PC at: 0x0003F671.&lt;/p&gt;
&lt;p&gt;This relates to this line of code:&lt;/p&gt;
&lt;p&gt;APP_ERROR_HANDLER(p_event-&amp;gt;data.error_communication);&lt;/p&gt;
&lt;p&gt;Why does this error occur?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending a CSV File over ble Gatt connection</title><link>https://devzone.nordicsemi.com/thread/243856?ContentTypeID=1</link><pubDate>Tue, 07 Apr 2020 10:11:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a30d67d0-7d1d-4f33-bd7a-beed9bd688af</guid><dc:creator>Edvin</dc:creator><description>[quote user="ThomasMorris"]I presume I need to index it similar to the app_uart example and if the characters \n or \r are found stop adding it to the new data to send. Something like that?[/quote]
&lt;p&gt;&amp;nbsp;Yes, indeed, and then set the p_length to a pointer to a uint16_t containing the length, &lt;strong&gt;just like&lt;/strong&gt; in ble_app_uart.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending a CSV File over ble Gatt connection</title><link>https://devzone.nordicsemi.com/thread/243851?ContentTypeID=1</link><pubDate>Tue, 07 Apr 2020 09:59:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0dc4f3e9-b410-4fbb-ae7f-99b17b3c0487</guid><dc:creator>Thomas</dc:creator><description>&lt;p&gt;Ok I think I want to send a single line at a time which in memory is 40 bytes. How do I only send 40 bytes as opposed to the whole 51? I presume I need to index it similar to the app_uart example and if the characters \n or \r are found stop adding it to the new data to send. Something like that?&lt;/p&gt;
&lt;p&gt;Then send the next line of data.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending a CSV File over ble Gatt connection</title><link>https://devzone.nordicsemi.com/thread/243837?ContentTypeID=1</link><pubDate>Tue, 07 Apr 2020 09:10:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bf3d60b6-3a16-49af-b080-213d35f61ee1</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Do you mean if one line in the CSV file is shorter than 51 bytes? Doesn&amp;#39;t that already have the linefeed termination on each line?&lt;/p&gt;
&lt;p&gt;You can find this before you send it as well. If each line is terminated by a linefeed you could say that each linefeed is the end, and set the length to that position, instead of 51. Another way is to just send all the data, 51 bytes at the time (or even more), and reassemble the file on the other side of the connection.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending a CSV File over ble Gatt connection</title><link>https://devzone.nordicsemi.com/thread/243806?ContentTypeID=1</link><pubDate>Tue, 07 Apr 2020 07:28:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:33116e6e-7283-4d84-ae50-985d5c27b4b5</guid><dc:creator>Thomas</dc:creator><description>&lt;p&gt;Sorry for my late response.&lt;/p&gt;
&lt;p&gt;It does print out 51 bytes via the gatt (setting the characteristic value) However for me to read the data correctly via my NRF log it needs 51 bytes. But, when I inspect the data itself its 40 bytes long. So how can I chop off the excess?&lt;/p&gt;
&lt;p&gt;When I read this data on my mobile application I am developing it sees all the data and the stuff I dont want aka the full 51 I need a way of chopping this off. I am thinking of adding a termination character to the CSV file such as X as it wont be used in the CSV. Then when I see X it is the end of a new piece of data. Is this a good idea?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending a CSV File over ble Gatt connection</title><link>https://devzone.nordicsemi.com/thread/243183?ContentTypeID=1</link><pubDate>Thu, 02 Apr 2020 12:22:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c1a89cd5-e192-4d83-93ac-29ea5bfc7438</guid><dc:creator>Edvin</dc:creator><description>[quote user="ThomasMorris"]When you state I have included my headers wrong. Where was this?[/quote]
&lt;p&gt;&amp;nbsp;It seems you have included the header files like you included your .c files. You must include header files by adding their location to this list:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-78e156a908c746e5ad6b3d7862e336cb/pastedimage1585830037955v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="ThomasMorris"]I have merged my code back together and I seem to have the same problem it is reading 51 bytes now however.[/quote]
&lt;p&gt;&amp;nbsp;What problem would that be?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;[quote user="ThomasMorris"][/quote]&lt;/p&gt;
&lt;p&gt;In order to get my SD card line to read the line for the csv I need to read 51 bytes otherwise:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;D1: 1584969092,1881,1843,1862,1862,-0.010000&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Does not output the right length of data.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Ok.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="ThomasMorris"]But when I output this via my gatt connection it only takes 30 bytes.[/quote]
&lt;p&gt;&amp;nbsp;What do you mean by &amp;quot;output this via my gatt&amp;quot;?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending a CSV File over ble Gatt connection</title><link>https://devzone.nordicsemi.com/thread/243110?ContentTypeID=1</link><pubDate>Thu, 02 Apr 2020 08:25:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5a1d7c50-a078-448d-b252-04d8e9102673</guid><dc:creator>Thomas</dc:creator><description>&lt;p&gt;I have merged my code back together and I seem to have the same problem it is reading 51 bytes now however.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In order to get my SD card line to read the line for the csv I need to read 51 bytes otherwise:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;D1: 1584969092,1881,1843,1862,1862,-0.010000&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Does not output the right length of data.&lt;/p&gt;
&lt;p&gt;But when I output this via my gatt connection it only takes 30 bytes.&lt;/p&gt;
&lt;p&gt;Why could this be?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending a CSV File over ble Gatt connection</title><link>https://devzone.nordicsemi.com/thread/243092?ContentTypeID=1</link><pubDate>Thu, 02 Apr 2020 07:24:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ed7c602d-ec5f-462d-b46a-387101cc52b4</guid><dc:creator>Thomas</dc:creator><description>&lt;p&gt;Thanks Edvin, I have just tested your code changes and it did output 51 bytes. But, I do not know what the issue was. I will now try re-add my code back in to restore my functionality and test with the changes that you have made.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;When you state I have included my headers wrong. Where was this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending a CSV File over ble Gatt connection</title><link>https://devzone.nordicsemi.com/thread/243033?ContentTypeID=1</link><pubDate>Wed, 01 Apr 2020 15:06:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a1f1b07f-d891-4044-afd6-c1cecdd52724</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Ok, a couple of general hints:&lt;/p&gt;
&lt;p&gt;Don&amp;#39;t include header files the way that you have done. These should only be included in the project settings&amp;#39; preprocessor setting: &amp;quot;Include directories&amp;quot;.&lt;/p&gt;
&lt;p&gt;I see that you have added the files nrf_nvic.c and nrf_soc.c with some modified options, including some header files that are not intended for use when you use the softdevice. I couldn&amp;#39;t compile the project before removing these.&lt;/p&gt;
&lt;p&gt;Then there was a warning, which you should always check. NB: When you compile a file but you haven&amp;#39;t done any changes, SES will ignore the previous warnings for these files. You didn&amp;#39;t include app_fifo.h in your main.c (or Setup.h). When I did, I saw that you had the wrong input parameters (none) on app_fifo_flush(); so I removed that call.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I didn&amp;#39;t manage to trigger the notification by your command sets. I just added the SEND_CSV function on a button press (button 4).&lt;/p&gt;
&lt;p&gt;Then I sent one notification, and that would send one packet of 51 bytes.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t know what the issue was, but I did a bit of cleaning in your project.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Can you try the attached modified project, and see if you get more than 51 bytes if you press button 4 after enabling notifications?&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-78e156a908c746e5ad6b3d7862e336cb/gatt_5F00_issue.zip"&gt;devzone.nordicsemi.com/.../gatt_5F00_issue.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>