<?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>nRF5340 - untrust device_is_ready</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/104545/nrf5340---untrust-device_is_ready</link><description>Hi, I&amp;#39;m having unexpected true return from device_is_ready API even if the I2C fuel-gauge MAX17262 device is not powered (i.e. battery disconnected). How can it be ? 
 Here is the dts key definition 
 
 This is the test code snippet 
 
 
 Environment</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 27 Nov 2023 08:27:56 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/104545/nrf5340---untrust-device_is_ready" /><item><title>RE: nRF5340 - untrust device_is_ready</title><link>https://devzone.nordicsemi.com/thread/457469?ContentTypeID=1</link><pubDate>Mon, 27 Nov 2023 08:27:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cb7cf0c6-45c2-4238-b5ea-69bab4787e0a</guid><dc:creator>Gabriele</dc:creator><description>&lt;p&gt;Hello.&amp;nbsp;Upgrading&amp;nbsp;NCS to v2.5.0-3 fixes this issue.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 - untrust device_is_ready</title><link>https://devzone.nordicsemi.com/thread/453077?ContentTypeID=1</link><pubDate>Mon, 30 Oct 2023 14:25:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8cfe7627-f23e-467f-9970-539430b8bd19</guid><dc:creator>Elfving</dc:creator><description>&lt;p&gt;I am not sure, and I agree that this is strange.&lt;/p&gt;
&lt;p&gt;Have you tried configuring it to shut down when the battery is detached, using&amp;nbsp;THSH?&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Elfving&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 - untrust device_is_ready</title><link>https://devzone.nordicsemi.com/thread/452491?ContentTypeID=1</link><pubDate>Thu, 26 Oct 2023 10:06:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ba5ed75a-10a8-4f63-9390-73282275d737</guid><dc:creator>Gabriele</dc:creator><description>&lt;p&gt;Hello Elfving,&lt;/p&gt;
&lt;p&gt;When the battery is connected VBATSYS = VBAT = 4.19 V&lt;br /&gt;When the battery is disconnected (circuit gets supplied by USB) VBATSYS = VBAT = 1.28 V&lt;br /&gt;According to datasheet, the minimum operative voltage is V_BATT &amp;gt;= 2.3 V.&lt;br /&gt;This would suffice to guarantee that the device cannot respond onto I2C bus, thus how can it be device_is_ready(dev) = 1 ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 - untrust device_is_ready</title><link>https://devzone.nordicsemi.com/thread/451623?ContentTypeID=1</link><pubDate>Mon, 23 Oct 2023 07:43:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:49ad57fd-f81d-479a-bd74-4d9cde77dce8</guid><dc:creator>Elfving</dc:creator><description>&lt;p&gt;Hello Gabriele,&lt;/p&gt;
&lt;p&gt;Could you try to measure the voltage on VBATSYS or SYS? A voltage on SYS should be enough to power BATT and the rest of the circuit.&lt;/p&gt;
&lt;p&gt;&lt;strong&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/pastedimage1698046152161v1.png" alt=" " /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;From the &lt;a href="https://www.analog.com/media/en/technical-documentation/data-sheets/MAX17262.pdf"&gt;datasheet of the&amp;nbsp;MAX17262&lt;/a&gt;&amp;nbsp;it seems that it &lt;em&gt;can&lt;/em&gt; be configured to shutdown when it detects that the battery is removed. It seems to me that it might be powered from the USB.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Elfving&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 - untrust device_is_ready</title><link>https://devzone.nordicsemi.com/thread/450109?ContentTypeID=1</link><pubDate>Thu, 12 Oct 2023 15:02:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c82cb093-9743-4ac4-a80d-30722d7582db</guid><dc:creator>Gabriele</dc:creator><description>&lt;p&gt;I did&amp;#39;n t check the DK.&lt;/p&gt;
&lt;p&gt;This is a custom board.&amp;nbsp;Hereunder the hardware schematic detail&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/max17262_5F00_hw.png" /&gt;&lt;/p&gt;
&lt;p&gt;As per as I know&amp;nbsp;&lt;span&gt;DK doesn&amp;#39;t contain any fuel-gauge chip. Does it make sense to check it out ?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 - untrust device_is_ready</title><link>https://devzone.nordicsemi.com/thread/450105?ContentTypeID=1</link><pubDate>Thu, 12 Oct 2023 14:46:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1fa39c3a-e9bb-4517-997e-96d3e5056d88</guid><dc:creator>Elfving</dc:creator><description>&lt;p&gt;That is odd. I asked about the sample because I managed to quickly check that I did not run into this issue myself when checking it with a DK yesterday. Maybe there was something I overlooked.&lt;/p&gt;
&lt;p&gt;Are you seeing this with a DK as well? Are you trying this with a custom board?&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Elfving&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 - untrust device_is_ready</title><link>https://devzone.nordicsemi.com/thread/450005?ContentTypeID=1</link><pubDate>Thu, 12 Oct 2023 09:59:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2d2c1643-5697-4391-96f7-7275bca93406</guid><dc:creator>Gabriele</dc:creator><description>&lt;p&gt;The problem persists also with MAX17262 sample from Zephyr.&lt;/p&gt;
&lt;p&gt;This is the main code:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/*
 * Copyright (c) 2020 Matija Tudan
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#include &amp;lt;zephyr/kernel.h&amp;gt;
#include &amp;lt;zephyr/device.h&amp;gt;
#include &amp;lt;zephyr/devicetree.h&amp;gt;
#include &amp;lt;zephyr/drivers/sensor.h&amp;gt;

void main(void)
{
	const struct device *const dev = DEVICE_DT_GET_ONE(maxim_max17262);

	printk(&amp;quot;device_is_ready is %d\n&amp;quot;, device_is_ready(dev));

	if (!device_is_ready(dev)) {
		printk(&amp;quot;sensor: device not ready.\n&amp;quot;);
		return;
	}

	while (1) {
		struct sensor_value voltage, avg_current, temperature;
		float i_avg;

		sensor_sample_fetch(dev);
		sensor_channel_get(dev, SENSOR_CHAN_GAUGE_VOLTAGE, &amp;amp;voltage);
		sensor_channel_get(dev, SENSOR_CHAN_GAUGE_AVG_CURRENT,
						  &amp;amp;avg_current);
		sensor_channel_get(dev, SENSOR_CHAN_GAUGE_TEMP, &amp;amp;temperature);

		i_avg = avg_current.val1 + (avg_current.val2 / 1000000.0);

		printk(&amp;quot;V: %d.%06d V; I: %f mA; T: %d.%06d &amp;#176;C\n&amp;quot;,
		      voltage.val1, voltage.val2, (double)i_avg,
		      temperature.val1, temperature.val2);

		k_sleep(K_MSEC(1000));
	}
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This is the console output:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/max17262_5F00_issue.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 - untrust device_is_ready</title><link>https://devzone.nordicsemi.com/thread/449844?ContentTypeID=1</link><pubDate>Wed, 11 Oct 2023 13:21:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c55014d0-dc42-4ff4-ba46-167f44bc51cd</guid><dc:creator>Elfving</dc:creator><description>&lt;p&gt;Hello Gabriele,&lt;/p&gt;
&lt;p&gt;That is odd.&amp;nbsp;Are you seeing the same thing with the basic&amp;nbsp;fuel-gauge MAX17262 sample from zephyr?&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Elfving&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>