<?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>nRF52832 Rebootig once in a while - unknown reason</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/59456/nrf52832-rebootig-once-in-a-while---unknown-reason</link><description>Hi, 
 I made a temperature logging device using nRF52832 (SDK 12.3.0). The temperature sensor is read over I2C every 5 minutes and data is sent over radio communication. There is also battery voltage reading on 12 hours. The software is rather simple</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 25 Mar 2020 02:15:15 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/59456/nrf52832-rebootig-once-in-a-while---unknown-reason" /><item><title>RE: nRF52832 Rebootig once in a while - unknown reason</title><link>https://devzone.nordicsemi.com/thread/241490?ContentTypeID=1</link><pubDate>Wed, 25 Mar 2020 02:15:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bd9c7b9b-2179-4b33-8357-82d8b891141f</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;My car doesn&amp;#39;t have a battery as powerful as that ..&lt;/p&gt;
&lt;p&gt;For &lt;span&gt;&lt;em&gt;MWU_ACCESS_WATCH_MASK&lt;/em&gt;&amp;nbsp;&lt;/span&gt;I added this to &lt;em&gt;./components/libraries/util/sdk_common.h&lt;/em&gt;:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;// Errata 75: MWU: Increased current consumption
//  This has to be handled by turning off MWU region 0 which is used in SoftDevice
//  see https://infocenter.nordicsemi.com/index.jsp?topic=%2Ferrata_nRF52832_EngB%2FERR%2FnRF52832%2FEngineeringB%2Flatest%2Fanomaly_832_75.html
//
// The Memory watch unit (MWU) can be used to generate events when a memory region is accessed
// by the CPU. The MWU can be configured to trigger events for access to Data RAM and Peripheral
// memory segments. The MWU allows an application developer to generate memory access events during
// development for debugging or during production execution for failure detection and recovery
//
// SoftDevice is protecting memory area Write 0 PRGN 0  from 0x20000000-0x20002a97, PREGION[0].SUBS 0x4200f903 (0, 1, 11, 12, 13, 14, 15, 25, 30)
#define MWU_ACCESS_WATCH_MASK (0x0F0000FF)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Maybe add a dedicated error handler to override the default so a system assert doesn&amp;#39;t cause a reset but allows you to track when they happen:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;// Define this as no action to override internal check
void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info)
{
    appErrorCounter++;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Initialise it in main() before anything else if this is the very first time power has been applied,&amp;nbsp; although even better put in&amp;nbsp;&lt;em&gt;SystemInit()&lt;/em&gt;:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define I_AM_INITIALISED 0x12345678  // Any pattern will do here

main()
{
  if (appErrorCounterReady != I_AM_INITIALISED)
  {
    appErrorCounter = 0;
    appErrorCounterReady = I_AM_INITIALISED;
  }
  // Capture reset reason
  uint32_t WakeupReason = NRF_POWER-&amp;gt;RESETREAS;
  ...
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Ensure values are not&amp;nbsp;cleared on a reset; In IAR:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;// Place following data in section .noinit so it doesn&amp;#39;t get wiped on a reset
#pragma default_variable_attributes = @ &amp;quot;.noinit&amp;quot;
volatile uint32_t appErrorCounter;
volatile uint32_t appErrorCounterReady;
#pragma default_variable_attributes =
// End - Place following data in section .noinit so it doesn&amp;#39;t get wiped on a reset&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;In SES:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;// Place following data in section .noinit so it doesn&amp;#39;t get wiped on a reset
volatile uint32_t appErrorCounter       __attribute__((section(&amp;quot;.non_init&amp;quot;)));
volatile uint32_t appErrorCounterReady  __attribute__((section(&amp;quot;.non_init&amp;quot;)));
// End - Place following data in section .noinit so it doesn&amp;#39;t get wiped on a reset&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Ensure you have RAM always powered up, at least the areas where the counter above is stored&lt;em&gt;:&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;   // Set RAM power modes in system off
   //
   //  RAM0 Section 0 0x2000 0000 - 0x2000 0FFF
   //       Section 1 0x2000 1000 - 0x2000 1FFF
   //  RAM1 Section 0 0x2000 2000 - 0x2000 2FFF
   //       Section 1 0x2000 3000 - 0x2000 3FFF
   //  RAM2 Section 0 0x2000 4000 - 0x2000 4FFF
   //       Section 1 0x2000 5000 - 0x2000 5FFF
   //  RAM3 Section 0 0x2000 6000 - 0x2000 6FFF
   //       Section 1 0x2000 7000 - 0x2000 7FFF
   //  RAM4 Section 0 0x2000 8000 - 0x2000 8FFF
   //       Section 1 0x2000 9000 - 0x2000 9FFF
   //  RAM5 Section 0 0x2000 A000 - 0x2000 AFFF
   //       Section 1 0x2000 B000 - 0x2000 BFFF
   //  RAM6 Section 0 0x2000 C000 - 0x2000 CFFF
   //       Section 1 0x2000 D000 - 0x2000 DFFF
   //  RAM7 Section 0 0x2000 E000 - 0x2000 EFFF
   //       Section 1 0x2000 F000 - 0x2000 FFFF
   NRF_POWER-&amp;gt;RAM[7].POWERSET = (POWER_RAM_POWER_S0POWER_On     &amp;lt;&amp;lt; POWER_RAM_POWER_S0POWER_Pos)      |
                                (POWER_RAM_POWER_S1POWER_On     &amp;lt;&amp;lt; POWER_RAM_POWER_S1POWER_Pos)      |
                                (POWER_RAM_POWER_S0RETENTION_On &amp;lt;&amp;lt; POWER_RAM_POWER_S0RETENTION_Pos)  |
                                (POWER_RAM_POWER_S1RETENTION_On &amp;lt;&amp;lt; POWER_RAM_POWER_S1RETENTION_Pos);
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Be aware the Nordic errata handlers will force unexpected resets the first few times code is run after a full erase, which messes up your expected reset reason, see &lt;em&gt;system_nrf52.c&lt;/em&gt;. An example:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    /* Configure NFCT pins as GPIOs if NFCT is not to be used in your code. If CONFIG_NFCT_PINS_AS_GPIOS is not defined,
       two GPIOs (see Product Specification to see which ones) will be reserved for NFC and will not be available as
       normal GPIOs. */
    #if defined (CONFIG_NFCT_PINS_AS_GPIOS)
        if ((NRF_UICR-&amp;gt;NFCPINS &amp;amp; UICR_NFCPINS_PROTECT_Msk) == (UICR_NFCPINS_PROTECT_NFC &amp;lt;&amp;lt; UICR_NFCPINS_PROTECT_Pos)){
            NRF_NVMC-&amp;gt;CONFIG = NVMC_CONFIG_WEN_Wen &amp;lt;&amp;lt; NVMC_CONFIG_WEN_Pos; // Write Enable
            while (NRF_NVMC-&amp;gt;READY == NVMC_READY_READY_Busy){}
            NRF_UICR-&amp;gt;NFCPINS &amp;amp;= ~UICR_NFCPINS_PROTECT_Msk;
            while (NRF_NVMC-&amp;gt;READY == NVMC_READY_READY_Busy){}
            NRF_NVMC-&amp;gt;CONFIG = NVMC_CONFIG_WEN_Ren &amp;lt;&amp;lt; NVMC_CONFIG_WEN_Pos; // Read-only Enable
            while (NRF_NVMC-&amp;gt;READY == NVMC_READY_READY_Busy){}
            // UICR changes require a reset to be effective
            NVIC_SystemReset();
        }
    #endif&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 Rebootig once in a while - unknown reason</title><link>https://devzone.nordicsemi.com/thread/241477?ContentTypeID=1</link><pubDate>Tue, 24 Mar 2020 21:58:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ece9af54-6b1d-4b37-a4a8-b25f657d7b7e</guid><dc:creator>Peter_53</dc:creator><description>&lt;p&gt;Also, I tried to add MWU Disable but MWU_ACCESS_WATCH_MASK is not defined.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 Rebootig once in a while - unknown reason</title><link>https://devzone.nordicsemi.com/thread/241473?ContentTypeID=1</link><pubDate>Tue, 24 Mar 2020 21:26:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ad5f3a16-3195-43db-8687-8c8d6e817118</guid><dc:creator>Peter_53</dc:creator><description>&lt;p&gt;hmolesworth, thanks for the quick reply. I will try all the things you mentioned, and get back with results. Meanwhile regarding the battery and capacitors.&lt;/p&gt;
&lt;p&gt;I am not using coin cell battery. I am using SAFT 3.6V Lithium 14500 Li-SOCI2 battery (without DC-DC converter). Between the battery and the nRF52832 there is a P-MOSFET as a battery reverse polarity protection. Regarding the capacitors, there are several between the nrfVDD and GND: 100nF on nRF pin-13 (VDD pin);&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;100nF on nRF pin-36 (VDD pin);&amp;nbsp;4.7uF on nRF pin-48 (VDD pin); and also a 100 nF&amp;nbsp;on VDD pin of temperature sensor.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 Rebootig once in a while - unknown reason</title><link>https://devzone.nordicsemi.com/thread/241467?ContentTypeID=1</link><pubDate>Tue, 24 Mar 2020 20:46:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:31692deb-6952-4694-8ad3-bf7284cb66c0</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;Are you using a coin cell or a battery with more oomph? The coin cell is most susceptible to causing resets; if not using the DC-DC convertor, worth enabling it to see if it affects the frequency with which the problem occurs:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;   // DC-DC power supply enable, saves over using internal LDO regulator
   nrf_power_dcdcen_set(true);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;If using a coin cell temporarily add 100uF to 150uF capacitor to the coin cell to see if it affects the issue. Unless there is already significant capacitance such as that then it may be effective regardless of battery type.&lt;/p&gt;
&lt;p&gt;There are two errata which may be relevant:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;      // Errata 220: CPU: RAM is not ready when written - Disable IRQ while using WFE
      // Enable SEVONPEND to disable interrupts so the internal events that generate the interrupt cause wakeuup in __WFE context and not in interrupt context
      // Before: ENABLE_WAKEUP_SOURCE -&amp;gt; __WFE -&amp;gt; WAKEUP_SOURCE_ISR -&amp;gt; CONTINUE_FROM_ISR  next line of __WFE
      // After:  ENABLE_WAKEUP_SOURCE -&amp;gt; SEVONPEND -&amp;gt; DISABLE_INTERRUPTS -&amp;gt; __WFE -&amp;gt; WAKEUP inside __WFE -&amp;gt; ENABLE_interrupts -&amp;gt; WAKEUP_SOURCE_ISR
      //
      // Errata 75: MWU: Increased current consumption
      // This has to be handled by turning off MWU but it is used in SoftDevice
      // see https://infocenter.nordicsemi.com/index.jsp?topic=%2Ferrata_nRF52832_EngB%2FERR%2FnRF52832%2FEngineeringB%2Flatest%2Fanomaly_832_75.html
      //
      // Errata 220: Enable SEVONPEND
      SCB-&amp;gt;SCR |= SCB_SCR_SEVONPEND_Msk;
      __disable_irq();
      // Errata 75: MWU Disable
      uint32_t MWU_AccessWatchMask = NRF_MWU-&amp;gt;REGIONEN &amp;amp; MWU_ACCESS_WATCH_MASK;
      // Handle MNU if any areas are enabled
      if (MWU_AccessWatchMask)
      {
         NRF_MWU-&amp;gt;REGIONENCLR = MWU_AccessWatchMask; // Disable write access watch in region[0] and PREGION[0]
         __WFE();
         __NOP(); __NOP(); __NOP(); __NOP();
         // Errata 75: MWU Enable
         NRF_MWU-&amp;gt;REGIONENSET = MWU_AccessWatchMask;
      }
      else
      {
         __WFE();
         __NOP(); __NOP(); __NOP(); __NOP();
      }
      __enable_irq();&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;There is a VDD ramp issue which may be relevant, typical with insufficient gap between BLE and other events or lack of storage capacitance on the battery, see&amp;nbsp;&lt;em&gt;18.10.2 Device startup times&lt;/em&gt; Note 10&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;// Note 10: A step increase in supply voltage of 300 mV or more, with rise time
// of 300 ms or less, within the valid supply range, may result in a system reset.&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>