<?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 DK &amp;amp; PCA9685 (TWI bug)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/76459/nrf52-dk-pca9685-twi-bug</link><description>Hi,everybody! 
 I started to connect the PCA9685 to the nRF52 DK and ran into a strange problem. When initializing the PWM module, it does not work.Initialization requires the setting of registers to certain values, which is nothing complicated. 
 The</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 29 Jun 2021 07:47:33 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/76459/nrf52-dk-pca9685-twi-bug" /><item><title>RE: nRF52 DK &amp; PCA9685 (TWI bug)</title><link>https://devzone.nordicsemi.com/thread/317613?ContentTypeID=1</link><pubDate>Tue, 29 Jun 2021 07:47:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f3f470de-ab58-48b5-aea9-b37c0d7e60ed</guid><dc:creator>Nur2705</dc:creator><description>&lt;p&gt;Hi, Jared&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I found the problem&lt;br /&gt;It was not in TWI, but in the fact that my functions were losing their data.&lt;br /&gt;All the code I wrote didn&amp;#39;t work as intended. I suspect the problem is in the compiler. Should I ask a new question or continue the discussion here?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52 DK &amp; PCA9685 (TWI bug)</title><link>https://devzone.nordicsemi.com/thread/316129?ContentTypeID=1</link><pubDate>Sat, 19 Jun 2021 13:56:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dc1e7fdf-a089-4d55-87b5-7b21a824eec3</guid><dc:creator>Nur2705</dc:creator><description>&lt;p&gt;Earlier, I collected code with a flag, but it periodically did not exit the loop.&lt;/p&gt;
&lt;p&gt;Maybe I had a mistake there. I will try to collect again next week using a so far loop.&lt;br /&gt;Thank you for your help.&lt;/p&gt;
&lt;p&gt;If necessary, I will inform you about the results.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52 DK &amp; PCA9685 (TWI bug)</title><link>https://devzone.nordicsemi.com/thread/316095?ContentTypeID=1</link><pubDate>Fri, 18 Jun 2021 13:41:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7ba9180c-2701-4e17-a1a2-bb83e3b634d1</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Ok, I didn&amp;#39;t see this part in the code that you shared earlier. Anyways, what do you observe now? Any difference? Is the flag set? What does the function call return?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52 DK &amp; PCA9685 (TWI bug)</title><link>https://devzone.nordicsemi.com/thread/316082?ContentTypeID=1</link><pubDate>Fri, 18 Jun 2021 13:11:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:856d0f45-f5e1-4f13-8d71-8ad1cb0a7634</guid><dc:creator>Nur2705</dc:creator><description>&lt;p&gt;I checked the flag immediately after transmission&lt;pre class="ui-code" data-mode="text"&gt;    m_xfer_done = false;
    nrf_drv_twi_tx(&amp;amp;m_twi,PCA9685_ADDRESS,buff, sizeof(buff), false);
    while (m_xfer_done == false); &lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52 DK &amp; PCA9685 (TWI bug)</title><link>https://devzone.nordicsemi.com/thread/316080?ContentTypeID=1</link><pubDate>Fri, 18 Jun 2021 13:07:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4b0e1e1e-e176-49d4-8289-27059a7ed7b5</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Where do you check the flag before a new transfer is performed?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52 DK &amp; PCA9685 (TWI bug)</title><link>https://devzone.nordicsemi.com/thread/316077?ContentTypeID=1</link><pubDate>Fri, 18 Jun 2021 12:51:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:de23f358-860d-4c81-840a-790ed37d8be5</guid><dc:creator>Nur2705</dc:creator><description>&lt;p&gt;Hi, Jared&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I also used a flag, but I am afraid of the possibility that the callback may not work.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52 DK &amp; PCA9685 (TWI bug)</title><link>https://devzone.nordicsemi.com/thread/316073?ContentTypeID=1</link><pubDate>Fri, 18 Jun 2021 12:42:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:13538660-908f-4453-8d44-801c098c5b42</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Could describe exactly what happens if you omit the delay and how it&amp;#39;s not what you expected it to be?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It seems like you&amp;#39;re not checking the return value from the nrf_drv_twi functions, which you should so we could understand what exactly the issue is.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;For example:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;    err_code = nrf_drv_twi_tx(&amp;amp;m_twi, slave_addr, reg, 1, false);
    APP_ERROR_CHECK(err_code);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;My guess is that driver returns&amp;nbsp;NRF_ERROR_BUSY without the delays, as you&amp;#39;re not using any flag to signalize when the driver is finished with a transfer. I would suggest that you take a look at your &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/twi_sensor_example.html?cp=8_1_4_6_43"&gt;twi_sensor &lt;/a&gt;example in the SDK, it uses a flag to signalize that the driver is ready for a new transfer.&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;best regards&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;Jared&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>