<?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>Regarding the I2C (TWI) clock in nRF5340.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/116325/regarding-the-i2c-twi-clock-in-nrf5340</link><description>Hello, 
 
 I am using the following device and development kit: 
 
 Device: NORA-B106-00B (nRF5340) 
 nRF Connect SDK: 2.0.2 
 
 
 Currently, to ensure that the connected device receives the correct result of the command in an I2C operation, it requires</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 27 Mar 2025 00:42:02 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/116325/regarding-the-i2c-twi-clock-in-nrf5340" /><item><title>RE: Regarding the I2C (TWI) clock in nRF5340.</title><link>https://devzone.nordicsemi.com/thread/529174?ContentTypeID=1</link><pubDate>Thu, 27 Mar 2025 00:42:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:20c5035a-a1e2-4023-b858-2d5aa86af10c</guid><dc:creator>sst_S.Sakamoto</dc:creator><description>&lt;p class="" data-start="22" data-end="34"&gt;Hello Simon,&lt;/p&gt;
&lt;p class="" data-start="22" data-end="34"&gt;&lt;/p&gt;
&lt;p class="" data-start="22" data-end="34"&gt;Sorry for the late reply, and thank you for all your suggestions.&lt;br data-start="101" data-end="104" /&gt; After careful consideration, we have decided not to use I2C communication for writing data to the slave in this particular setup. Instead, we will write the data from a dedicated software application, thereby avoiding potential clock-stretching issues. If we need to rely on I2C in future scenarios, we will certainly keep in mind your advice about adding sufficient wait times. Thank you again for your support.&lt;/p&gt;
&lt;p class="" data-start="22" data-end="34"&gt;&lt;/p&gt;
&lt;p class="" data-start="22" data-end="34"&gt;Best regards,&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Regarding the I2C (TWI) clock in nRF5340.</title><link>https://devzone.nordicsemi.com/thread/511429?ContentTypeID=1</link><pubDate>Thu, 21 Nov 2024 08:25:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:49463558-14ed-49a1-b9ff-0adcff05b4bb</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Correct, if you set a wait time after sending data so that the slave can respond, the master will never have to stretch the clock, and then this errata won&amp;#39;t come into the picture here.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Regarding the I2C (TWI) clock in nRF5340.</title><link>https://devzone.nordicsemi.com/thread/511223?ContentTypeID=1</link><pubDate>Wed, 20 Nov 2024 08:02:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3f53da6a-4f4c-49ae-8faa-a7bc5d4e47ca</guid><dc:creator>sst_S.Sakamoto</dc:creator><description>&lt;p&gt;&lt;span&gt;Hello Simon,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Thank you for providing the sample.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I think the problem is that after the slave receives data via I2C and performs clock stretching (66 &amp;mu;s), the first clock pulse from the master becomes longer or shorter, which can cause an error when the slave responds.&lt;/p&gt;
&lt;p&gt;&lt;span&gt;This is also described in the errata document at the URL below.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;a href="https://docs.nordicsemi.com/bundle/errata_nRF5340_EngA/page/ERR/nRF5340/EngineeringA/latest/anomaly_340_37.html#anomaly_340_37" rel="noopener noreferrer" target="_blank"&gt;https://docs.nordicsemi.com/bundle/errata_nRF5340_EngA/page/ERR/nRF5340/EngineeringA/latest/anomaly_340_37.html#anomaly_340_37&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Therefore, by setting a wait time between when the master sends data and when the slave responds, I hope that a normal clock pulse will be generated from the master when the slave responds.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Is the above thinking correct?&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Regarding the I2C (TWI) clock in nRF5340.</title><link>https://devzone.nordicsemi.com/thread/511116?ContentTypeID=1</link><pubDate>Tue, 19 Nov 2024 14:09:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:776b5686-2f4c-4eb6-8163-a2abde6b9306</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;I think the i2c_write() from the Zephyr API is the way to go here. Adding a wait function should be fine AFAIK, what exactly are you having trouble with? We have some TWIM/TWIS samples available here that should be usable:&amp;nbsp;&lt;a href="https://github.com/zephyrproject-rtos/hal_nordic/tree/master/nrfx/samples/src/nrfx_twim_twis"&gt;https://github.com/zephyrproject-rtos/hal_nordic/tree/master/nrfx/samples/src/nrfx_twim_twis&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Regarding the I2C (TWI) clock in nRF5340.</title><link>https://devzone.nordicsemi.com/thread/511004?ContentTypeID=1</link><pubDate>Tue, 19 Nov 2024 06:57:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c4be254e-a494-47c8-8f0b-825cd47c8e14</guid><dc:creator>sst_S.Sakamoto</dc:creator><description>&lt;p&gt;&lt;span&gt;Hello Simon,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;As you noted, the nRF5340 is the master device between the two.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span class="jCAhz ChMk0b"&gt;&lt;span class="ryNqvb"&gt;Currently, I am using the i2c_write() function of Zephyr API to send several bytes of data to the slave device, but is it possible to add a wait function that waits for a response from the slave side after each byte is sent?&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If you have any example programs, I would appreciate it if you could show me.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span class="jCAhz ChMk0b"&gt;&lt;span class="ryNqvb"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span class="jCAhz ChMk0b"&gt;&lt;span class="ryNqvb"&gt;Best regards,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Regarding the I2C (TWI) clock in nRF5340.</title><link>https://devzone.nordicsemi.com/thread/510830?ContentTypeID=1</link><pubDate>Mon, 18 Nov 2024 07:37:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:884233e6-68a2-4a39-a353-97fc5759f79a</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;I assume here that the nRF5340 is the master device between the two, and if so I&amp;#39;d say you should add the wait function here. The wait function should be added after sending a TWI event where you wait for a &amp;quot;transmit complete&amp;quot; call or similar before you send a new message/event.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Regarding the I2C (TWI) clock in nRF5340.</title><link>https://devzone.nordicsemi.com/thread/510647?ContentTypeID=1</link><pubDate>Fri, 15 Nov 2024 10:24:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2475dcf7-d265-40d3-8763-0e796db24393</guid><dc:creator>sst_S.Sakamoto</dc:creator><description>&lt;p&gt;Hello Simon,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank you for your reply.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The following devices are connected using I2C:&lt;br /&gt; BQ27Z561-R2 (&lt;span&gt;Made by &lt;/span&gt;Texas Instruments Inc.)&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;span&gt;If I2C communication fails, a NAK will be returned during data transfer.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I would like to confirm, which one should I add the wait function to, nRF5340 or BQ27Z561-R2?&lt;br /&gt;If I need to add a wait function to the nRF5340, could you please tell me how to do it?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Regarding the I2C (TWI) clock in nRF5340.</title><link>https://devzone.nordicsemi.com/thread/510306?ContentTypeID=1</link><pubDate>Wed, 13 Nov 2024 13:37:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:702b3ba4-7cc7-45d3-94a5-c33a3fb35cf5</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;1. What is the connected device that requires this wait period of 66µs here? Can you share some details on what exactly happens when the I2C communication fails here. Do you see jumbled data, no data at all, or what? My initial thought is that you should add a wait function here so you&amp;#39;re sure the device is ready to receive more data and not interrupt the 66µs periods. The failures is a good indication that it&amp;#39;s not okay to shorten these.&lt;/p&gt;
&lt;p&gt;2. It should not be a problem using lower frequencies AFAIK. It&amp;#39;s mainly that the Zephyr API isn&amp;#39;t made for other frequencies.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>