<?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>Lis2mdl dont launch a trigger when i program with a threshold</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/128360/lis2mdl-dont-launch-a-trigger-when-i-program-with-a-threshold</link><description>Hello everyone, 
 I have tried several different approaches to solve this issue, but I have not been successful so far. 
 My goal is to generate an interrupt when the LIS2MDL magnetic field measurements (X, Y, and Z) go below a defined threshold. I created</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 09 Jun 2026 22:25:02 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/128360/lis2mdl-dont-launch-a-trigger-when-i-program-with-a-threshold" /><item><title>RE: Lis2mdl dont launch a trigger when i program with a threshold</title><link>https://devzone.nordicsemi.com/thread/567638?ContentTypeID=1</link><pubDate>Tue, 09 Jun 2026 22:25:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e8b44b5a-90ea-4506-8bd7-5cf5b14bc395</guid><dc:creator>Susheel Nuguru</dc:creator><description>[quote user="Arebhi"]it takes and the value of reg_A displays 0x80 but when they finish the initialisation (lis2mdl_init)&amp;nbsp; it takes the default value 0x82&amp;nbsp;[/quote]
&lt;p&gt;Good, so now you have a working system. As I mentioned in earlier reply, the &lt;a href="https://docs.zephyrproject.org/latest/services/pm/"&gt;CONFIG_PM&amp;nbsp;&lt;/a&gt;is making the sensor go to sleep immediately, that is because the driver of that sensor have implemented the powre management and you have enabled that power management in your prj.conf. As to why the driver decides to do that is the question you need to ask in Zephyr forums and/or that sensor manufacturer. You can easily override it (like you just did) if you need. You can also enable those configs and change the behavior of the pm_action calls as your application requires.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Lis2mdl dont launch a trigger when i program with a threshold</title><link>https://devzone.nordicsemi.com/thread/567636?ContentTypeID=1</link><pubDate>Tue, 09 Jun 2026 19:36:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f319904c-9308-4abc-a5bf-4e1658996a69</guid><dc:creator>Arebhi</dc:creator><description>&lt;p&gt;So , when i did as you said , when there will be a New data(xyz)&amp;nbsp; , the interruptions pin drdy&amp;nbsp; triggered ......&lt;/p&gt;
&lt;p&gt;As well as ; i dont understand why when i configure the reg_A to take 0x80 , it takes and the value of reg_A displays 0x80 but when they finish the initialisation (lis2mdl_init)&amp;nbsp; it takes the default value 0x82&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Lis2mdl dont launch a trigger when i program with a threshold</title><link>https://devzone.nordicsemi.com/thread/567634?ContentTypeID=1</link><pubDate>Tue, 09 Jun 2026 17:30:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:28133ae6-6983-4143-a604-edc187f19d90</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Also&amp;nbsp;&lt;span&gt; INT_CTRL is the threshold-interrupt control register, it is not used for data-ready at all. Data-ready is routed only by the DRDY-on-pin bit in CFG_REG_C, which you already have set. So for the DRDY test you can ignore INT_CTRL.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Lis2mdl dont launch a trigger when i program with a threshold</title><link>https://devzone.nordicsemi.com/thread/567633?ContentTypeID=1</link><pubDate>Tue, 09 Jun 2026 17:22:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dc5d5167-77f2-4d3b-9ec6-d55374bea879</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/0410.pastedimage1781025492644v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Why do you have this set to 0x82, 0x02 in that number means POWER_DOWN&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/8814.pastedimage1781025621531v2.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;The only place that is written to that sensor is in&amp;nbsp;lis2mdl_pm_action&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/5873.pastedimage1781025643851v3.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Seems like CONFIG_PM_DEVICE in your prj.conf is making this sensor go to low power mode by default. Try disabling CONFIG_PM_DEVICE and&lt;span&gt;CONFIG_PM_DEVICE_RUNTIME&amp;nbsp;&lt;/span&gt;just to test and see.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Lis2mdl dont launch a trigger when i program with a threshold</title><link>https://devzone.nordicsemi.com/thread/567571?ContentTypeID=1</link><pubDate>Tue, 09 Jun 2026 07:23:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0e5650ee-9f55-43e0-9615-f3a851df2cb6</guid><dc:creator>Arebhi</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Thank you for your response.&lt;/p&gt;
&lt;p&gt;Yes, the last week&amp;nbsp; I already checked the points you mentioned. I am facing an issue with the sensor interrupt. Although the configuration appears to be correct, the interrupt signal is never triggered.&lt;/p&gt;
&lt;p&gt;I tested both interrupt sources: Data Ready (DRDY) and Threshold interrupts. I expected that at least the DRDY interrupt would be triggered, but I am not observing any interrupt activity.&lt;/p&gt;
&lt;p&gt;For the DRDY configuration, I programmed the registers as shown in the screenshot below.&lt;/p&gt;
&lt;p&gt;Could you please let me know if there is anything else I should verify or if I may be missing a required configuration step?&lt;/p&gt;
&lt;p&gt;For the case DRDY ::&amp;nbsp;&lt;/p&gt;
&lt;p&gt;INT_CTRL_REG&amp;nbsp; for the case of DRDY : 0x75&lt;br /&gt;&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1780989037250v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I also noticed another behavior that may be related to the issue.&lt;/p&gt;
&lt;p&gt;When I configure CFG_Register_A, I write the value 0x80 (Continuous Mode). However, after the sensor initialization function completes(lis2msl_init), reading back the register returns 0x82 instead of 0x80, even though there is no function in my code that intentionally modifies this register.&lt;/p&gt;
&lt;p&gt;In the screenshot, I highlighted the register values with different colors to track when and where the value changes. I checked the register at several points during execution: before entering main(), during the sensor initialization function, and after initialization. The value appears to change unexpectedly.&lt;/p&gt;
&lt;p&gt;You may also notice some &amp;quot;read&amp;quot; messages highlighted in red in the screenshot. These are only debug print messages that I colored for visibility; they are not error messages.&lt;/p&gt;
&lt;p&gt;Could you clarify whether the sensor might automatically set bit 1 of CFG_Register_A, or if there is another mechanism that could explain why the register changes from 0x80 to 0x82?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1780989509263v2.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Lis2mdl dont launch a trigger when i program with a threshold</title><link>https://devzone.nordicsemi.com/thread/567556?ContentTypeID=1</link><pubDate>Mon, 08 Jun 2026 19:57:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:beaaaa05-9ebc-4663-a4dc-0b329d70dde1</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I think you should be a scope or logic analyzer to sniff the interrupt pin. Check if the interrupt is firing or not, if yes, then this is an MCU side configuration issue. If the pin never toggles, then it is a sensor configuration issue. We need to get this info first so that we know to either focus on the MCU&amp;nbsp; (device tree/irq gpios, polarity etc) or what is going wrong with configuring the sensor.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Lis2mdl dont launch a trigger when i program with a threshold</title><link>https://devzone.nordicsemi.com/thread/567495?ContentTypeID=1</link><pubDate>Sat, 06 Jun 2026 08:10:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:805d09e2-5dee-46bb-8650-ea6a78bcf31d</guid><dc:creator>Arebhi</dc:creator><description>&lt;p&gt;Thank you for your response.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regarding the threshold trigger, I actually made some modifications to the driver. I configured the `INT_CTRL` register as well as the threshold registers (`INT_THS_L` and `INT_THS_H`). I also configured the relevant settings in `CFG_REG_C` so that the interrupt pin would be used for threshold interrupts instead of data-ready notifications.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I based this configuration on the official LIS2MDL datasheet, which states that enabling and configuring these registers should allow the threshold interrupt to be triggered.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;As a second test, I also tried using the data-ready trigger to verify whether interrupts were working at all when new measurement data became available. For this test, I configured the required registers according to the datasheet as well. However, I still did not receive any interrupt, and the trigger callback was never executed.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Therefore, at the moment, neither the threshold interrupt nor the data-ready interrupt appears to be&lt;/p&gt;
&lt;p&gt;firing.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Lis2mdl dont launch a trigger when i program with a threshold</title><link>https://devzone.nordicsemi.com/thread/567484?ContentTypeID=1</link><pubDate>Fri, 05 Jun 2026 16:45:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9e8114a8-9ddc-499e-a439-9cd9fc719e53</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;ASMA,&lt;/p&gt;
&lt;p&gt;This thread is mostly about the&amp;nbsp;&lt;span&gt;LIS2MDL and very less about nRF solutions, but I will still try to give you some of my thoughts.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The LIS2MDL Zephyr driver only implements the data-ready trigger. lis2mdl_trigger_set() never checks trig-&amp;gt;type. Only trig-&amp;gt;chan, so SENSOR_TRIG_THRESHOLD takes the data-ready path and returns 0 then arms DRDY. That is why you always seem to get success and the threshold interrupt&amp;nbsp;is never firing.&lt;/p&gt;
&lt;p&gt;I do not think that the INT_CTRL / INT_THS are ever configured. Also, I think that the LIS2MDL threshold interrupt is &amp;quot;absolute value exceeds ±threshold&amp;quot; in hardware. There is no below-threshold mode, so you cannot get a hardware interrupt for the field dropping below a value even with a full driver. So I would recommend you to keep SENSOR_TRIG_DATA_READY, and in the handler do sensor_sample_fetch + sensor_channel_get and compare against your threshold there. Should work with the upstream driver.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Lis2mdl dont launch a trigger when i program with a threshold</title><link>https://devzone.nordicsemi.com/thread/567474?ContentTypeID=1</link><pubDate>Fri, 05 Jun 2026 12:20:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:94bc5483-cf02-4065-8aa8-430797fd6969</guid><dc:creator>Arebhi</dc:creator><description>&lt;p&gt;?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>