<?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>52820 COMP interrupt problem</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/71396/52820-comp-interrupt-problem</link><description>Hi, Friend, 
 I have a light sensor connected to P0.04/AIN2 on 52820, and use COMP to detect the change of voltage. 
 Here is my test code. When light change, the return value of nrfx_comp_sample() is correct (it can change between 0 and 1). 
 But if</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 26 Feb 2021 13:56:53 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/71396/52820-comp-interrupt-problem" /><item><title>RE: 52820 COMP interrupt problem</title><link>https://devzone.nordicsemi.com/thread/296574?ContentTypeID=1</link><pubDate>Fri, 26 Feb 2021 13:56:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c8ce16dd-5154-45b1-bd15-c9b4c61f8bfb</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;If you look at the description and figures in the &lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf52820/comp.html#unique_559514688"&gt;COMP peripheral documentation&lt;/a&gt;, you will see that this is not possible. VIN- will initially be set to either VUP or VDOWN, depending on if VIN+ is ABOVE or BELOW VIN-. The VIN- needs to cross VIN+ in the given direction before it switch to detecting crossing in the other direction.&lt;/p&gt;
&lt;p&gt;So after the input have increased to 3.0V, you should be able to detect the down crossing if decreasing the input to 1.5V again.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 52820 COMP interrupt problem</title><link>https://devzone.nordicsemi.com/thread/296548?ContentTypeID=1</link><pubDate>Fri, 26 Feb 2021 12:58:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ab1e1a16-7f90-4f27-b505-f4ad6a1fec49</guid><dc:creator>logan.xu</dc:creator><description>&lt;p&gt;Hi，Jorgen,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; I&amp;nbsp;have another question. I set the threhold param as follow:&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; comp_config.threshold.th_down = NRFX_VOLTAGE_THRESHOLD_TO_INT(2.0, 3.3);&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; comp_config.threshold.th_up = NRFX_VOLTAGE_THRESHOLD_TO_INT(2.8, 3.3);&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; And if the VIN+ is 2.5V(above 2.0V) when call nrf_drv_comp_start(NRFX_COMP_EVT_EN_CROSS_MASK, 0), so the value of nrfx_comp_sample()&amp;nbsp; is 1. When VIN+ increase from 2.5V to 3.0V, it won&amp;#39;t&amp;nbsp;generate interrupt.&amp;nbsp;It only generate when VIN+ decrease from 2.5V&amp;nbsp;to 1.5V(for example).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; I hope it can generate interrupt both when increase above 2.8V and decrease bellow 2.0V. Does it possible?&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 52820 COMP interrupt problem</title><link>https://devzone.nordicsemi.com/thread/296401?ContentTypeID=1</link><pubDate>Fri, 26 Feb 2021 01:43:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:35f79e47-e548-44b0-a341-63ee7cebe216</guid><dc:creator>logan.xu</dc:creator><description>&lt;p&gt;Thank you. As your suggestion, I mofify the define of nrfx_comp_irq_handler&amp;nbsp;In nrfx_irqs_nrf52820.h, &amp;quot;#define COMP_LPCOMP_IRQHandler&amp;quot; to&amp;nbsp;&lt;span&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;#define COMP_IRQHandler&lt;/span&gt;&lt;span&gt;&amp;quot;, it works now.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 52820 COMP interrupt problem</title><link>https://devzone.nordicsemi.com/thread/296373?ContentTypeID=1</link><pubDate>Thu, 25 Feb 2021 17:29:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:893d0558-ae92-4544-9646-45daad95bb38</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Since nRF52820 does not have a LPCOMP peripheral, there is no PRS box defined for sharing resources between COMP and LPCOMP. The interrupts from NVIC will be triggered directly in &lt;a href="https://github.com/NordicSemiconductor/nrfx/blob/v1.8.6/soc/nrfx_irqs_nrf52820.h#L112"&gt;nrfx_comp_irq_handler&lt;/a&gt;&amp;nbsp;(redefined from COMP_IRQHandler, which is the default handler name defined in the MDK files). In chips variants where both LPCOMP and COMP are available, and PRS is enabled, &lt;a href="https://github.com/NordicSemiconductor/nrfx/blob/v1.8.6/soc/nrfx_irqs_nrf52840.h#L119"&gt;a common interrupt handler inside PRS is defined&lt;/a&gt;, where interrupts are forwarder instead of the default NRFX IRQ handler for that peripheral.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 52820 COMP interrupt problem</title><link>https://devzone.nordicsemi.com/thread/296148?ContentTypeID=1</link><pubDate>Thu, 25 Feb 2021 07:25:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4653dda2-4824-4b8e-aa11-d426d604dd76</guid><dc:creator>logan.xu</dc:creator><description>&lt;p&gt;Yes,&amp;nbsp;prs_box_get will return NULL&amp;nbsp;in current SDK code, and&amp;nbsp;param irq_handler will not be used.&amp;nbsp;So how can irq_handler be called when interrupt occured?&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1614237615133v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 52820 COMP interrupt problem</title><link>https://devzone.nordicsemi.com/thread/293276?ContentTypeID=1</link><pubDate>Mon, 08 Feb 2021 10:06:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ae00fa07-b0ca-4f83-98f3-87bcab429f61</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;See my &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/70980/52820-lpcom-problem/293264#293264"&gt;comment about PRS here&lt;/a&gt;. As far as I can see, the&amp;nbsp;&lt;span&gt;nrfx_prs_acquire() function should get a NULL-pointer returned from&amp;nbsp;prs_box_get(), which should skip the if-setting and return success.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I tested your code (with some small modifications, replaced NRF_LOG with LED blinking, and connected a button as input, as I do not have a light sensor). I was able to generate interrupts (checked with debugger that event handler is called) by changing the state of the input pin. I did test on a nRF52833 DK with emulation for nRF52820,as I do not have a board with the actual chip available right now.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If your logging stops, it sounds like a hardfault or similar have occurred. This may have happened if you have configured the project incorrectly, or with wrong MDK files. If you could upload the full project, I can have a look at it.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;br /&gt;Jørgen&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 52820 COMP interrupt problem</title><link>https://devzone.nordicsemi.com/thread/293233?ContentTypeID=1</link><pubDate>Mon, 08 Feb 2021 04:16:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:927198f5-dc68-47a5-a86c-a477a25ffb5a</guid><dc:creator>logan.xu</dc:creator><description>&lt;p&gt;My develop SDK is 16.0.0(updated follow the link: &lt;a href="https://devzone.nordicsemi.com/nordic/short-range-guides/b/getting-started/posts/developing-for-the-nrf52820-with-nrf5-sdk-v16-0-0)"&gt;https://devzone.nordicsemi.com/nordic/short-range-guides/b/getting-started/posts/developing-for-the-nrf52820-with-nrf5-sdk-v16-0-0)&lt;/a&gt;. And&amp;nbsp;there is no&amp;nbsp;PRS NRF_COMP&amp;nbsp;defined in&amp;nbsp; nrfx_prs.h with&amp;nbsp;SDK 17.0.2 too. Therefore, nrfx_comp_init -&amp;gt; nrfx_prs_acquire(NRF_COMP, nrfx_comp_irq_handler),&amp;nbsp; the interrupte register fail.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 52820 COMP interrupt problem</title><link>https://devzone.nordicsemi.com/thread/293221?ContentTypeID=1</link><pubDate>Sun, 07 Feb 2021 09:52:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b6c999fe-37f4-4c07-9e5a-ca747ee3abb7</guid><dc:creator>logan.xu</dc:creator><description>&lt;p&gt;And I found that, in nrfx_prs.c,&amp;nbsp;NRF_COMP not define for NRF52820.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;#elif defined(NRF52820_XXAA)&lt;/strong&gt;&lt;br /&gt; // SPIM0, SPIS0, TWIM0, TWIS0, SPI0, TWI0&lt;br /&gt; #define NRFX_PRS_BOX_0_ADDR NRF_SPIM0&lt;br /&gt; // SPIM1, SPIS1, TWIM1, TWIS1, SPI1, TWI1&lt;br /&gt; #define NRFX_PRS_BOX_1_ADDR NRF_SPIM1&lt;br /&gt; // UARTE0, UART0&lt;br /&gt; #define NRFX_PRS_BOX_2_ADDR NRF_UARTE0&lt;/p&gt;
&lt;p&gt;#elif defined(NRF52832_XXAA) || defined(NRF52832_XXAB) || \&lt;br /&gt; &lt;strong&gt;defined(NRF52833_XXAA)&lt;/strong&gt; || defined(NRF52840_XXAA)&lt;br /&gt; // SPIM0, SPIS0, TWIM0, TWIS0, SPI0, TWI0&lt;br /&gt; #define NRFX_PRS_BOX_0_ADDR NRF_SPIM0&lt;br /&gt; // SPIM1, SPIS1, TWIM1, TWIS1, SPI1, TWI1&lt;br /&gt; #define NRFX_PRS_BOX_1_ADDR NRF_SPIM1&lt;br /&gt; // SPIM2, SPIS2, SPI2&lt;br /&gt; #define NRFX_PRS_BOX_2_ADDR NRF_SPIM2&lt;br /&gt; // COMP, LPCOMP&lt;br /&gt; &lt;strong&gt;#define NRFX_PRS_BOX_3_ADDR NRF_COMP&lt;/strong&gt;&lt;br /&gt; // UARTE0, UART0&lt;br /&gt; #define NRFX_PRS_BOX_4_ADDR NRF_UARTE0&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>