<?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>LCOMP/COMP cannot wakeup the device</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/44435/lcomp-comp-cannot-wakeup-the-device</link><description>Hi, 
 
 I use &amp;#39;nRF5_SDK_15.2.0_9412b96\examples\ble_peripheral\ble_app_uart&amp;#39; as my project base for PCA10040. The code has its default sleep mode which use &amp;#39;sleep_mode_enter&amp;#39; function for idle evt in &amp;#39;on_adv_evt&amp;#39;. And I add comps like the following content</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 25 Mar 2019 09:58:24 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/44435/lcomp-comp-cannot-wakeup-the-device" /><item><title>RE: LCOMP/COMP cannot wakeup the device</title><link>https://devzone.nordicsemi.com/thread/178040?ContentTypeID=1</link><pubDate>Mon, 25 Mar 2019 09:58:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5dac49ee-69c9-41d3-b0ed-0d9377ffc161</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Box 4 is not used by COMP or LPCOMP so it does not really matter.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LCOMP/COMP cannot wakeup the device</title><link>https://devzone.nordicsemi.com/thread/177997?ContentTypeID=1</link><pubDate>Mon, 25 Mar 2019 07:20:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0af90e24-381e-4383-83c0-cfe9d96d545e</guid><dc:creator>lavande</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Then should I close the macro &amp;#39; NRFX_PRS_BOX_4_ENABLED&amp;#39;&amp;nbsp; which set true as defualt ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LCOMP/COMP cannot wakeup the device</title><link>https://devzone.nordicsemi.com/thread/176961?ContentTypeID=1</link><pubDate>Tue, 19 Mar 2019 11:27:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6ce6b28f-f46c-4123-a764-3f6b07ea7afb</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Some peripherals share resources with other peripherals, and each such group is called a &amp;quot;box&amp;quot; in this case. The&amp;nbsp;NRFX_PRS_BOX_3_ENABLED parameter is used to enable peripheral resource sharing (PRS) for box 3, which is used by the COMP and LPCOMP.&lt;/p&gt;
