<?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>Issue sending data from UART over mesh</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/35757/issue-sending-data-from-uart-over-mesh</link><description>Hi, 
 I&amp;#39;ve been working on a project where I need to send data from UART over mesh, I managed to create custom model for sending string data over mesh, I did merge UART example with mesh SDK, I started with light switch demo from mesh SDK v2.0.1 and with</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 04 Jul 2018 15:00:54 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/35757/issue-sending-data-from-uart-over-mesh" /><item><title>RE: Issue sending data from UART over mesh</title><link>https://devzone.nordicsemi.com/thread/139007?ContentTypeID=1</link><pubDate>Wed, 04 Jul 2018 15:00:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2edb6034-1fd0-4681-86a9-25833d568fc3</guid><dc:creator>Arij</dc:creator><description>&lt;p&gt;Here&amp;#39;s what ha&lt;span&gt;p&lt;/span&gt;&lt;span&gt;pen when I call&amp;nbsp;send_my_message(), there is a softdevice assert and a warning:&amp;nbsp;&amp;nbsp;&lt;strong&gt;mesh_softdevice_init.c,&amp;nbsp; 104, sd_ble_enable: app_ram_base should be adjusted to 0x200032C8&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/450x240/__key/communityserver-discussions-components-files/4/hiko.PNG" /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;For the&amp;nbsp;setup&amp;nbsp;&amp;nbsp;__LOG, I&amp;#39;am not sure if you talk about this&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/400x240/__key/communityserver-discussions-components-files/4/oil.PNG" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/ink.PNG" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;or the setup in sdk_config.h, actually I added the setup_config.h of the uart_example and add some defines from sdk_config.h of client example because I delete it from the project but in both files there is no defines for rtt or uart log enable, there is only nrf_log_enable which is set to 0&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If I comment out&amp;nbsp;printf, I don&amp;#39;t receive any data on the other node&amp;nbsp;and still have the same&amp;nbsp;problem&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue sending data from UART over mesh</title><link>https://devzone.nordicsemi.com/thread/138989?ContentTypeID=1</link><pubDate>Wed, 04 Jul 2018 13:38:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a85d3fe6-9e6b-4370-83bb-95b34e2d68b7</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Can you check what when wrong when you call&amp;nbsp;send_my_message() ? any assertion ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Did the application run normally after that or it crashed ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;How did you&amp;nbsp;setup&amp;nbsp;&amp;nbsp;__LOG&amp;nbsp; ? via RTT or UART ?&amp;nbsp;&lt;br /&gt;If you printing out log via UART you will have a conflict with your printf.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you comment out printf do you receive the data on the other node in mesh ?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue sending data from UART over mesh</title><link>https://devzone.nordicsemi.com/thread/138969?ContentTypeID=1</link><pubDate>Wed, 04 Jul 2018 12:58:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:732be266-8beb-4b72-a196-d0d35e0b1cd8</guid><dc:creator>Arij</dc:creator><description>&lt;p&gt;Hi again,&lt;/p&gt;
