<?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>No clock or data on I2C lines.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/101560/no-clock-or-data-on-i2c-lines</link><description>I&amp;#39;m using the Rigado BMD-350 evaluation board (nRF52832) to develop a new application. The application attempts to read an I2C accelerometer (MMA8451Q - I&amp;#39;ve used this accelerometer in dozens of projects). 
 I2C appears to initialize correctly as I see</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 08 Jul 2023 22:47:44 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/101560/no-clock-or-data-on-i2c-lines" /><item><title>RE: No clock or data on I2C lines.</title><link>https://devzone.nordicsemi.com/thread/435357?ContentTypeID=1</link><pubDate>Sat, 08 Jul 2023 22:47:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5d71028d-edb5-452e-bf21-87c0a58f5ea2</guid><dc:creator>jbmillard</dc:creator><description>&lt;p&gt;I finally found the problem. &amp;nbsp;The frequency was not set correctly. &amp;nbsp;After setting that, everything worked.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: No clock or data on I2C lines.</title><link>https://devzone.nordicsemi.com/thread/435246?ContentTypeID=1</link><pubDate>Fri, 07 Jul 2023 12:47:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6d441b17-36f4-4c07-8977-95b79f4a50c7</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Then it is hard for me to understand why there is no clock on the SCL. I know that this sensor has been used with other variants of nRF52 but not with BMD module. If you have not explicitly started the external crystal HFCLK, then the internal clock should have been used automatically. So I do not understand why there is no activity on your SCL.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I cannot test it at my end as I do not have BMD or the sensor available, but I know that this sensor works fine with nRF52 DK. Just make sure that you start the XTAL HFCLK and then if that does not help then maybe try reaching out to the module support forums.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: No clock or data on I2C lines.</title><link>https://devzone.nordicsemi.com/thread/435070?ContentTypeID=1</link><pubDate>Thu, 06 Jul 2023 16:55:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:28b11077-708e-424d-b48b-3d748c163155</guid><dc:creator>jbmillard</dc:creator><description>&lt;p&gt;I found&amp;nbsp;&amp;nbsp;nrf_gpio_pin_pull_get(), so I checked and logged the SDA and SCL pin pull configuration just before initializing the I2C module and it is set to zero:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;lt;debug&amp;gt; app: i2c master init, SCL pull = 0
&amp;lt;debug&amp;gt; app: i2c master init, SDA pull = 0&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;which is&amp;nbsp;NRF_GPIO_PIN_NOPULL.&lt;/p&gt;
&lt;p&gt;I also tried another evaluation kit. &amp;nbsp;Same issue.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: No clock or data on I2C lines.</title><link>https://devzone.nordicsemi.com/thread/435063?ContentTypeID=1</link><pubDate>Thu, 06 Jul 2023 16:11:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ad95208b-7d0a-4070-9281-6b282ea59647</guid><dc:creator>jbmillard</dc:creator><description>&lt;p&gt;I haven&amp;#39;t done any configuration of the pins using gpio functions. &amp;nbsp;All configuration is done by the TWI module.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not clear on how I would configure for no pull without configuring as an input or output. &amp;nbsp;How is that done?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: No clock or data on I2C lines.</title><link>https://devzone.nordicsemi.com/thread/435058?ContentTypeID=1</link><pubDate>Thu, 06 Jul 2023 16:00:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5b65989a-d98c-4dce-b3f8-15ac324156f9</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Check if you have some pull configured via GPIO on those twi lines before you connected to TWI.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Set configuration for those GPIO pins to input no pull&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: No clock or data on I2C lines.</title><link>https://devzone.nordicsemi.com/thread/435054?ContentTypeID=1</link><pubDate>Thu, 06 Jul 2023 15:41:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1b666602-c8df-4530-aca9-3cc229bf9498</guid><dc:creator>jbmillard</dc:creator><description>&lt;p&gt;I increased debugging and got the following messages:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;lt;info&amp;gt; TWI: Function: nrfx_twi_init, error code: NRF_SUCCESS.
&amp;lt;info&amp;gt; TWI: Instance enabled: 0.
&amp;lt;info&amp;gt; app: In mma8451q_initialize().

&amp;lt;info&amp;gt; TWI: Transfer type: XFER_TX.
&amp;lt;info&amp;gt; TWI: Transfer buffers length: primary: 1, secondary: 0.
&amp;lt;debug&amp;gt; TWI: Primary buffer data:
&amp;lt;debug&amp;gt; TWI:  0D                     |.       
&amp;lt;debug&amp;gt; TWI: Secondary buffer data:
&amp;lt;debug&amp;gt; TWI:                         |        
&amp;lt;warning&amp;gt; TWI: Function: nrfx_twi_xfer, error code: NRF_ERROR_INTERNAL.
&amp;lt;debug&amp;gt; app: nrf_drv_twi_tx() returned 3

&amp;lt;debug&amp;gt; app: MMA8451Q: Error reading WHO_AM_I, err_code = 3

