<?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 behaviour changed automatically, numbers sent over RX Characteristic are not received the same on other side.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/72587/uart-behaviour-changed-automatically-numbers-sent-over-rx-characteristic-are-not-received-the-same-on-other-side</link><description>Hello, 
 In Nov 2020 I wrote a program for nRF52805 and it was working exactly as I expected it to. 
 Here is a small section of the code. 
 
 Basically, I just need to be able to change TX POWER, ADV Interval, and the name of the bt device. 
 Don&amp;#39;t mind</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 10 Mar 2021 18:11:11 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/72587/uart-behaviour-changed-automatically-numbers-sent-over-rx-characteristic-are-not-received-the-same-on-other-side" /><item><title>RE: UART behaviour changed automatically, numbers sent over RX Characteristic are not received the same on other side.</title><link>https://devzone.nordicsemi.com/thread/299110?ContentTypeID=1</link><pubDate>Wed, 10 Mar 2021 18:11:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e7a2d3ed-a783-436c-9e14-3a9a5e899920</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;It could be code optimization that have changed, I suspect you will need to check with an embedded C expert if you wanted to dig into the details, I could at least find that the comparison you did had some issues;&amp;nbsp;that both&amp;nbsp;&lt;span&gt;int10 and&amp;nbsp;int100 and int1000 are all equal int10 if the comparison check the first 5 ascii characters.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART behaviour changed automatically, numbers sent over RX Characteristic are not received the same on other side.</title><link>https://devzone.nordicsemi.com/thread/299090?ContentTypeID=1</link><pubDate>Wed, 10 Mar 2021 16:05:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:403ef2e0-637b-4bd1-b456-fe79eb3283f9</guid><dc:creator>IMFROST</dc:creator><description>&lt;p&gt;I think the issue is that the codes that I am sending from nrF connect app are being sent in HEX to the device instead of string. So the zeroes at the end of each code mess up the outcome.&lt;br /&gt;&lt;br /&gt;So I did a workaround by adding alphabets to the end of each command and now it works.&lt;/p&gt;
