<?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>SAADC reading changes after system finish booting</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/52869/saadc-reading-changes-after-system-finish-booting</link><description>Hi everyone, 
 
 I am having problems reading the battery level using the SAADC. The main problem is that the reading is not consistent from when the device is booting to once the device has boot completely an is stable/IDLE. 
 During the initialization</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 08 May 2020 16:04:02 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/52869/saadc-reading-changes-after-system-finish-booting" /><item><title>RE: SAADC reading changes after system finish booting</title><link>https://devzone.nordicsemi.com/thread/249014?ContentTypeID=1</link><pubDate>Fri, 08 May 2020 16:04:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f8cbcc08-209d-4bf6-acf5-22104ab246c5</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;Two suggestions, first use completely different software since a software issue is suspected; second take a measurement on Vbatt then take a measurement on Vdd to ensure something peculiar is not happening to the latter. Sample ADC twice in both cases to avoid SAADC issues described elsewhere; don&amp;#39;t bother with calibration.&lt;/p&gt;
&lt;p&gt;To&amp;nbsp; run this sample ensure that the SAADC driver code you were using is not instantiated.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;// Analog positive and negative input channels have strange numbering:
//  PSELP_NC           0UL  Not connected
//  PSELP_AnalogInput0 1UL  AIN0
//  PSELP_AnalogInput1 2UL  AIN1
//  PSELP_AnalogInput2 3UL  AIN2
//  PSELP_AnalogInput3 4UL  AIN3
//  PSELP_AnalogInput4 5UL  AIN4
//  PSELP_AnalogInput5 6UL  AIN5
//  PSELP_AnalogInput6 7UL  AIN6
//  PSELP_AnalogInput7 8UL  AIN7
//  PSELP_VDD          9UL  VDD
#define PSELP_AnalogInput0 1
#define PSELP_VDD          9
int16_t MeasureBattery(void)
{
    volatile int16_t AdcCounts = 0;
#if 0
  // Start HFCLK from crystal oscillator, this will give the SAADC higher accuracy
  NRF_CLOCK-&amp;gt;TASKS_HFCLKSTART = 1;
  while (NRF_CLOCK-&amp;gt;EVENTS_HFCLKSTARTED == 0);
  NRF_CLOCK-&amp;gt;EVENTS_HFCLKSTARTED = 0;
#endif
    // Configure SAADC singled-ended channel, Internal reference (0.6V) and 1/6 gain
    NRF_SAADC-&amp;gt;CH[1].CONFIG = (SAADC_CH_CONFIG_GAIN_Gain1_6    &amp;lt;&amp;lt; SAADC_CH_CONFIG_GAIN_Pos) |
                              (SAADC_CH_CONFIG_MODE_SE         &amp;lt;&amp;lt; SAADC_CH_CONFIG_MODE_Pos) |
                              (SAADC_CH_CONFIG_REFSEL_Internal &amp;lt;&amp;lt; SAADC_CH_CONFIG_REFSEL_Pos) |
                              (SAADC_CH_CONFIG_RESN_Bypass     &amp;lt;&amp;lt; SAADC_CH_CONFIG_RESN_Pos) |
                              (SAADC_CH_CONFIG_RESP_Bypass     &amp;lt;&amp;lt; SAADC_CH_CONFIG_RESP_Pos) |
                              (SAADC_CH_CONFIG_TACQ_40us       &amp;lt;&amp;lt; SAADC_CH_CONFIG_TACQ_Pos);

    // Configure the SAADC channel with battery as positive input, no negative input(single ended)
    NRF_SAADC-&amp;gt;CH[1].PSELP = PSELP_AnalogInput0;  // Also do PSELP_VDD for Vdd supply
    NRF_SAADC-&amp;gt;CH[1].PSELN = SAADC_CH_PSELN_PSELN_NC &amp;lt;&amp;lt; SAADC_CH_PSELN_PSELN_Pos;

    // Configure the SAADC resolution; 14-bit can be used but manual suggests not reliable for single sample
    // NRF_SAADC-&amp;gt;RESOLUTION = SAADC_RESOLUTION_VAL_14bit &amp;lt;&amp;lt; SAADC_RESOLUTION_VAL_Pos;
    NRF_SAADC-&amp;gt;RESOLUTION = SAADC_RESOLUTION_VAL_12bit &amp;lt;&amp;lt; SAADC_RESOLUTION_VAL_Pos;

    // Configure result to be put in RAM at the location of &amp;quot;AdcCounts&amp;quot; variable
    NRF_SAADC-&amp;gt;RESULT.MAXCNT = 1;
    NRF_SAADC-&amp;gt;RESULT.PTR = (uint32_t)&amp;amp;AdcCounts;

    // No automatic sampling, will trigger with TASKS_SAMPLE
    NRF_SAADC-&amp;gt;SAMPLERATE = SAADC_SAMPLERATE_MODE_Task &amp;lt;&amp;lt; SAADC_SAMPLERATE_MODE_Pos;

    // Enable SAADC
    NRF_SAADC-&amp;gt;ENABLE = 1;

    // Start the SAADC and wait for the started event
    NRF_SAADC-&amp;gt;TASKS_START = 1;
    while (NRF_SAADC-&amp;gt;EVENTS_STARTED == 0)
        ;
    NRF_SAADC-&amp;gt;EVENTS_STARTED = 0;

    // Do a SAADC sample, will put the result in the configured RAM buffer
    NRF_SAADC-&amp;gt;TASKS_SAMPLE = 1;
    while (NRF_SAADC-&amp;gt;EVENTS_END == 0)
        ;
    NRF_SAADC-&amp;gt;EVENTS_END = 0;

    // Stop the SAADC, since it&amp;#39;s not used anymore
    NRF_SAADC-&amp;gt;TASKS_STOP = 1;
    while (NRF_SAADC-&amp;gt;EVENTS_STOPPED == 0)
        ;
    NRF_SAADC-&amp;gt;EVENTS_STOPPED = 0;

    // second sample
    // Start the SAADC and wait for the started event
    NRF_SAADC-&amp;gt;TASKS_START = 1;
    while (NRF_SAADC-&amp;gt;EVENTS_STARTED == 0)
        ;
    NRF_SAADC-&amp;gt;EVENTS_STARTED = 0;
    // Do a SAADC sample, will put the result in the configured RAM buffer.
    NRF_SAADC-&amp;gt;TASKS_SAMPLE = 1;
    while (NRF_SAADC-&amp;gt;EVENTS_END == 0)
        ;
    NRF_SAADC-&amp;gt;EVENTS_END = 0;
    // Stop the SAADC, since it&amp;#39;s not used anymore.
    NRF_SAADC-&amp;gt;TASKS_STOP = 1;
    while (NRF_SAADC-&amp;gt;EVENTS_STOPPED == 0)
        ;
    NRF_SAADC-&amp;gt;EVENTS_STOPPED = 0;

   // Disable SAADC
   NRF_SAADC-&amp;gt;ENABLE = 0;
   return AdcCounts;
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC reading changes after system finish booting</title><link>https://devzone.nordicsemi.com/thread/249012?ContentTypeID=1</link><pubDate>Fri, 08 May 2020 15:37:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5550e7e1-1b58-4218-a2b8-040a48490d6a</guid><dc:creator>spw</dc:creator><description>&lt;p&gt;I haven&amp;#39;t done any changes, the configuration it&amp;#39;s the same in &lt;strong&gt;sdk_config.h&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC reading changes after system finish booting</title><link>https://devzone.nordicsemi.com/thread/221523?ContentTypeID=1</link><pubDate>Fri, 22 Nov 2019 10:15:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c7591e33-1dae-49d3-b97d-e8e49ba389bc</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Ok. Let us try a new approach? Have you done any changes to the SAADC settings? Do you have the same settings in NRFX_SAADC_CONFIG_... and SAADC_CONFIG_...?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC reading changes after system finish booting</title><link>https://devzone.nordicsemi.com/thread/221422?ContentTypeID=1</link><pubDate>Thu, 21 Nov 2019 19:28:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1b809487-3bc7-42fb-871f-ea7a0d31af47</guid><dc:creator>spw</dc:creator><description>[quote userid="26071" url="~/f/nordic-q-a/52869/saadc-reading-changes-after-system-finish-booting/220516"]Is it possible for me to recreate this on a DK without the LCD display?[/quote]
&lt;p&gt;No, I don&amp;#39;t think it is really possible to recreate it with a development kit. This is probably specific to the PCB &amp;amp; firmware developed.&lt;/p&gt;
[quote userid="26071" url="~/f/nordic-q-a/52869/saadc-reading-changes-after-system-finish-booting/220516"]Can you try to measure with an&amp;nbsp;&lt;strong&gt;oscilloscope&lt;/strong&gt; instead of a multimeter?[/quote]
&lt;p&gt;I don&amp;#39;t think it is possible,&amp;nbsp;I will try it, but I don&amp;#39;t think there is a good way to connect the oscilloscope to the PCB in that specific point.&lt;/p&gt;
[quote userid="26071" url="~/f/nordic-q-a/52869/saadc-reading-changes-after-system-finish-booting/220516"]Maybe something is drawing power very shortly around the time when you are using the ADC? A multimeter will not be able to pick up these quick spikes/dips.&amp;nbsp;[/quote]
&lt;p&gt;I have tried to read continuously the battery using the SAADC in blocking mode, and doing nothing else on the firmware than that (No interruptions either). And all values seems the same result, so I don&amp;#39;t think there are spikes/dips happening at the same time of the SAADC, unless these spikes/dips are very common.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;spw&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC reading changes after system finish booting</title><link>https://devzone.nordicsemi.com/thread/220516?ContentTypeID=1</link><pubDate>Mon, 18 Nov 2019 10:08:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f33a9eff-d5f6-4895-b6cb-0ba1f0a286c7</guid><dc:creator>Edvin</dc:creator><description>[quote user="spw"]Honestly, it&amp;#39;s not that I want a layout review or similar, I attached the layout because you requested it. I just want to figure it out this issue which to me seems a software issue.[/quote]
&lt;p&gt;&amp;nbsp;Sorry. I forgot. It is a month since I last saw this ticket.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I am not sure whether this is a software or HW issue. Is it possible for me to recreate this on a DK without the LCD display?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Can you try to measure with an&amp;nbsp;&lt;strong&gt;oscilloscope&lt;/strong&gt; instead of a multimeter? Maybe something is drawing power very shortly around the time when you are using the ADC? A multimeter will not be able to pick up these quick spikes/dips.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;BR,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC reading changes after system finish booting</title><link>https://devzone.nordicsemi.com/thread/220353?ContentTypeID=1</link><pubDate>Fri, 15 Nov 2019 14:53:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:282f55b3-62a1-422e-a081-021d1a79c054</guid><dc:creator>spw</dc:creator><description>&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="26071" url="~/f/nordic-q-a/52869/saadc-reading-changes-after-system-finish-booting/219994"]Is this when the battery is totally charged vs when it is almost depleted, or is it within a few seconds?[/quote]
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This drop happens within the first seconds, after the LCD is power up and configured, all readings from the SAADC&amp;nbsp;drops but the readings on R26 and R24 with the multimeter stills the same.&lt;/p&gt;
&lt;p&gt;I have shut down everything, the only thing that seems affecting is the LCD. The LCD uses SPI communication, not sure if that is relevant.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="26071" url="~/f/nordic-q-a/52869/saadc-reading-changes-after-system-finish-booting/219994"]&amp;nbsp;This suggests that this is what is actually happening. The LCD draws more current, increasing the voltage drop over R24, decreasing the voltage on your measuring point.&amp;nbsp;[/quote]
&lt;p&gt;Well, I am not so sure about it, as I said above, the multimeter&amp;nbsp;reads&amp;nbsp;the same voltage drop on R26 and R24 during the boot, but the reading from the SAADC is for some reason different.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="26071" url="~/f/nordic-q-a/52869/saadc-reading-changes-after-system-finish-booting/219994"]If you want a layout review, I recommend that you create a new ticket explaining that, and it will be assigned to one of our HW engineers.&amp;nbsp;[/quote]
&lt;p&gt;Honestly, it&amp;#39;s not that I want a layout review or similar, I attached the layout because you requested it. I just want to figure it out this issue which to me seems a software issue.&lt;/p&gt;
&lt;p&gt;Why do you think this might be a hardware issue?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;To me, the fact that the multimeter reads a voltage drop different than the SAADC reading mean that there is some kind of software issue.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;spw&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC reading changes after system finish booting</title><link>https://devzone.nordicsemi.com/thread/219994?ContentTypeID=1</link><pubDate>Thu, 14 Nov 2019 08:29:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6511e8d1-1357-4792-b798-9906689d2f92</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I just read your initial post again:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]During the initialization the reading is around &lt;strong&gt;4.2 V&lt;/strong&gt; for battery totally charged while later it drops to around&lt;strong&gt; 3.6 V&lt;/strong&gt;.[/quote]
&lt;p&gt;&amp;nbsp;Is this when the battery is totally charged vs when it is almost depleted, or is it within a few seconds?&lt;/p&gt;
&lt;p&gt;And again, is it possible to shut everything else off? the LCD and everything potentially drawing a lot of current? Remember that the more current you draw, the more current will go through R24, and the voltage on your measuring point will be lower.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote user="spw"]as I said in my previous post only &lt;strong&gt;cut off&lt;/strong&gt; the power of the LCD seems to allow a correct reading of the battery.[/quote]
&lt;p&gt;&amp;nbsp;This suggests that this is what is actually happening. The LCD draws more current, increasing the voltage drop over R24, decreasing the voltage on your measuring point.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;If you want a layout review, I recommend that you create a new ticket explaining that, and it will be assigned to one of our HW engineers.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC reading changes after system finish booting</title><link>https://devzone.nordicsemi.com/thread/219925?ContentTypeID=1</link><pubDate>Wed, 13 Nov 2019 15:58:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b807ebea-f3a8-4892-bf8c-a2efc57224eb</guid><dc:creator>spw</dc:creator><description>&lt;p&gt;Hi, sorry for the late response.&lt;/p&gt;
&lt;p&gt;The pin where I connected the SAADC pin is not much accessible. I can connect the multimeter, but it will be hard to connect the oscilloscope and impossible to measure the current through it without desolder on the PCB. (I can&amp;#39;t do this, I am not skilled enough)&lt;/p&gt;
&lt;p&gt;I have tried to disable most of the components, and as I said in my previous post only &lt;strong&gt;cut off&lt;/strong&gt; the power of the LCD seems to allow a correct reading of the battery. I have tried reading the battery in timers and in normal loop operation, using blocking and non-blocking mode for SAADC, and all of them reported the same kind of problem.&lt;/p&gt;
&lt;p&gt;I had attached 3 images:&lt;/p&gt;
&lt;p&gt;1. It&amp;#39;s an image of the MIC2091 layout which output is connected to resistor divider that is connected to the AIN0 pin of the nordic to measure the battery level. (I marked the point were I make my measurements.)&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/3716.Captura-de-pantalla-2019_2D00_11_2D00_13-a-las-16.28.31.jpg" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;2. It&amp;#39;s an image of the battery charger layout which is connected to the battery and also to the MIC2091 input&amp;nbsp;using the VBAT line.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/4300.Captura-de-pantalla-2019_2D00_11_2D00_13-a-las-16.28.16.jpg" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;3. This is a partial image of the Nordic pins related to the battery monitor and charging.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/8103.Captura-de-pantalla-2019_2D00_11_2D00_13-a-las-16.29.13.jpg" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;spw&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC reading changes after system finish booting</title><link>https://devzone.nordicsemi.com/thread/214979?ContentTypeID=1</link><pubDate>Tue, 15 Oct 2019 08:03:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e4af9c62-aeb4-4dd3-beb3-3c293695c045</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Ideally the voltage where you have connected the ADC pin that you use. Is that not accessible?&lt;/p&gt;
&lt;p&gt;In addition. What sort of operation do you do approximately at the same time that you measure the ADC? Do you do it in a BLE event? Do you do it when you receive an event related to the PCB? Or do you call it from a timer interrupt or something?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;And also, is it possible to send your PCB layout, so that I can see where you are measureing?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC reading changes after system finish booting</title><link>https://devzone.nordicsemi.com/thread/214924?ContentTypeID=1</link><pubDate>Mon, 14 Oct 2019 20:16:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:02f96f0a-827a-4590-830c-2fabca510c12</guid><dc:creator>spw</dc:creator><description>&lt;p&gt;Can you specify&amp;nbsp;which current do you want me to measure?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If it&amp;#39;s the current that comes from the battery, that might be possible, but if it&amp;#39;s the current to the Nordic chip or the voltage divisor, that might be hard to achieve I think. The PCB, which I work with, doesn&amp;#39;t have an easy access to such thing.&lt;/p&gt;
&lt;p&gt;I have measure the voltage of the battery with an oscilloscope, and it seems like the voltage drop 0.07V&amp;nbsp;during boot.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;spw&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC reading changes after system finish booting</title><link>https://devzone.nordicsemi.com/thread/214783?ContentTypeID=1</link><pubDate>Mon, 14 Oct 2019 10:16:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0f55c3e2-c331-4326-be4d-4c25bcecc58e</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello spw,&lt;/p&gt;
&lt;p&gt;Can you try to measure your current using an oscilloscope?&lt;/p&gt;
&lt;p&gt;It may be that the nRF is doing something at the same time as it measures the battery voltage, such as SPI to update the screen. In that case, you will see very short drops in the voltage, which the multimeter probably will not notice. An oscilloscope will be able to graph that for you.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;BR,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC reading changes after system finish booting</title><link>https://devzone.nordicsemi.com/thread/214636?ContentTypeID=1</link><pubDate>Fri, 11 Oct 2019 14:32:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6de05a91-1d6a-49d0-999a-827f615c1284</guid><dc:creator>spw</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;That is&amp;nbsp;very similar&amp;nbsp;&amp;nbsp;to the layout to measure the battery that the board uses, the only difference is that there is a MIC2091 IC connected between the battery and the voltage divisor to control the max current input to the divisor (I am not the EE that design it, so I dunno why it&amp;#39;s there only how it works). Furthermore, I am able to read the resistance of the voltage divisor (R1 and R2 in your drawing) with a multimeter, and they read correctly. That&amp;#39;s how I know the SAADC reading must be wrong. The readings are:&lt;br /&gt;&lt;br /&gt;With &lt;strong&gt;multimeter&lt;/strong&gt; (when battery is fully charged):&amp;nbsp;&lt;br /&gt;Voltage across &lt;strong&gt;R1 = 2.4 V&lt;/strong&gt;&lt;br /&gt;Voltage across&lt;strong&gt; R2 = 1.8 V&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Which means battery voltage is &lt;strong&gt;4.2 V&lt;/strong&gt;. That reading stay stable at any time and it doesn&amp;#39;t change abruptly&lt;/p&gt;
&lt;p&gt;With &lt;strong&gt;SAADC&lt;/strong&gt; configured as:&lt;/p&gt;
&lt;p&gt;pin = &lt;strong&gt;AIN0&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Gain = &lt;strong&gt;1/6&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Reference = &lt;strong&gt;0.6 V&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Resolution = &lt;strong&gt;12&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;m =&lt;strong&gt; 0 (Single mode)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I get a readings when battery is fully charged of:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;1600&lt;/strong&gt; approx. before turn on the &lt;strong&gt;LCD&lt;/strong&gt; (&lt;strong&gt;4.2 V&lt;/strong&gt; approx using the &lt;span&gt;formula&lt;/span&gt;)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;1370&lt;/strong&gt; approx after turning on the &lt;strong&gt;LCD&lt;/strong&gt; (&lt;strong&gt;3.6 V&lt;/strong&gt; approx using the formula)&lt;/p&gt;
&lt;p&gt;I understand that turn on components that could require a significant amount of current could make the battery voltage to drop, but shouldn&amp;#39;t the multimeter readings also reflect that drop?&lt;/p&gt;
&lt;p&gt;Also, the voltage drop is very significant (around &lt;strong&gt;0.6V&lt;/strong&gt;), and basically makes the battery go from a fully charged to a low battery state. Also, I am not sure if it&amp;#39;s significant, but this happens no matter if the charger is connected or not.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I ain&amp;#39;t expert in hardware, but I don&amp;#39;t see any indicative of a hardware problem is causing this weird readings, since the multimeter would reflect those too. Am I wrong?&lt;/p&gt;
&lt;p&gt;If you think they might be a hardware problem and you want me to check anything, I can do it .&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;spw&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC reading changes after system finish booting</title><link>https://devzone.nordicsemi.com/thread/214508?ContentTypeID=1</link><pubDate>Fri, 11 Oct 2019 07:17:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8f458fec-1a0f-44b3-b4ba-e78352ba6115</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;I don&amp;#39;t know what your layout looks like, but maybe you can show me what your circuitry around the battery measurement looks like?&lt;/p&gt;
&lt;p&gt;For reference, we typically use this:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/measuring-lithium-battery-voltage-with-nrf52"&gt;https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/measuring-lithium-battery-voltage-with-nrf52&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Remember that when you draw a lot of current, such as the LCD screen, the battery voltage&amp;nbsp;will drop, due to internal resistance in the battery.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC reading changes after system finish booting</title><link>https://devzone.nordicsemi.com/thread/214441?ContentTypeID=1</link><pubDate>Thu, 10 Oct 2019 14:45:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:58cb14df-0460-48ee-8dfd-800b696de524</guid><dc:creator>spw</dc:creator><description>&lt;p&gt;Hi Edvin,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Mora than in the&amp;nbsp;state, it depends on the&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;LCD&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;being&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;ON&lt;/strong&gt;, or not. One of my latest test has been:&lt;/p&gt;
&lt;p&gt;1- Boot the device normally. (this includes, turn on the&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;LCD&lt;/strong&gt;).&lt;/p&gt;
&lt;p&gt;2- Read the battery using the&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;SAADC&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;3- Cut off the&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;LCD&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;power using&amp;nbsp;the voltage regulator.&lt;/p&gt;
&lt;p&gt;4- Read the battery using the&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;SAADC&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;In this test,&amp;nbsp;the result was a correct battery reading after the&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;LCD&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;power was cut off (step 4), but not&amp;nbsp;before cut the power (step 2).&lt;/p&gt;
&lt;p&gt;So, somehow, it seems like the&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;LCD&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;is interfering with the&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;SAADC&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;reading, but I have no idea how. Just as an extra piece of information, the&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;LCD&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;is the&amp;nbsp;&lt;strong&gt;ili9341,&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/strong&gt;and it&amp;#39;s controlled through as&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;SPI&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;communication as I explained previously.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC reading changes after system finish booting</title><link>https://devzone.nordicsemi.com/thread/213395?ContentTypeID=1</link><pubDate>Fri, 04 Oct 2019 11:29:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6402f3de-1367-46d4-9322-8a1f7d31ea8c</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;So the SAADC readings is different depening on what state you are in? Does it only happen if you read the battery? Or does it happen if you try to read another source as well?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>