<?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>Delayed Devicetree initialization for connected Sensors</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/92141/delayed-devicetree-initialization-for-connected-sensors</link><description>Hello, 
 
 I have connected a LSM6DSO sensor to my nRF52805 which is powered via GPIO. At startup zephyr RTOS wants to init the sensor and failed. After a reboot it detects the sensor and it works fine. 
 
 My question is: can I somehow control the device</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 09 Aug 2024 08:33:51 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/92141/delayed-devicetree-initialization-for-connected-sensors" /><item><title>RE: Delayed Devicetree initialization for connected Sensors</title><link>https://devzone.nordicsemi.com/thread/497579?ContentTypeID=1</link><pubDate>Fri, 09 Aug 2024 08:33:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d2c68ecf-0f83-4e66-8f6f-c8d0f7d69a63</guid><dc:creator>HSPalm</dc:creator><description>&lt;p&gt;Hi Jonas,&lt;/p&gt;
&lt;p&gt;I see you marked &amp;Oslash;yvinds answer below to resolve your issue (?). Can you explain which part of it was the correcting factor for your problem?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Delayed Devicetree initialization for connected Sensors</title><link>https://devzone.nordicsemi.com/thread/388726?ContentTypeID=1</link><pubDate>Fri, 30 Sep 2022 10:18:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:18954844-51ef-4805-b091-9665df6c87d0</guid><dc:creator>&amp;#216;ivind</dc:creator><description>&lt;p&gt;Hi again,&lt;/p&gt;
&lt;p&gt;Try adding CONFIG_REGULATOR=y&lt;/p&gt;
&lt;p&gt;And what does your overlay file look like now? You should move the i2c1 and i2c2 nodes out of the / { } brackets, and reference them with &amp;amp;i2c1 and &amp;amp;i2c2, like you do with &amp;amp;i2c0.&lt;/p&gt;
&lt;p&gt;If it still does not work, can you attach the current version of the project?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Delayed Devicetree initialization for connected Sensors</title><link>https://devzone.nordicsemi.com/thread/388412?ContentTypeID=1</link><pubDate>Wed, 28 Sep 2022 15:31:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:185d2221-3f6d-4f8f-8013-d1b7f34ada50</guid><dc:creator>JonasGel</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&amp;Oslash;ivind,&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;After debugging the firmware the past days I haven&amp;#39;t found a way to influence the initialization of the devicetree components. Further I found two similar (but older) cases, where devices are not powered while booting:&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/79431/initialise-periphery/330615"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/79431/initialise-periphery/330615&lt;/a&gt;&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/81579/initialize-device-to-device_pm_off_state"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/81579/initialize-device-to-device_pm_off_state&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;is there now a way to influence these initializations, or to control them later from the main function?&amp;nbsp;&lt;br /&gt;Maybe you have any working example with a sensor connected with i2c and powered by a gpio?&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I further experimented with pm_device_init_off(dev); but I am not able to start the devices properly again.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Delayed Devicetree initialization for connected Sensors</title><link>https://devzone.nordicsemi.com/thread/387824?ContentTypeID=1</link><pubDate>Mon, 26 Sep 2022 08:08:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:caac311a-6255-44e2-a601-84f96eb03a09</guid><dc:creator>JonasGel</dc:creator><description>&lt;p class="p1"&gt;&lt;span class="s1"&gt;Hi,&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span class="s1"&gt;Yes It works all fine in two situations with correct measurements:&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="p2"&gt;&lt;span class="s2"&gt;1. Connecting the Sensors to the Vdd input Voltage (2,98V - equivalent to GPIO Voltage)&amp;nbsp;&lt;/span&gt;&lt;span class="s1"&gt;&lt;br /&gt; &lt;/span&gt;&lt;span class="s2"&gt;2. Connecting the Sensors to Vdd at boot-time and switch to the dedicated GPIO (2 &amp;amp; 23) after the initialization process.&lt;/span&gt;&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span class="s1"&gt;If the sensors are plugged into the GPIOs at boot-time, the nRF resets after failing at sensor initialization, then gets the correct chip ID after restart and measures correct IMU-Values and incorrect Pressure Values.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span class="s1"&gt;(So I get good measurements with both (GPIO and Vdd) Voltage, but it has to be started with Vdd-Voltage). So I think the initialization process has to have more delay to build up GPIO-voltage or should be triggered manual in the main-function, but i don&amp;#39;t know how exactly.&lt;/span&gt;&lt;/p&gt;
&lt;p class="p2"&gt;&lt;span class="s1"&gt;&lt;br /&gt; &lt;/span&gt;&lt;span class="s2"&gt;I have tried your advice to change the initialization-level for sensor. This delayed the initialization of the Sensor about 25ms but doesn&amp;#39;t change the behavior of the initialization process.&lt;/span&gt;&lt;/p&gt;
&lt;p class="p3"&gt;&lt;span class="s1"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span class="s1"&gt;With POST_KERNEL-level, the console Output looks like this:&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span class="s1"&gt;&lt;pre class="ui-code" data-mode="text"&gt;[00:00:00.000,183] *** Booting Zephyr OS build v3.0.99-ncs1-1  ***
waiting 2 seconds for pins to get up gpio initialisiert 
&amp;lt;inf&amp;gt; LSM6DSO: Initialize device LSM6DSO
[00:00:00.002,929] &amp;lt;inf&amp;gt; LSM6DSO: chip id 0x0