&lt;p&gt;Among other things, this means that a common ISR is implemented, and this calls the correct driver ISR depending on which peripheral is currently initialized.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LCOMP/COMP cannot wakeup the device</title><link>https://devzone.nordicsemi.com/thread/176948?ContentTypeID=1</link><pubDate>Tue, 19 Mar 2019 10:49:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fbd58770-5981-478c-afc4-011445cd8c43</guid><dc:creator>lavande</dc:creator><description>&lt;p&gt;Hi , May I know what does the macro &amp;#39;&lt;span&gt;NRFX_PRS_BOX_3_ENABLED&amp;#39;&amp;nbsp;&lt;/span&gt;mean?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LCOMP/COMP cannot wakeup the device</title><link>https://devzone.nordicsemi.com/thread/176947?ContentTypeID=1</link><pubDate>Tue, 19 Mar 2019 10:48:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c0ad0513-5c58-4e09-9124-b109b803267c</guid><dc:creator>lavande</dc:creator><description>&lt;p&gt;Hi , May I know what does the macro &amp;#39;&lt;span&gt;NRFX_PRS_BOX_3_ENABLED&amp;#39;&amp;nbsp;&lt;/span&gt;mean?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LCOMP/COMP cannot wakeup the device</title><link>https://devzone.nordicsemi.com/thread/176627?ContentTypeID=1</link><pubDate>Mon, 18 Mar 2019 08:52:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3b59eff0-31cd-4754-88af-3de7d5bd6a3b</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Yes, you are doing things right. I did not specify that in my previous reply, but the drivers have support for using peripherals with the same IRQ number (essentially much of the same HW). You must enable it by setting&amp;nbsp;NRFX_PRS_ENABLED and&amp;nbsp;NRFX_PRS_BOX_3_ENABLED to 1 in your projects sdk_config.h. This way, the interrupt will be forwarded to the correct handler, depending on weather the LPCOMP or COMP is currently enabled.&lt;/p&gt;
&lt;p&gt;You can see how this is used by looking at for intsance nrfx_lpcomp.c, where&amp;nbsp;nrfx_prs_acquire() is called by&amp;nbsp;nrfx_lpcomp_init() and&amp;nbsp;nrfx_prs_release() is called by&amp;nbsp;nrfx_lpcomp_uninit(). You will find the same thing for COMP in nrfx_comp.c.&lt;/p&gt;
&lt;p&gt;Then the only thing you need to remember is to uninit the LPCOMP before initializing the COMP and vice versa.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LCOMP/COMP cannot wakeup the device</title><link>https://devzone.nordicsemi.com/thread/176536?ContentTypeID=1</link><pubDate>Sat, 16 Mar 2019 03:30:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:56dcaa02-39f1-434c-af5c-b9e25dd0a44b</guid><dc:creator>lavande</dc:creator><description>&lt;p&gt;Thank you!&amp;nbsp;&lt;/p&gt;
&lt;p&gt;1.) Compile eror oeccurred&amp;nbsp; after I set &amp;#39;COMP_ENABLED 1&amp;#39;, &amp;#39;LPCOMP_ENABLED 1&amp;#39;, &amp;#39;NRFX_COMP_ENABLED 1&amp;#39; and &amp;#39;NRFX_COMP_ENABLED 1&amp;#39; in sdk_config.h,&amp;nbsp; and added &amp;#39;nrfx_comp.c&amp;#39; and &amp;#39;nrfx_lpcomp.c&amp;#39; into the project. and&amp;nbsp; changed the code in main.c:&lt;/p&gt;
&lt;p&gt;......&lt;/p&gt;
&lt;p&gt;#include &amp;quot;nrfx_common.h&amp;quot;&lt;br /&gt;&lt;br /&gt;#include &amp;quot;nrf_comp.h&amp;quot;&lt;br /&gt;#include &amp;quot;nrfx_comp.h&amp;quot;&lt;br /&gt;#include &amp;quot;nrf_drv_comp.h&amp;quot;&lt;br /&gt;&lt;br /&gt;#include &amp;quot;nrf_lpcomp.h&amp;quot;&lt;br /&gt;#include &amp;quot;nrfx_lpcomp.h&amp;quot;&lt;br /&gt;#include &amp;quot;nrf_drv_lpcomp.h&amp;quot;&lt;/p&gt;
&lt;p&gt;...&lt;/p&gt;
&lt;p&gt;static void sensor_timeout_handler(void * p_context)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UNUSED_PARAMETER(p_context);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //nrf_drv_comp_start(NRF_DRV_COMP_EVT_EN_CROSS_MASK, NRF_DRV_COMP_SHORT_STOP_AFTER_CROSS_EVT);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; nrf_drv_comp_start(NRFX_COMP_EVT_EN_CROSS_MASK, NRFX_COMP_SHORT_STOP_AFTER_UP_EVT);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //nrf_drv_comp_start(NRF_DRV_COMP_EVT_EN_DOWN_MASK, NRF_DRV_COMP_SHORT_STOP_AFTER_DOWN_EVT);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;static void comp_event_handler(nrf_comp_event_t event)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uint32_t&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; err_code;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (event == NRF_COMP_EVENT_UP)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nrf_gpio_pin_toggle(BSP_LED_2); // just change state of first LED&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //nrf_gpio_pin_toggle(BSP_LED_2); // just change state of first LED&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sensor_count++;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; err_code = app_timer_start(m_sensor_timer_id, sensor_time_intervel, NULL);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; APP_ERROR_CHECK(err_code);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //nrf_drv_comp_start(NRF_DRV_COMP_EVT_EN_CROSS_MASK, NRF_DRV_COMP_SHORT_STOP_AFTER_CROSS_EVT);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt;&amp;nbsp;* @brief Initialize COMP driver.&lt;br /&gt;&amp;nbsp;*/&lt;br /&gt;static void comp_init(void)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uint32_t&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; err_code;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; nrfx_comp_config_t config = NRFX_COMP_DEFAULT_CONFIG(2);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // initialize LPCOMP driver, from this point LPCOMP will be active and provided&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // event handler will be executed when defined action is detected&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; err_code = nrf_drv_comp_init(&amp;amp;config, comp_event_handler);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; APP_ERROR_CHECK(err_code);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //nrf_drv_lpcomp_enable();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; nrf_drv_comp_start(NRFX_COMP_EVT_EN_UP_MASK, NRFX_COMP_SHORT_STOP_AFTER_UP_EVT);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //nrf_drv_comp_start(NRF_DRV_COMP_EVT_EN_DOWN_MASK, NRF_DRV_COMP_SHORT_STOP_AFTER_DOWN_EVT);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //nrf_drv_comp_start(NRF_DRV_COMP_EVT_EN_CROSS_MASK, NRF_DRV_COMP_SHORT_STOP_AFTER_CROSS_EVT);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;static void lpcomp_event_handler(nrf_lpcomp_event_t event)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (event == NRF_LPCOMP_EVENT_DOWN)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;br /&gt;/**&lt;br /&gt;&amp;nbsp;* @brief Initialize LPCOMP driver.&lt;br /&gt;&amp;nbsp;*/&lt;br /&gt;static void lpcomp_init(void)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uint32_t&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; err_code;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; nrfx_lpcomp_config_t config = NRFX_LPCOMP_DEFAULT_CONFIG;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //config.input = NRF_LPCOMP_INPUT_2; // input 2: AIN2, P0.04&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; config.input = NRF_LPCOMP_INPUT_3;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // initialize LPCOMP driver, from this point LPCOMP will be active and provided&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // event handler will be executed when defined action is detected&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; err_code = nrfx_lpcomp_init(&amp;amp;config, lpcomp_event_handler);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; APP_ERROR_CHECK(err_code);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; nrf_lpcomp_enable();&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;Error： L6200E: Symbol COMP_LPCOMP_IRQHandler multidfined (by nrf_lpcomp.o and nrf_comp.o)&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;2.) I tried to&amp;nbsp; define &amp;#39;&lt;strong&gt;NRFX_PRS_BOX_3_ENABLED&lt;/strong&gt;&amp;#39;, and no compile errors.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;3.) Then I want to know for what does &amp;#39;NRFX_PRS_BOX_3_ENABLED&amp;#39; used?&lt;/p&gt;
&lt;p&gt;// COMP_LPCOMP_IRQn&lt;/p&gt;
&lt;p&gt;#if NRFX_CHECK(NRFX_PRS_ENABLED) &amp;amp;&amp;amp; NRFX_CHECK(NRFX_PRS_BOX_3_ENABLED)&lt;/p&gt;
&lt;p&gt;#define nrfx_prs_box_3_irq_handler&amp;nbsp; COMP_LPCOMP_IRQHandler&lt;/p&gt;
&lt;p&gt;#else&lt;/p&gt;
&lt;p&gt;#define nrfx_comp_irq_handler&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; COMP_LPCOMP_IRQHandler&lt;/p&gt;
&lt;p&gt;#define nrfx_lpcomp_irq_handler&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; COMP_LPCOMP_IRQHandler&lt;/p&gt;
&lt;p&gt;#endif&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Am I doing right?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LCOMP/COMP cannot wakeup the device</title><link>https://devzone.nordicsemi.com/thread/176462?ContentTypeID=1</link><pubDate>Fri, 15 Mar 2019 14:49:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:21be12d3-da57-4a30-b5b9-48db2bbbc2c9</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Yes, you can use the LPCOMP and COMP in the same project, that is no problem.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LCOMP/COMP cannot wakeup the device</title><link>https://devzone.nordicsemi.com/thread/176323?ContentTypeID=1</link><pubDate>Fri, 15 Mar 2019 05:09:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8fc4f25e-ff10-4ce8-a66a-42823a4f55dc</guid><dc:creator>lavande</dc:creator><description>&lt;p&gt;Thanks !&amp;nbsp; I wanna use lpcomp to wakeup device, and use comp for step count. Can this two moudle existence in the same project?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LCOMP/COMP cannot wakeup the device</title><link>https://devzone.nordicsemi.com/thread/176320?ContentTypeID=1</link><pubDate>Fri, 15 Mar 2019 03:15:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:de094c66-734e-493d-92de-2741a1adfabb</guid><dc:creator>lavande</dc:creator><description>&lt;p&gt;Thanks !&amp;nbsp; I wanna use lpcomp to wakeup device, and use comp for step count. Can this two moudle existence in the same project?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LCOMP/COMP cannot wakeup the device</title><link>https://devzone.nordicsemi.com/thread/174707?ContentTypeID=1</link><pubDate>Thu, 07 Mar 2019 07:16:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2f3e967c-200e-4448-aa72-c099793cb7f9</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The &lt;a href="http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.nrf52832.ps.v1.1%2Flpcomp.html"&gt;LPCOMP&lt;/a&gt; peripheral can be used as a wake-up source from system off low power mode, but the &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/comp.html?cp=2_1_0_37#topic"&gt;COMP&lt;/a&gt; peripheral cannot. Your comments indicate that you want to use the LPCOMP (which is what you need in this case), but you are in fact using the COMP (via the &lt;a href="https://www.nordicsemi.com/DocLib/Content/SDK_Doc/nRF5_SDK/v15-3-0/hardware_driver_comp"&gt;COMP driver&lt;/a&gt;). I recommend you refer to the LPCOMP example to see how it is used with the &lt;a href="https://www.nordicsemi.com/DocLib/Content/SDK_Doc/nRF5_SDK/v15-3-0/hardware_driver_lpcomp"&gt;LPCOMP driver&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>