<?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>how to merge the uart and timer program</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/42090/how-to-merge-the-uart-and-timer-program</link><description>hi... folks 
 i am using nrf53832 , i want to merge the uart and timer . i tried my level best but timer is not working 
 help me 
 thanks in advance</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 08 Jan 2019 07:50:03 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/42090/how-to-merge-the-uart-and-timer-program" /><item><title>RE: how to merge the uart and timer program</title><link>https://devzone.nordicsemi.com/thread/164425?ContentTypeID=1</link><pubDate>Tue, 08 Jan 2019 07:50:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1c367c6d-a689-4bd8-bc46-1181c381417d</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;I do not follow see how this code relates to what we have been discussing earlier in this thread?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to merge the uart and timer program</title><link>https://devzone.nordicsemi.com/thread/164415?ContentTypeID=1</link><pubDate>Tue, 08 Jan 2019 06:51:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9d382736-76c4-43e4-b594-2e43a6821c35</guid><dc:creator>ps_anu</dc:creator><description>&lt;p&gt;how to compare ,actually here i want to check the data&amp;nbsp; see the code&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void timer_sensor_event_handler(void)
{   
uint32_t threshold = 32;
 char str[80];
uint32_t length1;
     char pavi;

 char event;
    
  
    
    switch (event)
    {
             
           
       if(m_sample &amp;lt; threshold)
            {
           length1 = sprintf(str,&amp;quot;%d&amp;quot;, m_sample);
              ble_nus_data_send(&amp;amp;m_nus,str,sizeof(m_sample), m_conn_handle);
              ret_code_t err_code = nrf_drv_twi_rx(&amp;amp;m_twi, 0x48U, &amp;amp;m_sample, sizeof(m_sample));
               NRF_LOG_INFO(&amp;quot;SUCCESS1&amp;quot;);              
             }
  break;

        default:
            //Do nothing.
            break;
  }
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to merge the uart and timer program</title><link>https://devzone.nordicsemi.com/thread/163968?ContentTypeID=1</link><pubDate>Fri, 04 Jan 2019 13:35:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:95af8d37-d65e-49bf-b997-af8005b23d35</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;In the code you posted you calculate the time_ticks like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;time_ticks = nrf_drv_timer_ms_to_ticks(&amp;amp;TIMER_SENSOR, time_ms);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;but you never actually use it. There is no wonder your timer is not running. Please compare with the timer example or the code snippet I pasted in my previous answer where you see the line you are missing (assuming this is what you want to do).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to merge the uart and timer program</title><link>https://devzone.nordicsemi.com/thread/163939?ContentTypeID=1</link><pubDate>Fri, 04 Jan 2019 11:58:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a7fc1bc4-767c-48cc-b3a7-b2d334535fa8</guid><dc:creator>ps_anu</dc:creator><description>&lt;p&gt;i didn&amp;#39;t get you... can you say me clearly&lt;/p&gt;
&lt;p&gt;&lt;span&gt;(you are not using your calculated time_ticks variable for anything).??&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to merge the uart and timer program</title><link>https://devzone.nordicsemi.com/thread/163747?ContentTypeID=1</link><pubDate>Thu, 03 Jan 2019 12:30:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:763311e6-d1d9-4e7f-8842-f816103d2b09</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;It seems you have copied the timer code from the SDK timer example, but you have forgotten to start it (you are not using your calculated time_ticks variable for anything). Referring to the example and assuming that is what you want to do, you are missing the call to&amp;nbsp;nrf_drv_timer_extended_compare(). Your timer code should probably be something similar to this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    //Configure TIMER_SENSOR for generating simple light effect - leds on board will invert his state one after the other.
    nrf_drv_timer_config_t timer_cfg = NRF_DRV_TIMER_DEFAULT_CONFIG;
    err_code = nrf_drv_timer_init(&amp;amp;TIMER_SENSOR, &amp;amp;timer_cfg, timer_sensor_event_handler);
    APP_ERROR_CHECK(err_code);

    time_ticks = nrf_drv_timer_ms_to_ticks(&amp;amp;TIMER_SENSOR, time_ms);

    nrf_drv_timer_extended_compare(
         &amp;amp;TIMER_SENSOR, NRF_TIMER_CC_CHANNEL0, time_ticks, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, true);&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to merge the uart and timer program</title><link>https://devzone.nordicsemi.com/thread/163707?ContentTypeID=1</link><pubDate>Thu, 03 Jan 2019 11:04:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6c6291d0-e463-4cbc-a8d1-0d043ef2cc70</guid><dc:creator>ps_anu</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;int main(void)
  {
    bool erase_bonds;

    // Initialize.
    uart_init();
    log_init();
    timers_init();
    buttons_leds_init(&amp;amp;erase_bonds);
    power_management_init();
    ble_stack_init();
    gap_params_init();
    gatt_init();
    services_init();
    advertising_init();
    conn_params_init();
 
    // Start execution.
    printf(&amp;quot;\r\nUART started.\r\n&amp;quot;);
    NRF_LOG_INFO(&amp;quot;Debug logging for UART over RTT started.&amp;quot;);
    advertising_start();
     twi_init();
     MAX30_set_mode();
     
     while(true)
   
    

    nrf_delay_ms(5000);
    m_xfer_done == false;
   
  
    uint32_t time_ms = 500; //Time(in miliseconds) between consecutive compare events.
    uint32_t time_ticks;
    uint32_t err_code = NRF_SUCCESS;

    //Configure all leds on board.
    bsp_board_init(BSP_INIT_LEDS);

    //Configure TIMER_LED for generating simple light effect - leds on board will invert his state one after the other.
    nrf_drv_timer_config_t timer_cfg = NRF_DRV_TIMER_DEFAULT_CONFIG;
   err_code = nrf_drv_timer_init(&amp;amp;TIMER_SENSOR, &amp;amp;timer_cfg, timer_sensor_event_handler);
    APP_ERROR_CHECK(err_code);

    time_ticks = nrf_drv_timer_ms_to_ticks(&amp;amp;TIMER_SENSOR, time_ms);


   
    
    }
    
    &lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to merge the uart and timer program</title><link>https://devzone.nordicsemi.com/thread/163695?ContentTypeID=1</link><pubDate>Thu, 03 Jan 2019 10:12:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a7d514f6-0142-45a7-acaa-f926ea9b1bbd</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Can you upload your code so that we can see how you use the timer?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to merge the uart and timer program</title><link>https://devzone.nordicsemi.com/thread/163681?ContentTypeID=1</link><pubDate>Thu, 03 Jan 2019 09:54:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:16dc0b8f-8511-44dd-99b9-3b87e5e1315b</guid><dc:creator>ps_anu</dc:creator><description>&lt;p&gt;i have given the timer for one minute , when i debug the program , i am getting the data within the&amp;nbsp; seconds , my timer is not running&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to merge the uart and timer program</title><link>https://devzone.nordicsemi.com/thread/163677?ContentTypeID=1</link><pubDate>Thu, 03 Jan 2019 09:49:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:03aa8c1a-8b3c-488b-a198-1857911b570a</guid><dc:creator>ps_anu</dc:creator><description>&lt;p&gt;yeah , i merged the timer example program with uart . but i couldn&amp;#39;t find , my timer is not running&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to merge the uart and timer program</title><link>https://devzone.nordicsemi.com/thread/163648?ContentTypeID=1</link><pubDate>Thu, 03 Jan 2019 07:19:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:defd51b6-4960-4483-9b67-b21ca53d8fe8</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Can you elaborate on what you have done / how you have done it, and how it is not working? Have you done any debugging to see what is going on?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>