&lt;p&gt;&lt;br /&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)
    {
        NRF_LOG_DEBUG(&amp;quot;Received data from BLE NUS.&amp;quot;);
        NRF_LOG_HEXDUMP_INFO(p_evt-&amp;gt;params.rx_data.p_data, p_evt-&amp;gt;params.rx_data.length);

        if((memcmp(p_evt-&amp;gt;params.rx_data.p_data,&amp;quot;dfu&amp;quot;, p_evt-&amp;gt;params.rx_data.length) == 0))
        {
        enter_dfu_mode();
		    }

        if((memcmp(p_evt-&amp;gt;params.rx_data.p_data,&amp;quot;name&amp;quot;, p_evt-&amp;gt;params.rx_data.length) == 0))
        {
        nflag = 1;
		    }


        if((memcmp(p_evt-&amp;gt;params.rx_data.p_data,&amp;quot;tx0&amp;quot;, p_evt-&amp;gt;params.rx_data.length) == 0))
        {
        
	TX_POWER_LEVEL = (0);
            }
        if((memcmp(p_evt-&amp;gt;params.rx_data.p_data,&amp;quot;tx4&amp;quot;, p_evt-&amp;gt;params.rx_data.length) == 0))
        {
        TX_POWER_LEVEL = (+4);
        cflag = 1;
		    }
        if((memcmp(p_evt-&amp;gt;params.rx_data.p_data,&amp;quot;txm20&amp;quot;, p_evt-&amp;gt;params.rx_data.length) == 0))
        {
        TX_POWER_LEVEL = (-20);
        cflag = 1;
		    }
        if((memcmp(p_evt-&amp;gt;params.rx_data.p_data,&amp;quot;txm12&amp;quot;, p_evt-&amp;gt;params.rx_data.length) == 0))
        {
        TX_POWER_LEVEL = (-12);
        cflag = 1;
		    }
        if((memcmp(p_evt-&amp;gt;params.rx_data.p_data,&amp;quot;txm8&amp;quot;, p_evt-&amp;gt;params.rx_data.length) == 0))
        {
        TX_POWER_LEVEL = (-8);
        cflag = 1;
		    }
        if((memcmp(p_evt-&amp;gt;params.rx_data.p_data,&amp;quot;txm4&amp;quot;, p_evt-&amp;gt;params.rx_data.length) == 0))
        {
        TX_POWER_LEVEL = (-4);
        cflag = 1;
		    }


        if((memcmp(p_evt-&amp;gt;params.rx_data.p_data,&amp;quot;int100ms&amp;quot;, p_evt-&amp;gt;params.rx_data.length) == 0))
        {
        cflag = 1;
        APP_ADV_INTERVAL = 160;
		    }
        if((memcmp(p_evt-&amp;gt;params.rx_data.p_data,&amp;quot;int300ms&amp;quot;, p_evt-&amp;gt;params.rx_data.length) == 0))
        {
        cflag = 1;
        APP_ADV_INTERVAL = 480;
		    }
        if((memcmp(p_evt-&amp;gt;params.rx_data.p_data,&amp;quot;int500ms&amp;quot;, p_evt-&amp;gt;params.rx_data.length) == 0))
        {
        cflag = 1;
        APP_ADV_INTERVAL = 800;
		    }
        if((memcmp(p_evt-&amp;gt;params.rx_data.p_data,&amp;quot;int800ms&amp;quot;, p_evt-&amp;gt;params.rx_data.length) == 0))
        {
        cflag = 1;
        APP_ADV_INTERVAL = 1280;
		    }
        if((memcmp(p_evt-&amp;gt;params.rx_data.p_data,&amp;quot;int1sec&amp;quot;, p_evt-&amp;gt;params.rx_data.length) == 0))
        {
        cflag = 1;
        APP_ADV_INTERVAL= 1600;
		    }
        if((memcmp(p_evt-&amp;gt;params.rx_data.p_data,&amp;quot;int1.5sec&amp;quot;, p_evt-&amp;gt;params.rx_data.length) == 0))
        {
        cflag = 1;
        APP_ADV_INTERVAL = 2400;
		    }
        if((memcmp(p_evt-&amp;gt;params.rx_data.p_data,&amp;quot;int2sec&amp;quot;, p_evt-&amp;gt;params.rx_data.length) == 0))
        {
        cflag = 1;
        APP_ADV_INTERVAL= 3200;
        }
        if((memcmp(p_evt-&amp;gt;params.rx_data.p_data,&amp;quot;int3esc&amp;quot;, p_evt-&amp;gt;params.rx_data.length) == 0))
        {
        cflag = 1;
        APP_ADV_INTERVAL = 4800;
		    }
        if((memcmp(p_evt-&amp;gt;params.rx_data.p_data,&amp;quot;int4sec&amp;quot;, p_evt-&amp;gt;params.rx_data.length) == 0))
        {
        cflag = 1;
        APP_ADV_INTERVAL = 6000;
		    }
        if((memcmp(p_evt-&amp;gt;params.rx_data.p_data,&amp;quot;int5sec&amp;quot;, p_evt-&amp;gt;params.rx_data.length) == 0))
        {
        cflag = 1;
        APP_ADV_INTERVAL = 8000;
		    }
        if((memcmp(p_evt-&amp;gt;params.rx_data.p_data,&amp;quot;int6sec&amp;quot;, p_evt-&amp;gt;params.rx_data.length) == 0))
        {
        cflag = 1;
        APP_ADV_INTERVAL = 9600;
		    }
        if((memcmp(p_evt-&amp;gt;params.rx_data.p_data,&amp;quot;int7sec&amp;quot;, p_evt-&amp;gt;params.rx_data.length) == 0))
        {
        cflag = 1;
        APP_ADV_INTERVAL = 11200;
		    }
        if((memcmp(p_evt-&amp;gt;params.rx_data.p_data,&amp;quot;int8sec&amp;quot;, p_evt-&amp;gt;params.rx_data.length) == 0))
        {
        cflag = 1;
        APP_ADV_INTERVAL = 12800;
		    }
        if((memcmp(p_evt-&amp;gt;params.rx_data.p_data,&amp;quot;int9sec&amp;quot;, p_evt-&amp;gt;params.rx_data.length) == 0))
        {
        cflag = 1;
        APP_ADV_INTERVAL = 14400;
		    }
    }
}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;This is not a solution for the current problem. I remember sending codes like &amp;quot;int1000&amp;quot; and they were accepted before Jan 2021 but now something has happened and those same codes are not being accepted. Typing int100 activates the statement for &amp;quot;int10000&amp;quot; instead.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART behaviour changed automatically, numbers sent over RX Characteristic are not received the same on other side.</title><link>https://devzone.nordicsemi.com/thread/299054?ContentTypeID=1</link><pubDate>Wed, 10 Mar 2021 14:42:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4fb97922-ebbc-4a23-804c-7e118de0f07b</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;I assume this is pure luck/unluck/undefined with&amp;nbsp;your current implementation.&lt;/p&gt;
&lt;p&gt;To compare length I would assume you need to check that &amp;#39;p_evt-&amp;gt;params.rx_data.length&amp;#39; equal &amp;#39;sizeof(&amp;quot;int100&amp;quot;)&amp;#39;.&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART behaviour changed automatically, numbers sent over RX Characteristic are not received the same on other side.</title><link>https://devzone.nordicsemi.com/thread/299049?ContentTypeID=1</link><pubDate>Wed, 10 Mar 2021 14:31:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7e8385f1-38db-4e21-9629-1e1b9bd5f60a</guid><dc:creator>IMFROST</dc:creator><description>&lt;p&gt;Do you think something changed in the nRF connect app so now those values are different? Because when the factory was shipping the pcb around Mid December 2020 the codes were working but now they don&amp;#39;t work. Just having problem when sending zeroes.&lt;br /&gt;&lt;br /&gt;How do I check the length of the strings.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART behaviour changed automatically, numbers sent over RX Characteristic are not received the same on other side.</title><link>https://devzone.nordicsemi.com/thread/299034?ContentTypeID=1</link><pubDate>Wed, 10 Mar 2021 14:07:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d3f1701c-7b08-4cf9-a47a-7154116576d3</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;You should also check that the length of the two strings you want to compare are the same.&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>