<?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>Problem: Enable Disable UART, ADC peripherals?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/40402/problem-enable-disable-uart-adc-peripherals</link><description>Hello to all, 
 I am using nRF52840 with SES SDK15.0 version. My device is goes into sleep mode after sending data to server. But when woke up device for first reading data successfully send and it will goes into sleep mode. After few minute it wakeup</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 26 Mar 2019 08:31:54 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/40402/problem-enable-disable-uart-adc-peripherals" /><item><title>RE: Problem: Enable Disable UART, ADC peripherals?</title><link>https://devzone.nordicsemi.com/thread/178252?ContentTypeID=1</link><pubDate>Tue, 26 Mar 2019 08:31:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5605d307-a246-418d-b1d2-2b4bc35a068a</guid><dc:creator>vishal</dc:creator><description>&lt;p&gt;I have created new thread for this, so can we continue&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/45355/how-optimize-high-current-consumption-in-sleep-mode-using-nrf52840"&gt;here&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Thanks for your help..!!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem: Enable Disable UART, ADC peripherals?</title><link>https://devzone.nordicsemi.com/thread/178092?ContentTypeID=1</link><pubDate>Mon, 25 Mar 2019 12:23:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0eba0191-3d3a-478b-8ebc-9428eb4937f3</guid><dc:creator>vishal</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Sorry for very late reply, We were busy for implementing other functionality and now our application is stable. Now we have getting power consumption issue in sleep mode. Let me describe our measured consumption.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;We have power profile kit &amp;amp; also digital multi-meter. We are using nRF52840DK and SDK15.0 version to built our application.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The measured consumption is&lt;/strong&gt; &lt;strong&gt;542uA&lt;/strong&gt; when device is sleep mode means system ON mode.&lt;/p&gt;
&lt;p&gt;This consumption quite very high we should need to optimize to increase battery life because our sensor devices has battery operated. We have turn OFF all used peripheral before goes into sleep mode.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The following way we have disabled used peripheral is it right?&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void sleep_mode_enter() {
  uint32_t err_code;
  NRF_LOG_INFO(&amp;quot;Sleep mode Enter&amp;quot;);
  flash_data_sending = false;
  start_measurement = false;
  if ((strcmp((char *)s_info.config_flag, &amp;quot;true&amp;quot;) == 0)) { /*Check if config mode enter and called sleep_mode_enter when server request status completed */
    nrf_gpio_pin_set(WIFI_PIN); /*ON WIFI module*/
  } else {
    nrf_gpio_pin_clear(WIFI_PIN); /*OFF WiFi module*/
  }
  nrf_gpio_pin_clear(SENSOR_PIN);  // OFF Sensor
  nrf_gpio_pin_set(GREEN_LED_PIN); // OFF Green LED
  nrf_gpio_pin_set(BLUE_LED_PIN);  // OFF BLUE LED
  stop_adc();
//  err_code = app_uart_close();
//  APP_ERROR_CHECK(err_code);
}