&lt;p&gt;I want the data that I receive on UART (string data) to send it over mesh, I tested with array of bytes as you said and it works,&amp;nbsp;but in my case I want to get any data sent by&lt;span&gt;&amp;nbsp;pc terminal(termite) to send it over mesh, I did a lot of tests and nothing wrong with mesh, now I switch using this function&amp;nbsp; to get data from UART:&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void uart_event_handle(app_uart_evt_t * p_event)
{
    if (p_event-&amp;gt;evt_type == APP_UART_DATA_READY)
    {
      while (app_uart_get(&amp;amp;cr) != NRF_SUCCESS);
        s[Index++] =  cr;
        s[Index] = 0;
        if(cr == &amp;#39;\n&amp;#39;)
        {
            printf(&amp;quot;RX end : %s\r\n&amp;quot;, s);   //show nothing     
            send_my_message(s); //fail here 
            Index = 0;
        }
     }
    
    if (p_event-&amp;gt;evt_type == APP_UART_COMMUNICATION_ERROR)
    {
        APP_ERROR_HANDLER(p_event-&amp;gt;data.error_communication);
    }
    else if(p_event-&amp;gt;evt_type == APP_UART_FIFO_ERROR)
    {
        APP_ERROR_HANDLER(p_event-&amp;gt;data.error_code);
    }
}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;So this function works fine when I don&amp;#39;t add send_my_message() function as shown in line 11 above in code, but when add it,&amp;nbsp; it stuck and the function shows nothing&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;here is result without send_my_message() function&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/ssss.PNG" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;and here with&amp;nbsp;send_my_message() function&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/450x240/__key/communityserver-discussions-components-files/4/5824.aaaa.PNG" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;send_my_function() is mentioned in my&amp;nbsp;previous comment,&amp;nbsp;please help&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue sending data from UART over mesh</title><link>https://devzone.nordicsemi.com/thread/138086?ContentTypeID=1</link><pubDate>Thu, 28 Jun 2018 11:26:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:54d51511-4a90-4a43-a058-1866ba6d7684</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Arji,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Please try testing with sending an array of bytes. Don&amp;#39;t play with string first.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You can try to send something like&amp;nbsp;&lt;/p&gt;
&lt;p&gt;uint8_t data_array = {1,2,3,4,5}&lt;/p&gt;
&lt;p&gt;And check on the other side if you receive 1 2 3 4 5 array or not. To print an array out , you can use a loop and print each&amp;nbsp;element out.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Main different between a string and byte array is the terminate character. In C it&amp;#39;s the NULL character (0). But I don&amp;#39;t think this char sent over mesh because of the length.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue sending data from UART over mesh</title><link>https://devzone.nordicsemi.com/thread/137963?ContentTypeID=1</link><pubDate>Wed, 27 Jun 2018 16:32:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:136236dc-6175-44f6-992c-33d5bc57194b</guid><dc:creator>Arij</dc:creator><description>&lt;p&gt;&lt;span&gt;Now this function&amp;nbsp;&lt;/span&gt;&lt;span&gt;&lt;strong&gt;__LOG(LOG_SRC_ACCESS, LOG_LEVEL_DBG1, &amp;quot;TX: Msg %s\n&amp;quot;, p_tx_message-&amp;gt;p_buffer)&amp;nbsp;&lt;/strong&gt;work for&amp;nbsp;printing the message, I don&amp;#39;t know why it doesn&amp;#39;t at first when I added it, but now my&amp;nbsp;problem is when I send data from&amp;nbsp;pc (termite terminal) to my board and send it over mesh, It will be sent like this&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/www.PNG" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;this is the log of the sending side&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/400x240/__key/communityserver-discussions-components-files/4/fr.PNG" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;here what I receive on the othe side&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/400x240/__key/communityserver-discussions-components-files/4/swe.PNG" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;and here is a snippet of my code&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;for (;;)
    {
        (void)sd_app_evt_wait();
       // uint8_t cr;
        char s[5];

      uint32_t status = NRF_SUCCESS;

      // while (app_uart_get(&amp;amp;cr) != NRF_SUCCESS);
      // while (app_uart_put(cr) != NRF_SUCCESS);

     uart_getstring(s);  
     uart_putstring(s);

     printf(&amp;quot; message : %s \n &amp;quot;, s);
      
     send_my_message(s); 

    }&lt;/pre&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;This is my send_my_message() function&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void send_my_message (uint8_t* s) 
{
    uint32_t status=0;
    uint8_t buffer[5];
    strcpy(buffer, s);                         
    uint8_t length;
    access_message_tx_t msg;
    length= sizeof(buffer);
             if (length)
                { 
                  msg.opcode.opcode = simple_message_OPCODE_SEND;
                  msg.opcode.company_id = 0x0059; // Nordic&amp;#39;s company ID
                  msg.p_buffer = (const uint8_t *) &amp;amp;buffer[0];
                  msg.length =length;
                  
                 status= simple_message_client_set_unreliable(&amp;amp;m_clients[0], buffer, length);
                 __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Status : %u \n&amp;quot;, status);
                        
                
                  if (status == NRF_ERROR_INVALID_STATE ||
                  status == NRF_ERROR_BUSY||status == NRF_ERROR_NO_MEM)
                   {
                     __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Cannot send. Device is busy.\n&amp;quot;);
                      hal_led_blink_ms(LEDS_MASK, 50, 4);
                   }
                   else
                   {
                         ERROR_CHECK(status);
                   }
                }
}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The string data is sent separately,&amp;nbsp;please help&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue sending data from UART over mesh</title><link>https://devzone.nordicsemi.com/thread/137956?ContentTypeID=1</link><pubDate>Wed, 27 Jun 2018 15:25:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a5e67dc0-0f8b-4e97-8d44-2446975c2fb1</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;How do you check on the other side if you are receiving correct data ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The way you printing the message out is not very correct. It&amp;#39;s a byte array, not a string. It&amp;#39;s better to do a loop to print out every byte of the array instead of doing that. And please do the same with the RX on the other side. You may want to print the payload length out also.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue sending data from UART over mesh</title><link>https://devzone.nordicsemi.com/thread/137733?ContentTypeID=1</link><pubDate>Tue, 26 Jun 2018 15:21:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fecb1028-9456-4aff-936b-ae3a0da301e8</guid><dc:creator>Arij</dc:creator><description>&lt;p&gt;I added the call&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;strong&gt;__LOG(LOG_SRC_ACCESS, LOG_LEVEL_DBG1, &amp;quot;TX: Msg %s \n&amp;quot;, p_tx_message-&amp;gt;p_buffer) &lt;/strong&gt;to packet_tx() function in access.c&lt;strong&gt;, &lt;/strong&gt;but it doesn&amp;#39;t show my messages, I&amp;#39;m not sure if I&amp;#39;m doing it right,&lt;/p&gt;
&lt;p&gt;I verified my mesh functions and they work normally, I&amp;#39;am able to send and receive my messages over mesh from server to client and vice versa when I &lt;span&gt;press a button&lt;/span&gt;, but not the messages that I want to send from UART.&lt;/p&gt;
&lt;p&gt;Yes I tested that exam&lt;span&gt;ple combining light switch example SDK v2.0.1 and ble_app_uart sdk v15 and I&amp;#39;am using it on the server side in order to get the data received from the&amp;nbsp;phone and&amp;nbsp;put it on mesh but I&amp;#39;m struggling on how to acheive that.&amp;nbsp;Could you&amp;nbsp;please check my code above and see if it&amp;#39;s correct, thank you&amp;nbsp;&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue sending data from UART over mesh</title><link>https://devzone.nordicsemi.com/thread/137696?ContentTypeID=1</link><pubDate>Tue, 26 Jun 2018 13:20:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0151bd14-b09c-40f9-b8c4-aebeac6e0463</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Arij,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I would suggest to set the logging debug level to&amp;nbsp;LOG_LEVEL_DBG1 when init logging module, and in&amp;nbsp;mesh_msg_handle() in access.c you print out more information in the call&amp;nbsp;&amp;nbsp;__LOG(LOG_SRC_ACCESS, LOG_LEVEL_DBG1, &amp;quot;RX: [aop: 0x%04x]\n&amp;quot;, opcode.opcode); so that it not only printout opcode but also other information such as message src, dst, length, buffer, etc.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You can do the same inside&amp;nbsp;packet_tx() as well.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;By doing this you can monitor all message processed at the node.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Have you verified that you mesh functions normally ? You can control LED on and off from your client ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;How did you check that your&amp;nbsp;&lt;strong&gt;send_my_message() &lt;/strong&gt;sends random data ? Please try to send just one byte first.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;We posted an example &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/29108/how-to-add-mesh-into-nrf5-sdk-v14-1-ble-and-sdk-v15-application"&gt;here&lt;/a&gt; combining light switch example SDK v2.0.1 and ble_app_uart for SDK v15&amp;nbsp;not sure if needed for you though.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue sending data from UART over mesh</title><link>https://devzone.nordicsemi.com/thread/137555?ContentTypeID=1</link><pubDate>Tue, 26 Jun 2018 01:28:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f10a3044-5fca-4dab-a612-3792718a2a51</guid><dc:creator>Arij</dc:creator><description>&lt;p&gt;&lt;strong&gt;U&lt;/strong&gt;&lt;span&gt;&lt;strong&gt;pdate&lt;/strong&gt; I used uart_event_handle function instead of uart_getstring and uart_putstring but still not able to send data over mesh&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I only modified uart_error_handle() and commented&amp;nbsp;uart_putstring&amp;nbsp;and&amp;nbsp;uart_getstring&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void uart_error_handle(app_uart_evt_t * p_event)
{
    //added 
    if (p_event-&amp;gt;evt_type == APP_UART_DATA_READY)
    {
      while (app_uart_get(&amp;amp;cr) != NRF_SUCCESS);
        s[Index++] =  cr;
        s[Index] = 0;
        if(cr == &amp;#39;\n&amp;#39;)
        {
            printf(&amp;quot;RX end : %s\r\n&amp;quot;, s);
            
            send_my_message(s); //failed to pass s value to this function
           
            Index = 0;
        }
    }
    
    else if (p_event-&amp;gt;evt_type == APP_UART_COMMUNICATION_ERROR)
    {
        APP_ERROR_HANDLER(p_event-&amp;gt;data.error_communication);
    }
    else if(p_event-&amp;gt;evt_type == APP_UART_FIFO_ERROR)
    {
        APP_ERROR_HANDLER(p_event-&amp;gt;data.error_code);
    }
}

//send_my_message function

void send_my_message (uint8_t* s)                          
{
    uint32_t status=0;
    uint8_t buffer[10];
    strcpy(buffer, s);                          
    uint8_t length;
    uint16_t address;
    access_message_tx_t msg;
    length= sizeof(buffer);
               if (length)
                { 
                  msg.opcode.opcode = simple_message_OPCODE_SEND;
                  msg.opcode.company_id = 0x0059; // Nordic&amp;#39;s company ID
                  msg.p_buffer = (const uint8_t *) &amp;amp;buffer[0];
                  msg.length =length;
                 status= simple_message_client_set_unreliable(&amp;amp;m_clients[0], buffer, length);
                 __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Status : %u \n&amp;quot;, status);
                        

                  if (status == NRF_ERROR_INVALID_STATE ||
                  status == NRF_ERROR_BUSY||status == NRF_ERROR_NO_MEM)
                   {
                     __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Cannot send. Device is busy.\n&amp;quot;);
                      hal_led_blink_ms(LEDS_MASK, 50, 4);
                   }
                   else
                   {
                         ERROR_CHECK(status);
                   }
                }
}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>