<?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>NRF51 twi scanner: getting registers of i2c devices on bus</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/50620/nrf51-twi-scanner-getting-registers-of-i2c-devices-on-bus</link><description>I have a small collection of i2c devices on the bus that can be jumpered in (sda/scl disconnected). I am currently using SDK v10 and Keil v4. 
 I wrote this code to namely sweep through all addresses and read out the first few registers of each. But I</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 06 Aug 2019 03:52:09 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/50620/nrf51-twi-scanner-getting-registers-of-i2c-devices-on-bus" /><item><title>RE: NRF51 twi scanner: getting registers of i2c devices on bus</title><link>https://devzone.nordicsemi.com/thread/202501?ContentTypeID=1</link><pubDate>Tue, 06 Aug 2019 03:52:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bb04c922-0756-4b1a-8ad7-d368bd9112c5</guid><dc:creator>myNrfDoesntWork</dc:creator><description>&lt;p&gt;This issue has been resolved, thank you!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF51 twi scanner: getting registers of i2c devices on bus</title><link>https://devzone.nordicsemi.com/thread/202431?ContentTypeID=1</link><pubDate>Mon, 05 Aug 2019 12:24:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9cd32db2-1ba8-4b17-ad8e-9196723d01da</guid><dc:creator>myNrfDoesntWork</dc:creator><description>&lt;p&gt;Hi I do not get any error codes that are not 0.&lt;/p&gt;
&lt;p&gt;When I try running the unmodified TWI_Scanner example from SDK v12 with&amp;nbsp;&lt;span&gt;two i2c items on the NRF51 DK sda/scl lines (one at address 0x40, and one at 0x38)&lt;/span&gt;&amp;nbsp;the scanning gets stuck on address 0x1.&lt;/p&gt;
&lt;p&gt;If I plug in any single wire (SDA/SCL) into either P0.07 or P0.30, I get:&lt;/p&gt;
&lt;p&gt;APP:INFO:TWI scanner.&lt;br /&gt;APP:INFO:scanning: 0x1.&lt;/p&gt;
&lt;p&gt;The 0x1 line doesn&amp;#39;t print if I don&amp;#39;t force a flush immediately after printing that line. I also tried using other pins and also different ways of powering the i2c items.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I debugged&amp;nbsp;the unmodified twi_scanner code&amp;nbsp;and it got stuck on a while loop in nrf_drv_twi.c (starting on line 615). I then traced the while loop calls to &amp;#39;return true&amp;#39; being returned by the if statement on line 518 of the same nrf_drv_twi.c file.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;@Edvin I will be getting a logic analyzer to do a further trace of the original twi_scanner code, but do you have any suggestions as to why the code I wrote does not read the registers of the i2c devices on the bus? I am still confused as to why it only returns error codes of 0 and readResults of 0. Thanks!&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF51 twi scanner: getting registers of i2c devices on bus</title><link>https://devzone.nordicsemi.com/thread/202418?ContentTypeID=1</link><pubDate>Mon, 05 Aug 2019 12:00:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a1d72556-0b89-4441-b8d0-5188a420a4bf</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;So you do not have any error codes (rt) != 0?&lt;/p&gt;
&lt;p&gt;Have you tried the unmodified example, to see if that works? I see that there aren&amp;#39;t any twi_scanner examples in SDK10, but maybe you can test the one in SDK12.3.0 just to see that all the HW is working as expected?&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></channel></rss>