<?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>nrf52 TWI excess current consumption</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/15908/nrf52-twi-excess-current-consumption</link><description>Hello,
I use an I2C device to wake up a nrf52 microcontroler.
If I just use the init function 
 static ret_code_t twi_master_init(void)
{
 ret_code_t ret;
 const nrf_drv_twi_config_t config =
 {
 .scl = 6,
 .sda = 5,
 .frequency = NRF_TWI_FREQ_400K</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 06 Apr 2019 09:13:35 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/15908/nrf52-twi-excess-current-consumption" /><item><title>RE: nrf52 TWI excess current consumption</title><link>https://devzone.nordicsemi.com/thread/180583?ContentTypeID=1</link><pubDate>Sat, 06 Apr 2019 09:13:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9e24ca0d-a363-4976-8a83-f91b25d6057d</guid><dc:creator>????</dc:creator><description>&lt;p&gt;I got the same issue as you, did you solve it at the end?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 TWI excess current consumption</title><link>https://devzone.nordicsemi.com/thread/60691?ContentTypeID=1</link><pubDate>Sun, 02 Jul 2017 16:49:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9766ce4e-8c72-4a65-aace-6f60c2484a6d</guid><dc:creator>Dajgoro Labinac</dc:creator><description>&lt;p&gt;Thats a bit different form what I have form the example, where do you get the &amp;amp;m_twi_master?
Here is what I have:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;void twi_init(void)
{
nrf_drv_twi_init(&amp;amp;m_twi, &amp;amp;twi_config, NULL, NULL);
nrf_drv_twi_enable(&amp;amp;m_twi);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And then I before each i2c operation i have functions to stop and start twi:
EDIT:&lt;/p&gt;
&lt;p&gt;I got it working, here are the modifications:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;void twi_start(void)
{
	nrf_drv_twi_init(&amp;amp;m_twi, &amp;amp;twi_config, NULL, NULL);
	nrf_drv_twi_enable(&amp;amp;m_twi);
}

void twi_stop()
{
	nrf_drv_twi_uninit(&amp;amp;m_twi);
	*(volatile uint32_t *)0x40003FFC = 0;
	*(volatile uint32_t *)0x40003FFC;
	*(volatile uint32_t *)0x40003FFC = 1;
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 TWI excess current consumption</title><link>https://devzone.nordicsemi.com/thread/60690?ContentTypeID=1</link><pubDate>Sun, 02 Jul 2017 16:40:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9a311724-ce3e-4b30-a919-fe04b25c3b17</guid><dc:creator>cedric</dc:creator><description>&lt;p&gt;Here is what i&amp;#39;ve done :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;twi_master_init();
	i2cTxBuffer[0]=REG_CTRL1;
	i2cTxBuffer[1]=0x4F;// 50Hz, Low power mode
	i2cTxBuffer[2]=0xC4;
	i2cTxBuffer[3]=0x80;
	i2cTxBuffer[4]=0x10;
	i2cTxBuffer[5]=0x08;
	i2cTxBuffer[6]=0x00;
	nrf_drv_twi_tx(&amp;amp;m_twi_master,ADDRESS,(uint8_t*)i2cTxBuffer,7,true);
	twi_master_uninit();
	twi_master_init();
	i2cTxBuffer[0]=REG_CTRL2;
	i2cTxBuffer[1]=0x4E;
	i2cTxBuffer[2]=0xdd;
	i2cTxBuffer[3]=0x88;
	i2cTxBuffer[4]=0x11;
	i2cTxBuffer[5]=0x12;
	i2cTxBuffer[6]=0x00;
	nrf_drv_twi_tx(&amp;amp;m_twi_master,ADDRESS_I2C_ADD,(uint8_t*)i2cTxBuffer,7,true);
	twi_master_uninit();
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;as you can see, I init transmit and then uninit. That&amp;#39;s strange, but it works...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 TWI excess current consumption</title><link>https://devzone.nordicsemi.com/thread/60692?ContentTypeID=1</link><pubDate>Sun, 02 Jul 2017 16:25:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8e829d23-44c7-4557-aff0-cec04c25e185</guid><dc:creator>Dajgoro Labinac</dc:creator><description>&lt;p&gt;I&amp;#39;m having the same issue with twi busy when attempting reconfiguration.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 TWI excess current consumption</title><link>https://devzone.nordicsemi.com/thread/60689?ContentTypeID=1</link><pubDate>Thu, 16 Feb 2017 22:47:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a194e036-fbd1-4c5c-ab98-efa1d6f4bc5a</guid><dc:creator>Paul Dunn</dc:creator><description>&lt;p&gt;I&amp;#39;m still having the same trouble I described above. Can you confirm you think this solutions works when running a soft device? (I am using SD 332.) If I do a &amp;#39;sd_app_evt_wait();&amp;#39; after the above, then a &amp;#39;nrf_drv_twi_enable&amp;#39;, I get error code 17 when I next try to use the TWI. Can you be more clear on what &amp;quot;Reconfiguration of TWI is required before next usage.&amp;quot; (from errata 89) means.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 TWI excess current consumption</title><link>https://devzone.nordicsemi.com/thread/60688?ContentTypeID=1</link><pubDate>Sat, 12 Nov 2016 21:05:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:76436e71-2d4a-4314-a71b-58f55a8f39a2</guid><dc:creator>Paul Dunn</dc:creator><description>&lt;p&gt;Aryan - I get an error code 17 (busy). I initialize using nrf_drv_twi_init and nrf_drv_enable, then when I want to sleep I issue nrf_drv_twi_disable prior to the two instruction in Errata 89 (using the volatile keyword, as the current does not reduce without it, presumably because the compiler optimizes out the instructions), then when I wake up I   nrf_drv_twi_enable, but get error 17 when I try to use the TWI.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 TWI excess current consumption</title><link>https://devzone.nordicsemi.com/thread/60686?ContentTypeID=1</link><pubDate>Fri, 11 Nov 2016 11:10:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:41c2a8dc-261c-4c2c-8cdc-9bd63e8333c3</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;blockquote&gt;
&lt;p&gt;but both return error codes&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;What error codes do you get and for which API?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 TWI excess current consumption</title><link>https://devzone.nordicsemi.com/thread/60687?ContentTypeID=1</link><pubDate>Thu, 10 Nov 2016 23:25:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2c62a100-525f-4ad8-b448-53e575e5630d</guid><dc:creator>Paul Dunn</dc:creator><description>&lt;p&gt;I tried the above as well, and it does indeed solve the problem of excess current with the TWI disabled. However, once I&amp;#39;ve issued these instructions, I cannot get the TWI to work again. Errata 89 says &amp;quot;Reconfiguration of TWI is required before next usage&amp;quot;. I tried re-initializing (nrf_drv_twi_init) and just re-enabling, but both return error codes, and the TWI does not work afterwards. I&amp;#39;m using SDK 11. Can you provide more details on what it takes to &amp;quot;reconfigure the TWI&amp;quot;. The errata also mentions &amp;quot;Turn the TWI off and back on after it has been disabled&amp;quot;. I assume that means to issue a nrf_drv_twi_disable prior to the above instructions; which is what I tried. Maybe provide a complete sequence of instructions to disable, then re-enable.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 TWI excess current consumption</title><link>https://devzone.nordicsemi.com/thread/60685?ContentTypeID=1</link><pubDate>Thu, 25 Aug 2016 15:20:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:137fa542-486b-4669-beff-e83ed07fe22f</guid><dc:creator>cedric</dc:creator><description>&lt;p&gt;ok that works. I thought I4ve tried this errata workaround in all the tries I&amp;#39;ve made, but it actually works.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 TWI excess current consumption</title><link>https://devzone.nordicsemi.com/thread/60684?ContentTypeID=1</link><pubDate>Thu, 25 Aug 2016 12:32:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0d81d573-5327-4cd0-a45d-c4190d782075</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I should have been able to solve this case earlier but I missed to see one errata.
&lt;a href="http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.nrf52832.Rev1.errata%2Fanomaly_832_89.html&amp;amp;cp=2_2_1_0_1_26"&gt;Errata 89&lt;/a&gt; tells that this is an anomaly inside the chip. And the work around is given. Just add below code when you want to disable TWI&lt;/p&gt;
&lt;p&gt;For TWI0 for number 89 anomaly on nRF52&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;*(uint32_t *)(0x40003000 + 0xFFC ) = 0;
*(uint32_t *)(0x40003000 + 0xFFC ) = 1;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For TWI1 for number 89 anomaly on nRF52&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;*(uint32_t *)(0x40004000 + 0xFFC ) = 0;
*(uint32_t *)(0x40004000 + 0xFFC ) = 1;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I tested this personally and it works.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 TWI excess current consumption</title><link>https://devzone.nordicsemi.com/thread/60683?ContentTypeID=1</link><pubDate>Thu, 25 Aug 2016 11:11:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:85ad7e3d-9be3-4cbc-aa22-7b5cd9becf41</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;please attach your project.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 TWI excess current consumption</title><link>https://devzone.nordicsemi.com/thread/60682?ContentTypeID=1</link><pubDate>Thu, 25 Aug 2016 11:09:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ac04fba3-ab23-42b5-86eb-f6cb4d0dd14d</guid><dc:creator>cedric</dc:creator><description>&lt;p&gt;n52832-QFAAB0-1610A1&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 TWI excess current consumption</title><link>https://devzone.nordicsemi.com/thread/60681?ContentTypeID=1</link><pubDate>Thu, 25 Aug 2016 11:03:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:53ef100f-01e8-4ca5-b637-24e46328f0ac</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I am not able to reproduce it in nRF52DK,
Can you please attach your project and tell me exactly which version of nRF52 you are using. Give me the laser markings on the chip that says NRF52822XXXXXX, where X changes with chip versions&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 TWI excess current consumption</title><link>https://devzone.nordicsemi.com/thread/60680?ContentTypeID=1</link><pubDate>Thu, 25 Aug 2016 07:29:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6dee794f-47d8-4741-8f54-10347e60c9b4</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;sorry, missed this post , i will check you code now and report you back soon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 TWI excess current consumption</title><link>https://devzone.nordicsemi.com/thread/60677?ContentTypeID=1</link><pubDate>Wed, 24 Aug 2016 16:59:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:57d4f66f-b218-4408-b67c-7492791e2292</guid><dc:creator>cedric</dc:creator><description>&lt;p&gt;does someone has a solution? Is the chip bugged?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 TWI excess current consumption</title><link>https://devzone.nordicsemi.com/thread/60679?ContentTypeID=1</link><pubDate>Tue, 23 Aug 2016 08:26:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2a933703-46bd-4df8-b2d4-ac337cc2f52c</guid><dc:creator>cedric</dc:creator><description>&lt;p&gt;nrf52 0.9.2, the softdevice is S132&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 TWI excess current consumption</title><link>https://devzone.nordicsemi.com/thread/60678?ContentTypeID=1</link><pubDate>Tue, 23 Aug 2016 07:56:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ac1b89fb-c5e2-4fdb-b24d-46d6b5ea48bc</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;strange .... which sdk did you use? i can try it out and see on PCA10040 DK&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>