&amp;lt;info&amp;gt; TWI: Instance disabled: 0.
&amp;lt;info&amp;gt; TWI: Instance uninitialized: 0.&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;0x0D is the address of the WHO_AM_I register on the MMA8451Q. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;I also determined that the error is coming from line 618 in nrfx_twi.c. &amp;nbsp;This line is a call to&amp;nbsp;twi_tx_start_transfer() in the function&amp;nbsp;twi_xfer().&lt;/p&gt;
&lt;p&gt;The function&amp;nbsp;twi_tx_start_transfer() does return NRF_ERROR_INTERNAL in what looks like a HW timeout.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: No clock or data on I2C lines.</title><link>https://devzone.nordicsemi.com/thread/435018?ContentTypeID=1</link><pubDate>Thu, 06 Jul 2023 13:55:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c34988d3-dd80-40ca-a05e-12d8d0b6f7f6</guid><dc:creator>jbmillard</dc:creator><description>&lt;p&gt;Initialization of the master is in the first post.&lt;/p&gt;
&lt;p&gt;The hardware I&amp;#39;m using is a Rigado BMD-300 Series Evaluation kit. &amp;nbsp;I don&amp;#39;t know if the complete schematic is available or not - I&amp;#39;ve looked for it and haven&amp;#39;t found it. &amp;nbsp;Here&amp;#39;s a link to the User Guide that has snippets of the schematic:&amp;nbsp;&lt;a title="BMD-300 Evaluation Kit User Guide" href="https://www.mouser.com/pdfdocs/BMD-300-Series-EVAL-UG-v12.pdf"&gt;https://www.mouser.com/pdfdocs/BMD-300-Series-EVAL-UG-v12.pdf&lt;/a&gt;. &amp;nbsp;My particular board has a BMD-350 (nRF52832) on it.&lt;/p&gt;
&lt;p&gt;Could the problem be clocking to the TWI module? &amp;nbsp;If so, where would that be configured? &amp;nbsp;Is there something in gtk_config.h that I could have missed?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: No clock or data on I2C lines.</title><link>https://devzone.nordicsemi.com/thread/435012?ContentTypeID=1</link><pubDate>Thu, 06 Jul 2023 13:47:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cfc42415-d705-4c8e-b8da-7fcffb844d18</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I do not see anything wrong with the code snippet you posted. It should work fine in the blocking mode. I do not see the initialization of&amp;nbsp;m_i2c_twi_master but I assume you did the correctly as well.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;We have seen couple of time error 3 returned with TWI functions when there were issues in the hardware. Can you please post your schematics here so that I can have it reviewed by one of our hardware experts?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: No clock or data on I2C lines.</title><link>https://devzone.nordicsemi.com/thread/434998?ContentTypeID=1</link><pubDate>Thu, 06 Jul 2023 13:13:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b6f5086d-7a6a-4c6b-a19b-b549cd735e85</guid><dc:creator>jbmillard</dc:creator><description>&lt;p&gt;I&amp;#39;m using SDK 17.1.0. &amp;nbsp;I said I had a breakpoint on the function nrf_drv_twi_tx() and the function IS called. &amp;nbsp;It returns 3.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m atttempting to read the WHO_AM_I register from the accelerometer. &amp;nbsp;It&amp;#39;s a constant register read by a writing a byte and then reading a byte. &amp;nbsp;If the accelerometer was bad, I would still expect to see the start condition and device address on the bus. &amp;nbsp;I don&amp;#39;t see that. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Where the function is called (the accelerometer driver calls this function):&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;ret_code_t i2c_master_write_read(uint8_t addr, uint8_t* w_buffer, int w_n, uint8_t* r_buffer, int r_n)
{
	ret_code_t ret = NRF_SUCCESS;

	if (w_n &amp;gt; 0)
	{
		ret = nrf_drv_twi_tx(&amp;amp;m_i2c_twi_master, addr, w_buffer, w_n, r_n &amp;gt; 0);
		NRF_LOG_DEBUG(&amp;quot;nrf_drv_twi_tx() returned %d\n&amp;quot;, ret);
	}

	if ((r_n &amp;gt; 0) &amp;amp;&amp;amp; (NRF_SUCCESS == ret))
	{
		ret = nrf_drv_twi_rx(&amp;amp;m_i2c_twi_master, addr, r_buffer, r_n);
		NRF_LOG_DEBUG(&amp;quot;nrf_drv_twi_rx() returned %d\n&amp;quot;, ret);
	}

	return ret;
}

&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The output on the debug console says:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;lt;debug&amp;gt; app: nrf_drv_twi_tx() returned 3&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m restricted somewhat on what I can post.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: No clock or data on I2C lines.</title><link>https://devzone.nordicsemi.com/thread/434976?ContentTypeID=1</link><pubDate>Thu, 06 Jul 2023 12:40:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:31459dce-2608-419d-9d0b-28fa2bd52eb1</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hi James,&lt;/p&gt;
[quote user=""]nrf_drv_twi_tx() returns error code 3.[/quote][quote user=""]I have put breakpoints the nrf_drv_twi_txI() function and it does get called.[/quote]
&lt;p&gt;It is confusing with these two statements. The first one says that you are getting error 3 (NRF_ERROR_INTERNAL).&amp;nbsp;&lt;br /&gt;Which SDK version are you using? I haven&amp;#39;t seen this error being used in TWI handling in the lastest SDK.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In the other behavior, you said that the breakpoint for nrf_drv_twi_tx is not hit, that explains why there is no clock on the logic analyzer. Build your project with debug symbols enabled (debug mode and not in release mode) and make sure that the if condition is satisfied and the TX function called. If you still do not see the clock on the pins then we can proceed to investigate further by me trying to reproduce it on nRF52832 DK.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>