void stop_adc() {
  nrf_drv_timer_disable(&amp;amp;m_timer);
  nrf_drv_timer_uninit(&amp;amp;m_timer);
  nrf_drv_ppi_channel_disable(m_ppi_channel);
  nrf_drv_ppi_uninit();
  NRF_SAADC-&amp;gt;TASKS_STOP = 1;
  nrf_drv_saadc_uninit();
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Is the above API and functions right? OR we should need to disabled other way?&lt;/p&gt;
&lt;p&gt;Why this current consumption getting very high in system ON mode? How i can reduced / optimize this consumption?&lt;/p&gt;
&lt;p&gt;We have check no any issue in our hardware. If we put device into system OFF mode that time the current consumption got 5-6 uA which is acceptable.&lt;/p&gt;
&lt;p&gt;Please provide some solution or right way to reduce this consumption.&lt;/p&gt;
&lt;p&gt;Looking forward you response...&lt;/p&gt;
&lt;p&gt;Thanks&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem: Enable Disable UART, ADC peripherals?</title><link>https://devzone.nordicsemi.com/thread/158555?ContentTypeID=1</link><pubDate>Thu, 22 Nov 2018 08:29:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8a71d668-91d4-4d41-a618-a58ea9a234da</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;1. I believe you stop the TIMER, SAADC, and the uart library correctly. I do not know the content of you idle_state_handle function, but it needs to contain the following function calls:&lt;br /&gt;__WFE();&lt;/p&gt;
&lt;p&gt;__SEV();&lt;/p&gt;
&lt;p&gt;__WFE();&lt;br /&gt;&lt;br /&gt;2. If it does not work on the custom board then there might be something wrong with the schematics/layout or the ESD diode is blown, shorting p0.23 to GND. &lt;br /&gt;&lt;br /&gt;What is the current consumption when p0.23 is driven &amp;quot;high&amp;quot;?&lt;br /&gt;&lt;br /&gt;Do you mind sharing schematics and layout files? I can view Altium, Allegro, Eagle, and raw gerber files with NC drill files.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem: Enable Disable UART, ADC peripherals?</title><link>https://devzone.nordicsemi.com/thread/158166?ContentTypeID=1</link><pubDate>Tue, 20 Nov 2018 12:37:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ed6ac9c5-e226-43cf-963d-8d3c6a4f570a</guid><dc:creator>vishal</dc:creator><description>&lt;p&gt;Thanks for reply,&lt;/p&gt;
&lt;p&gt;1. Now can i call sleep mode as per following way in main loop;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;  for (;;) {
    if (sleep_mode_check == true){
      sleep_mode_enter();
     }
    idle_state_handle();
  }&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;If i am wrong please provide proper way for call sleep mode in main loop.&lt;/p&gt;
&lt;p&gt;2. Ok but we have designed custom PCB so in our own PCB this pin(P0.23) should be work is it right???&lt;/p&gt;
&lt;p&gt;Thanks for your suggestion..!!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem: Enable Disable UART, ADC peripherals?</title><link>https://devzone.nordicsemi.com/thread/158131?ContentTypeID=1</link><pubDate>Tue, 20 Nov 2018 10:00:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:68bfb186-0ab6-4e7c-97ad-1d18691dd30b</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;1.&amp;nbsp; &amp;quot;&lt;span&gt;Is any issue when i call sleep_mode_enter(); in uart_event_hnandler(); callback function because when i comment this not show unknown function but program not work proper.&amp;quot;&amp;nbsp;&lt;br /&gt;- You should never go to sleep in a callback, wait for the uart event handler to return to main and enter sleep from there.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;2. p0.23 is used with the flash chip on the DK. You need to use another gpio. See fig 1 in&amp;nbsp;&lt;a title="Connector interface" href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52/dita/nrf52/development/nrf52840_pdk/connector_if.html?cp=2_0_3_7_5"&gt;Connector interface&lt;/a&gt;.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem: Enable Disable UART, ADC peripherals?</title><link>https://devzone.nordicsemi.com/thread/158036?ContentTypeID=1</link><pubDate>Mon, 19 Nov 2018 15:47:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f524b2bc-c967-4757-8b4e-22cb149f544f</guid><dc:creator>vishal</dc:creator><description>&lt;p&gt;1. The callback is uart_event_handle(..) When i comment uart close function then it worked but problem with again uart_init();&lt;/p&gt;
&lt;p&gt;2. Here is bellow screen shot of GPIO state:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/GPIO_5F00_23.PNG" /&gt;&lt;/p&gt;
&lt;p&gt;I have tried like this&lt;/p&gt;
&lt;p&gt;&lt;span&gt;#define&amp;nbsp;&lt;/span&gt;WIFI_PIN NRF_GPIO_PIN_MAP(0,23)&lt;br /&gt;#define SENSOR_PIN NRF_GPIO_PIN_MAP(0,29)&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;SENSOR_PIN&amp;nbsp; is working but only problem with&amp;nbsp;&amp;nbsp;WIFI_PIN&amp;nbsp; i not getting high tested with multi-meter.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Why it problem with p0.23 pin in segger when i read this resister&amp;nbsp;the IDE show 1 value but not getting on multi-meter.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Please help me asap.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks...&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem: Enable Disable UART, ADC peripherals?</title><link>https://devzone.nordicsemi.com/thread/158013?ContentTypeID=1</link><pubDate>Mon, 19 Nov 2018 14:52:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f830ffde-3e7c-4bff-81c9-540fbba05724</guid><dc:creator>haakonsh</dc:creator><description>&lt;ol&gt;
&lt;li&gt;You won&amp;#39;t be able to put the MCU to sleep when the debugger is connected.&amp;nbsp;&lt;br /&gt;&lt;span&gt;&lt;br /&gt;&amp;quot;When first callback come WIFi module successfully send sensor reading but when call it again second time got error in SES IDE like&amp;nbsp;&lt;/span&gt;&lt;span&gt;unknown fuction at 0x000978.&amp;quot;&amp;nbsp;&lt;br /&gt;&lt;/span&gt;-What callback are you referring to?&lt;/li&gt;
&lt;li&gt;In a debug session in SES: View -&amp;gt; Registers -&amp;gt; Register1 -&amp;gt; Groups -&amp;gt; Turn off CPU groups, and turn on the P0 group.&amp;nbsp;&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem: Enable Disable UART, ADC peripherals?</title><link>https://devzone.nordicsemi.com/thread/157133?ContentTypeID=1</link><pubDate>Tue, 13 Nov 2018 14:42:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:656d0d0a-eda4-48e4-9e25-219d6607bba3</guid><dc:creator>vishal</dc:creator><description>&lt;p&gt;1) stop_BLE(); means disconnect ble connection and stop advertising this call before enter sleep mode&lt;pre class="ui-code" data-mode="text"&gt;void stop_BLE()
{
  uint32_t err_code;
  stop_adv = true;
    err_code = sd_ble_gap_disconnect(m_conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
    APP_ERROR_CHECK(err_code);
}

static void uart_init(void)
{
    uint32_t                     err_code;
    app_uart_comm_params_t const comm_params =
    {
        .rx_pin_no    = RX_PIN_NUMBER,//RX_PIN_NUMBER,
        .tx_pin_no    = TX_PIN_NUMBER,//TX_PIN_NUMBER,
        .rts_pin_no   = RTS_PIN_NUMBER,
        .cts_pin_no   = CTS_PIN_NUMBER,
        .flow_control = APP_UART_FLOW_CONTROL_DISABLED,
        .use_parity   = false,
#if defined (UART_PRESENT)
        .baud_rate    = NRF_UART_BAUDRATE_115200
#else
        .baud_rate    = NRF_UARTE_BAUDRATE_115200
#endif
    };

    APP_UART_FIFO_INIT(&amp;amp;comm_params,
                       UART_RX_BUF_SIZE,
                       UART_TX_BUF_SIZE,
                       uart_event_handle,
                       APP_IRQ_PRIORITY_LOWEST,
                       err_code);
    APP_ERROR_CHECK(err_code);
}

void saadc_sampling_event_init(void)
{
    ret_code_t err_code;
    err_code = nrf_drv_ppi_init();
    APP_ERROR_CHECK(err_code);

    nrf_drv_timer_config_t timer_config = NRF_DRV_TIMER_DEFAULT_CONFIG;
    timer_config.frequency = NRF_TIMER_FREQ_31250Hz;
    err_code = nrf_drv_timer_init(&amp;amp;m_timer, &amp;amp;timer_config, timer_handler);
    APP_ERROR_CHECK(err_code);

    /* setup m_timer for compare event */
    uint32_t ticks = nrf_drv_timer_us_to_ticks(&amp;amp;m_timer,SAADC_SAMPLE_RATE);
    nrf_drv_timer_extended_compare(&amp;amp;m_timer, NRF_TIMER_CC_CHANNEL0, ticks, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, false);
    nrf_drv_timer_enable(&amp;amp;m_timer);

    uint32_t timer_compare_event_addr = nrf_drv_timer_compare_event_address_get(&amp;amp;m_timer, NRF_TIMER_CC_CHANNEL0);
    uint32_t saadc_sample_event_addr = nrf_drv_saadc_sample_task_get();

    /* setup ppi channel so that timer compare event is triggering sample task in SAADC */
    err_code = nrf_drv_ppi_channel_alloc(&amp;amp;m_ppi_channel);
    APP_ERROR_CHECK(err_code);

    err_code = nrf_drv_ppi_channel_assign(m_ppi_channel, timer_compare_event_addr, saadc_sample_event_addr);
    APP_ERROR_CHECK(err_code);
}

void saadc_sampling_event_enable(void) {
	ret_code_t err_code = nrf_drv_ppi_channel_enable(m_ppi_channel);
	APP_ERROR_CHECK(err_code);
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Basically what i want to do&amp;nbsp;startMeasuring_reading(); is a fun which is call every periodic interval as per requirements. When first callback come WIFi module successfully send sensor reading but when call it again second time got error in SES IDE like&amp;nbsp;&lt;span&gt;unknown fuction at 0x000978. Will you please provide proper way for turn off saadc , uart in sleep mode means system ON mode. It will again turn ON once&amp;nbsp;&lt;/span&gt;&amp;nbsp;&lt;span&gt;startMeasuring_reading(); call.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Is any issue when i call sleep_mode_enter(); in uart_event_hnandler(); callback function because when i comment this not show unknown function but program not work proper.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;2)&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
[quote userid="13562" url="~/f/nordic-q-a/40402/problem-enable-disable-uart-adc-peripherals/157074"]What is the state of the GPIO registers after you&amp;#39;ve executed the two functions above?[/quote]
&lt;p&gt;&lt;span&gt;what you are manning how i check state of GPIO registers?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Another thing is when i use GPIO15 pin so this pin is able to set logic high but problem for p0.23. i am using PCA10056 board file.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks for reply...&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem: Enable Disable UART, ADC peripherals?</title><link>https://devzone.nordicsemi.com/thread/157074?ContentTypeID=1</link><pubDate>Tue, 13 Nov 2018 12:19:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4934c333-3334-4398-9ad7-cfde3408ba6e</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;1)&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;quot;Also i am struggling for debug because not showing any error it shows only unknown fuction at 0x000978 like this.&amp;quot;&amp;nbsp;&lt;br /&gt;- like what?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;We need the definitions for:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;stop_BLE();&lt;/li&gt;
&lt;li&gt;uart_init();&lt;/li&gt;
&lt;li&gt;saadc_sampling_event_init();&lt;/li&gt;
&lt;li&gt;saadc_sampling_event_enable();&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;2)&amp;nbsp;&lt;/p&gt;
&lt;p&gt;nrf_gpio_cfg_output(23);&lt;/p&gt;
&lt;p&gt;nrf_gpio_pin_set(23);&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;This should set p0.23 to logic high.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;What is the state of the GPIO registers after you&amp;#39;ve executed the two functions above?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>