===============================================================
Could not find IMU sensor, aborting test.
IMU sensor uI is not ready, aborting test.
[00:00:09.049,285] &amp;lt;err&amp;gt; os: ***** BUS FAULT *****
[00:00:09.049,316] &amp;lt;err&amp;gt; os:   Instruction bus error
[00:00:09.049,346] &amp;lt;err&amp;gt; os: r0/a1:  0x00000000  r1/a2:  0x00000003  r2/a3:  0x00000000
[00:00:09.049,346] &amp;lt;err&amp;gt; os: r3/a4:  0x20002ac0 r12/ip:  0x20002a14 r14/lr:  0x0000b969
[00:00:09.049,346] &amp;lt;err&amp;gt; os:  xpsr:  0x21000000
[00:00:09.049,377] &amp;lt;err&amp;gt; os: Faulting instruction address (r15/pc): 0x0af7f6b4
[00:00:09.049,407] &amp;lt;err&amp;gt; os: &amp;gt;&amp;gt;&amp;gt; ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
[00:00:09.049,407] &amp;lt;err&amp;gt; os: Current thread: 0x20001838 (main)
�[00:00:00.000,213] *** Booting Zephyr OS build v3.0.99-ncs1-1  ***
waiting 2 seconds for pins to get up gpio initialisiert 
&amp;lt;inf&amp;gt; LSM6DSO: Initialize device LSM6DSO
[00:00:00.002,838] &amp;lt;inf&amp;gt; LSM6DSO: chip id 0x6c



===============================================================
[0:00:06.198]:-21742.4 hPa
[0:00:06.201]:20 Cel
[0:00:06.203]:-0.006949 rpm
gyro x:-0.037568 dps y:-0.058643 dps z:0.054519 dps
----------------------------------&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span class="s1"&gt;With APPLICATION-level for LSM6DSO, the output is:&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span class="s1"&gt;&lt;pre class="ui-code" data-mode="text"&gt;*** Booting Zephyr OS build v3.0.99-ncs1-1  ***
waiting 2 seconds for pins to get up gpio initialisiert 
[00:00:00.027,526] &amp;lt;inf&amp;gt; LSM6DSO: Initialize device LSM6DSO
[00:00:00.030,303] 


