<?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>I am using the NRF2840 and WaveShare&amp;#39;s 2.9 epaper display to make a cutdown tool, but I am facing some problems.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/51654/i-am-using-the-nrf2840-and-waveshare-s-2-9-epaper-display-to-make-a-cutdown-tool-but-i-am-facing-some-problems</link><description>I have realized the cutdown function with the examples. But now I want to reflesh the number I have published, which means that I first publish a number, then I want to publish a new number. But now, the new number i published can&amp;#39;t preemptive the old</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 05 Sep 2019 08:03:02 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/51654/i-am-using-the-nrf2840-and-waveshare-s-2-9-epaper-display-to-make-a-cutdown-tool-but-i-am-facing-some-problems" /><item><title>RE: I am using the NRF2840 and WaveShare's 2.9 epaper display to make a cutdown tool, but I am facing some problems.</title><link>https://devzone.nordicsemi.com/thread/208124?ContentTypeID=1</link><pubDate>Thu, 05 Sep 2019 08:03:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ab14b2b8-05f0-42dd-9eb2-63ca979aeddd</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;You&amp;#39;re welcome.&lt;/p&gt;
&lt;p&gt;If the issue is now resolved, please verify the answer:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/4456._5F00_Verify_2D00_answer_2D00_nordic.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I am using the NRF2840 and WaveShare's 2.9 epaper display to make a cutdown tool, but I am facing some problems.</title><link>https://devzone.nordicsemi.com/thread/208071?ContentTypeID=1</link><pubDate>Thu, 05 Sep 2019 01:59:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:43b144c0-1b7f-46e6-86fd-4591afeb9781</guid><dc:creator>leo li</dc:creator><description>&lt;p&gt;It&amp;#39;s indeed the problem of my design. But I have solved that problem with Edvin&amp;#39;s help. Thank you very much for your insistent attention to my problem.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I am using the NRF2840 and WaveShare's 2.9 epaper display to make a cutdown tool, but I am facing some problems.</title><link>https://devzone.nordicsemi.com/thread/208070?ContentTypeID=1</link><pubDate>Thu, 05 Sep 2019 01:56:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:53911b20-a5a7-4ae1-9ef5-6904b6dfe237</guid><dc:creator>leo li</dc:creator><description>&lt;p&gt;That&amp;#39;s exactly what I mean.&amp;nbsp;I solved the problem&amp;nbsp;with your help.&amp;nbsp;Thank you very much for your kindly help these days.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I am using the NRF2840 and WaveShare's 2.9 epaper display to make a cutdown tool, but I am facing some problems.</title><link>https://devzone.nordicsemi.com/thread/207616?ContentTypeID=1</link><pubDate>Tue, 03 Sep 2019 09:27:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:704f846e-ccd8-48c2-a9fa-59ac51399d37</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Ok, I see.&lt;/p&gt;
&lt;p&gt;The issue is that you are handling your entire countdown in the&amp;nbsp;nus_data_handler(). Hence, when a new number enters, it is not able to handle that callback until you finish the handler that you are in now. They are two equal events with the same priority, so the new number is not called until the previous has returned.&lt;/p&gt;
&lt;p&gt;I suggest you do something like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;volatile uint32_t time_now_s = 0;       // remember to use volatile
volatile bool start_countdown = false;  // remember to use volatile
static void nus_data_handler(...)
{
    if (p_evt-&amp;gt;type == BLE_NUS_EVT_RX_DATA)
    {
        time_now_s = atoi((char*)p_evt-&amp;gt;params.rx_...;
        start_countdown = true;
    }
}

static void start_my_countdown()
{
    while(time_now_s &amp;gt; 0)
    {
        time_now_s--;
        ...
    }
}

main()
{
    ...
    for(;;)
    {
        if(start_countdown)
        {
            start_my_countdown();
            start_countdown = false;
        }
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;But that is also not perfect. You should really use a timer that has a timeout of 1 second or whatever resolution you need, and use the timeout handler to decrement time_now_s and update the display. This way, you will allow the nRF to go to sleep to save some power while you are running the countdown as well.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I am using the NRF2840 and WaveShare's 2.9 epaper display to make a cutdown tool, but I am facing some problems.</title><link>https://devzone.nordicsemi.com/thread/207587?ContentTypeID=1</link><pubDate>Tue, 03 Sep 2019 08:29:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:26b216d9-0461-4dcf-9905-5b1207a1fc13</guid><dc:creator>awneil</dc:creator><description>[quote userid="83013" url="~/f/nordic-q-a/51654/i-am-using-the-nrf2840-and-waveshare-s-2-9-epaper-display-to-make-a-cutdown-tool-but-i-am-facing-some-problems/207533"] I just can&amp;#39;t abort the countdown[/quote]
&lt;p&gt;Why not?&lt;/p&gt;
&lt;p&gt;What&amp;#39;s the problem?&lt;/p&gt;
[quote userid="83013" url="~/f/nordic-q-a/51654/i-am-using-the-nrf2840-and-waveshare-s-2-9-epaper-display-to-make-a-cutdown-tool-but-i-am-facing-some-problems/207533"]maybe it&amp;#39;s because of that the Nordic UART Service is FIFO[/quote]
&lt;p&gt;Why would that be a problem?&lt;/p&gt;
&lt;p&gt;It&amp;#39;s &lt;em&gt;&lt;strong&gt;your&lt;/strong&gt; &lt;/em&gt;code that does the countdown - so &lt;em&gt;&lt;strong&gt;you&lt;/strong&gt; &lt;/em&gt;should know how to abort it!&lt;/p&gt;
&lt;p&gt;Can you get this working on its own - without the added complication of BLE?&lt;/p&gt;
&lt;p&gt;It sounds like a problem with your system &lt;em&gt;design&lt;/em&gt; ...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I am using the NRF2840 and WaveShare's 2.9 epaper display to make a cutdown tool, but I am facing some problems.</title><link>https://devzone.nordicsemi.com/thread/207533?ContentTypeID=1</link><pubDate>Tue, 03 Sep 2019 06:12:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cece907b-9e49-442a-963c-d40ccbadbdfa</guid><dc:creator>leo li</dc:creator><description>&lt;p&gt;I have update some of my code in the reply to &lt;em&gt;Edvin. &lt;/em&gt;Maybe that will help you to understand my thoughts. I just can&amp;#39;t abort the countdown, maybe it&amp;#39;s because of that the Nordic UART Service is FIFO?&lt;/p&gt;
&lt;p&gt;Thank you for your continuous attention to my questions.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I am using the NRF2840 and WaveShare's 2.9 epaper display to make a cutdown tool, but I am facing some problems.</title><link>https://devzone.nordicsemi.com/thread/207532?ContentTypeID=1</link><pubDate>Tue, 03 Sep 2019 06:05:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:62270bd1-f03b-4498-87dc-27611398a393</guid><dc:creator>leo li</dc:creator><description>&lt;p&gt;Yes, this is exactly what I mean. I want to abort the current countdown and start it with the new number. But I don&amp;#39;t know how to realize this function. I just rewrite the nus_data_handler() function with a very easy logic. I changed the receive data into int, and let it decrease. The code is like this:&lt;/p&gt;
&lt;div&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void nus_data_handler(ble_nus_evt_t * p_evt)
{
     if (p_evt-&amp;gt;type == BLE_NUS_EVT_RX_DATA)
    {
    
        int time_now_s;

        time_now_s=atoi((char*)p_evt-&amp;gt;params.rx_data.p_data);
        ...
        ...
        ...
         while(time_now_s&amp;gt;0) 
		 {
            time_now_s--;
            ...
            ...
            ...&lt;/pre&gt;&lt;/div&gt;
&lt;div&gt;And the service_init() function is like this:&lt;/div&gt;
&lt;div&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void services_init(void)
{
    uint32_t           err_code;
    ble_nus_init_t     nus_init;
    nrf_ble_qwr_init_t qwr_init = {0};
	//	ble_nus_evt_t *pp_evt;

    // Initialize Queued Write Module.
    qwr_init.error_handler = nrf_qwr_error_handler;

    err_code = nrf_ble_qwr_init(&amp;amp;m_qwr, &amp;amp;qwr_init);
    APP_ERROR_CHECK(err_code);

    // Initialize NUS.
    memset(&amp;amp;nus_init, 0, sizeof(nus_init));
	
	
    nus_init.data_handler = nus_data_handler;
	
    err_code = ble_nus_init(&amp;amp;m_nus, &amp;amp;nus_init);
    APP_ERROR_CHECK(err_code);
}&lt;/pre&gt;&lt;/div&gt;
&lt;div&gt;I don&amp;#39;t know whether these code will help you to understand my meanings or not.&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;Thank you for your continuous attention to my questions.&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I am using the NRF2840 and WaveShare's 2.9 epaper display to make a cutdown tool, but I am facing some problems.</title><link>https://devzone.nordicsemi.com/thread/207335?ContentTypeID=1</link><pubDate>Mon, 02 Sep 2019 09:37:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2ba8186c-372e-4b18-b1dd-3ab6661c08c8</guid><dc:creator>awneil</dc:creator><description>[quote userid="83013" url="~/f/nordic-q-a/51654/i-am-using-the-nrf2840-and-waveshare-s-2-9-epaper-display-to-make-a-cutdown-tool-but-i-am-facing-some-problems/207324"]I am using the bluetooth uart module.[/quote]
&lt;p&gt;You mean the Nordic UART Service (NUS) ?&lt;/p&gt;
&lt;p&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.3.0/group__ble__nus.html"&gt;https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.3.0/group__ble__nus.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.3.0/ble_sdk_app_nus_eval.html"&gt;https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.3.0/ble_sdk_app_nus_eval.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;As &lt;a href="https://devzone.nordicsemi.com/members/edvin-holmseth"&gt;Edvin&lt;/a&gt; says, that gives you an Event when data is received.&lt;/p&gt;
&lt;p&gt;So it&amp;#39;s up to &lt;strong&gt;&lt;em&gt;your&lt;/em&gt; code&lt;/strong&gt; to do whatever &lt;em&gt;&lt;strong&gt;you&lt;/strong&gt; &lt;/em&gt;want when that Event occurs.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I am using the NRF2840 and WaveShare's 2.9 epaper display to make a cutdown tool, but I am facing some problems.</title><link>https://devzone.nordicsemi.com/thread/207333?ContentTypeID=1</link><pubDate>Mon, 02 Sep 2019 09:30:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:25ad4bf6-7aa1-43a3-8802-bbe8b238db7a</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;When you write a new number it will replace the old number in the service. If the counter isn&amp;#39;t updated, then that is because of how you treat it in your application.&lt;/p&gt;
&lt;p&gt;The nus_data_handler() is called when you &amp;quot;refresh&amp;quot; the number by sending the number to your characteristic. How you use this number after that is up to the application. I don&amp;#39;t know how you use this event, and how you start your countdown, but it sounds like you need to abort the current countdown, and start it again with the new number.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I am using the NRF2840 and WaveShare's 2.9 epaper display to make a cutdown tool, but I am facing some problems.</title><link>https://devzone.nordicsemi.com/thread/207331?ContentTypeID=1</link><pubDate>Mon, 02 Sep 2019 09:29:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7e2455cf-4dd4-4399-a297-2b2a72c0791d</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;It&amp;#39;s still unclear what your actual problem is:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Transferring the new number over BLE to your module?&lt;br /&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;In your module firmware, getting access to the new number?&lt;br /&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Writing the new number onto the display?&lt;br /&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Other ... ?&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Again, the question of how to write to and update the display has nothing to do with Nordic: the display neither knows nor cares what microcontroller you use - it works the same whatever is driving it.&lt;/p&gt;
&lt;p&gt;Therefore, you need to go to the display &lt;strong&gt;documentation&lt;/strong&gt;, and/or the &lt;strong&gt;manufacturer&lt;/strong&gt;, for details of how to control the display.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I am using the NRF2840 and WaveShare's 2.9 epaper display to make a cutdown tool, but I am facing some problems.</title><link>https://devzone.nordicsemi.com/thread/207324?ContentTypeID=1</link><pubDate>Mon, 02 Sep 2019 09:20:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9c39a705-f084-4adc-bd30-6c2f7020fee2</guid><dc:creator>leo li</dc:creator><description>&lt;p&gt;I am using the bluetooth uart module. I wish the new number would replace the old one immediately. But now the number will replace when the old one decreases to 0. I wonder if the NRF52840 module is preemptive or not and how to realize this function.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I am using the NRF2840 and WaveShare's 2.9 epaper display to make a cutdown tool, but I am facing some problems.</title><link>https://devzone.nordicsemi.com/thread/207319?ContentTypeID=1</link><pubDate>Mon, 02 Sep 2019 09:06:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:18597caf-bbda-42ef-8079-b6f8c7fe37a4</guid><dc:creator>Edvin</dc:creator><description>[quote user="leo li"]For example, I have passed a number and the number is decreasing on the e-paper. But now I want to restart the cutdown with a new number, how could I realize this function.[/quote]
&lt;p&gt;&amp;nbsp;Probably the same way that you sent the number the first time. How did you do that? And what happens if you try to refresh the number the same way that you did earlier?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I am using the NRF2840 and WaveShare's 2.9 epaper display to make a cutdown tool, but I am facing some problems.</title><link>https://devzone.nordicsemi.com/thread/207311?ContentTypeID=1</link><pubDate>Mon, 02 Sep 2019 08:52:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4c5d7c68-0fc3-4b3d-9f02-88e36a222f88</guid><dc:creator>leo li</dc:creator><description>&lt;p&gt;Thank you for your reply. I am sorry that I don&amp;#39;t describe my question very clearly. I have update my question in the previous answers by awneil. You can go to that answer to know further things. Thank you very much.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I am using the NRF2840 and WaveShare's 2.9 epaper display to make a cutdown tool, but I am facing some problems.</title><link>https://devzone.nordicsemi.com/thread/207305?ContentTypeID=1</link><pubDate>Mon, 02 Sep 2019 08:41:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:75beb0a8-3cfa-4774-8f06-4c09604a9812</guid><dc:creator>leo li</dc:creator><description>&lt;p&gt;I&amp;nbsp;want to use the Bluetooth module of the NRF52840&amp;nbsp;to make a remote control cutdown tool. So&amp;nbsp;I&amp;nbsp;use the mobile APP to send numbers to the NRF52840.&amp;nbsp;This is the meaning of the&amp;nbsp;&amp;quot;published&amp;quot;. The problem is that I don&amp;#39;t know how to reflesh the number.&lt;/p&gt;
&lt;p&gt;For example, I have passed a number and the number is decreasing on the e-paper. But now I want to restart the cutdown with a new number, how could I realize this function.&lt;/p&gt;
&lt;p&gt;Thank you very much for your timely reply.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I am using the NRF2840 and WaveShare's 2.9 epaper display to make a cutdown tool, but I am facing some problems.</title><link>https://devzone.nordicsemi.com/thread/207302?ContentTypeID=1</link><pubDate>Mon, 02 Sep 2019 08:37:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:43bdd2fc-df1e-4135-87a2-dc0d0100609c</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;I don&amp;#39;t know your setup Leo, but if the issue is that the numbers are stacked on top of each other, it sounds like you need to clear the screen first. How you do that, I don&amp;#39;t know, but it is probably documented somewhere around the same place as you found out how to write to the epaper display.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I am using the NRF2840 and WaveShare's 2.9 epaper display to make a cutdown tool, but I am facing some problems.</title><link>https://devzone.nordicsemi.com/thread/207299?ContentTypeID=1</link><pubDate>Mon, 02 Sep 2019 08:23:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b0f8021d-1293-475b-bca5-928c8f3bd5ad</guid><dc:creator>awneil</dc:creator><description>[quote userid="83013" url="~/f/nordic-q-a/51654/i-am-using-the-nrf2840-and-waveshare-s-2-9-epaper-display-to-make-a-cutdown-tool-but-i-am-facing-some-problems"]the number I have published[/quote]
&lt;p&gt;What do you mean by &amp;quot;&lt;em&gt;published&lt;/em&gt;&amp;quot; here?&lt;/p&gt;
[quote userid="83013" url="~/f/nordic-q-a/51654/i-am-using-the-nrf2840-and-waveshare-s-2-9-epaper-display-to-make-a-cutdown-tool-but-i-am-facing-some-problems"]the new&amp;nbsp;number i published can&amp;#39;t preemptive the old number[/quote]
&lt;p&gt;What do you mean by that?&lt;/p&gt;
[quote userid="83013" url="~/f/nordic-q-a/51654/i-am-using-the-nrf2840-and-waveshare-s-2-9-epaper-display-to-make-a-cutdown-tool-but-i-am-facing-some-problems"]I want to know how to replace the old number.[/quote]
&lt;p&gt;You mean, how to update the display?&lt;/p&gt;
&lt;p&gt;That has nothing to do with Nordic - you need to contact the display manufacturer (WaveShare?)&amp;nbsp;for that.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>