<?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>About implementing Errata 89</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/60026/about-implementing-errata-89</link><description>Hello, 
 I am using the SPIM module to communicate the NRF52832 with a sensor, every time it generates an interrupt - which is generated with a frequency of 25Hz. For the interruption I am using the GPIOTE. Between the sensor readings, when an interrupt</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 16 Apr 2020 14:52:19 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/60026/about-implementing-errata-89" /><item><title>RE: About implementing Errata 89</title><link>https://devzone.nordicsemi.com/thread/245059?ContentTypeID=1</link><pubDate>Thu, 16 Apr 2020 14:52:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1f42eaac-8605-41e2-ae5a-4b1c568aa38f</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;I guess this is because you keep the CPU awake while you wait for the SPI transfer to finish. Try replacing&amp;nbsp;while (!spi_xfer_done) in&amp;nbsp;spi_write_read(), etc., with the following:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;while (!spi_xfer_done)
{
    __WFE();
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This will put the CPU in sleep mode while the transfer completes. When the transfer is completed, the CPU will be woken by the interrupt from the SPI peripheral.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: About implementing Errata 89</title><link>https://devzone.nordicsemi.com/thread/244530?ContentTypeID=1</link><pubDate>Tue, 14 Apr 2020 17:02:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:135d189b-8b1b-4b9e-bb67-95735c399254</guid><dc:creator>Matheus Bordin </dc:creator><description>&lt;p&gt;&lt;span&gt;Hello, thanks for the reply! &lt;br /&gt;&lt;br /&gt;I managed to reproduce the behavior of Errata 89 and verified what you said, the consumption is static at around 400 uA, which is not my case. &lt;br /&gt;&lt;br /&gt;The graph of consumption follows, the resolution is not so good, but you can see that this consumption of 400uA occurs in peaks. I also put a graph with a sign that indicates when the CPU is on (high) and when it is in sleep (low) together with the SPI clock signal. Thus, I understand that consumption peaks only happen when the sensor is read. When I remove the reading from the accelerometer, the consumption is static at 10uA, which is expected by the consumption of the sensor when it is turned on.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/Captura-de-Tela-_2800_34_2900_.png" /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;(Each mark on the time axis is one second)&lt;br /&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x240/__key/communityserver-discussions-components-files/4/Captura-de-Tela-_2800_36_2900_.png" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/Captura-de-Tela-_2800_35_2900_.png" /&gt;&lt;br /&gt;(zoomed)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;br /&gt;In addition,&amp;nbsp;here is the relevant part of the code that was missing.&amp;nbsp;If I comment this line &amp;quot;bsp_accel_read(&amp;amp; accel_array);&amp;quot;, the consumption goes to the expected and the consumption peaks disappear. So, I believe it is related to SPI.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void setup(void) 
{
    log_init();
    uint32_t err_code = NRF_SUCCESS;
    err_code          = nrf_drv_gpiote_init();
    APP_ERROR_CHECK(err_code);

    app_timer_init();
    bsp_ble_stack_init();

    spi_init();
    i2c_init();
    i2c2_init();

    bsp_init();
    bsp_light_sensor_power_down();
    bsp_light_sensor2_power_down();
    i2c_disable();
    i2c2_disable();
    flash_power_down();

    rtc_init();
    rtc_set_time(calendar_to_epoch(&amp;amp;time_init));
}

uint8_t LIS3DH_FastReadReg(uint8_t Reg, uint8_t pRxData[])
{
	uint8_t tx_data[10] = {Reg | BIT_7 | BIT_6, 0,0,0,0,0,0,0,0,0};
        bsp_gpio_accel_cs_low();
        spi_write_read(tx_data, pRxData, 7);
        bsp_gpio_accel_cs_high();
}

__inline static void bsp_accel_read(int16_t array[])
{ 
	uint8_t sub_array[10];
	LIS3DH_FastReadReg(LIS3DH_OUT_X_L, sub_array);

	array[0] = (((int16_t)sub_array[1]) | (int16_t)(sub_array[2]&amp;lt;&amp;lt;8));
	array[1] = (((int16_t)sub_array[3]) | (int16_t)(sub_array[4]&amp;lt;&amp;lt;8));
	array[2] = (((int16_t)sub_array[5]) | (int16_t)(sub_array[6]&amp;lt;&amp;lt;8));
}

void loop(void) 
{  
  bsp_gpio_state_high();

  if (bsp_accel_get_irq_flag()) {
    bsp_accel_clear_irq_flag();
    bsp_accel_read(&amp;amp;accel_array);
  }

    // Power Management 
   __set_FPSCR(__get_FPSCR() &amp;amp; ~(FPU_EXCEPTION_MASK));      
   (void) __get_FPSCR();
   NVIC_ClearPendingIRQ(FPU_IRQn);
   bsp_gpio_state_low();
   APP_ERROR_CHECK(sd_app_evt_wait());
}

int main(void)

{
    setup();
    
    bsp_print_log(&amp;quot;Starting system&amp;#39;s tasks\n&amp;quot;);

    while (1) 
    {
        loop();
    }
}&lt;/pre&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: About implementing Errata 89</title><link>https://devzone.nordicsemi.com/thread/244506?ContentTypeID=1</link><pubDate>Tue, 14 Apr 2020 15:23:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1e5d757c-fed0-4cb6-b964-9cd45f779035</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not sure if errata 89 is relevant here if you only see peeks at 400 uA. This errata normally gives a static and constant current draw of 400 uA, event after uninitializing the serial interfaces. I&amp;#39;m also not sure&amp;nbsp;if the workaround will have any effect if you initialize the serial peripheral right after the uninitialization again.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you post a graph of the current consumption if you have this available? If you could also post your full project, that would help us determine what could cause the excessive current draw.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>