==============================================================
[0m&amp;lt;inf&amp;gt; LSM6DSO: chip id 0x0
Could not find IMU sensor, aborting test.
IMU sensor uI is not ready, aborting test.
[00:00:09.049,316] &amp;lt;err&amp;gt; os: ***** BUS FAULT *****
[00:00:09.049,377] &amp;lt;err&amp;gt; os:   Instruction bus error
[00:00:09.049,377] &amp;lt;err&amp;gt; os: r0/a1:  0x00000000  r1/a2:  0x00000003  r2/a3:  0x00000000
[00:00:09.049,407] &amp;lt;err&amp;gt; os: r3/a4:  0x20002ac0 r12/ip:  0x20002a14 r14/lr:  0x0000b969
[00:00:09.049,407] &amp;lt;err&amp;gt; os:  xpsr:  0x21000000
[00:00:09.049,438] &amp;lt;err&amp;gt; os: Faulting instruction address (r15/pc): 0x0af7f6b4
[00:00:09.049,438] &amp;lt;err&amp;gt; os: &amp;gt;&amp;gt;&amp;gt; ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
[00:00:09.049,468] &amp;lt;err&amp;gt; os: Current thread: 0x20001838 (main)
�*** Booting Zephyr OS build v3.0.99-ncs1-1  ***system
waiting 2 seconds for pins to get up gpio initialisiert 
[00:00:00.027,557] &amp;lt;inf&amp;gt; LSM6DSO: Initialize device LSM6DSO
[00:00:00.030,212] &amp;lt;inf&amp;gt; LSM6DSO: chip id 0x6c
&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span class="s1"&gt;further I tried to edit the Levels in i2c_gpio.c, but this helps neither.&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="p2"&gt;&lt;span class="s1"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="p2"&gt;&lt;span class="s1"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span class="s1"&gt;many thanks for the help :)&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Delayed Devicetree initialization for connected Sensors</title><link>https://devzone.nordicsemi.com/thread/387652?ContentTypeID=1</link><pubDate>Fri, 23 Sep 2022 10:26:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:473dbc43-1922-4dd2-8fb3-1acbb45efc1e</guid><dc:creator>&amp;#216;ivind</dc:creator><description>&lt;p&gt;Ok, I&amp;#39;ll look into this.&lt;/p&gt;
&lt;p&gt;To be clear, with Vdd it works the first time, and the measurements are correct?&lt;br /&gt;But when powered by a GPIO, it fails to initialize, then after a reset it is able to initialize, but then the measurements are wrong?&lt;br /&gt;So you are only able to get good measurements with Vdd?&lt;/p&gt;
&lt;p&gt;Not sure if this will work, but can you try changing this line from POST_KERNEL to APPLICATION? If it doesn&amp;#39;t work just change it back.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v3.0.99-ncs1-1/drivers/sensor/lsm6dso/lsm6dso.c#L870"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/v3.0.99-ncs1-1/drivers/sensor/lsm6dso/lsm6dso.c#L870&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Delayed Devicetree initialization for connected Sensors</title><link>https://devzone.nordicsemi.com/thread/387460?ContentTypeID=1</link><pubDate>Thu, 22 Sep 2022 10:50:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:71f9c87b-be71-458b-a618-688b17440600</guid><dc:creator>JonasGel</dc:creator><description>&lt;p&gt;Hello,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I just&amp;nbsp;created&amp;nbsp;a new hello_world Project and added it to the Attachment. In this Project I reduced the code to the Sensor initialization and readings.&lt;br /&gt;&lt;br /&gt;The Project is done with nRF Connect SDK 2.0.2&lt;br /&gt;There are 2 sensors attached on separate Bitbang-I2C busses&lt;/p&gt;
&lt;p&gt;The Sensors are powered via GPIO outputs from the nRF52805. The power consumption of both sensors is beneath the maximum current ratings.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;If I start the board with Sensors powered by Vdd all works fine and the detected measurements are fine. I can unplug from Vdd and plug them in the GPIO and they work well with the voltage provided by the GPIO outputs.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;If I start the Board with Sensors plugged in to the GPIO, the error-message from above is shown, the nRF resets and recognize the IMU sensor only at the second start. The displayed&amp;nbsp;values measured from the Sensors are incorrect.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In my understanding the Sensors were initialized before the GPIO voltage is present. I have tested to increase the initialization priority for sensor devices and decrease for the GPIO interface, but this doesn&amp;#39;t work for me.&amp;nbsp; &amp;nbsp;&lt;/p&gt;
&lt;p&gt;I would like to control the initialization process from the main-function or add a configuration that provides the sensors with power first and only the start the sensor initialization process.&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;I always had this issue.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Delayed Devicetree initialization for connected Sensors</title><link>https://devzone.nordicsemi.com/thread/387442?ContentTypeID=1</link><pubDate>Thu, 22 Sep 2022 09:57:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2833e05c-dbdc-4a6f-be35-804ae4273621</guid><dc:creator>&amp;#216;ivind</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;It seems like you are running an application you wrote yourself. Could you post the code that runs between start-up and the error?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Have you always had this issue since using the sensor? Have you tried adding the sensor to a sample application, like hello_world?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>