<?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>NRF_ERROR_BUSY at TWI embedded code</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/88567/nrf_error_busy-at-twi-embedded-code</link><description>Hello, 
 Now I am making an original ISP4520(nRF52832) application using ISP4520-examples . 
 I&amp;#39;m trying to embed LM75B sample code from nRF5_SDK_16.0.0_98a08e2 to Class_A.emProject. 
 I paste my source code below. To find out where the error occurred</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 03 Jun 2022 12:46:34 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/88567/nrf_error_busy-at-twi-embedded-code" /><item><title>RE: NRF_ERROR_BUSY at TWI embedded code</title><link>https://devzone.nordicsemi.com/thread/370885?ContentTypeID=1</link><pubDate>Fri, 03 Jun 2022 12:46:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:87fdf151-22f2-4153-b8cb-23b1a5d22fa2</guid><dc:creator>tyro01</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;J&amp;oslash;rgen,&lt;/p&gt;
&lt;p&gt;Thanks for your advice,&amp;nbsp;I have verified that the program works correctly with the following modifications.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/* TWI instance ID. */
#define TWI_INSTANCE_ID     1&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;As a beginner, I had read warnings on the blogs of my great predecessors to beware of duplicate instance IDs.&lt;/p&gt;
&lt;p&gt;However, I had let my guard down, thinking that it would not matter to me, as I do not set up complex programs.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;lt;info&amp;gt; app: LoRaWan Class A example started.
&amp;lt;info&amp;gt; app: TWI TX Done.
&amp;lt;info&amp;gt; app: TWI TX Done.
&amp;lt;info&amp;gt; lmh: DevEui=70-B3-D5-7E-xx-xx-xx-xx
&amp;lt;info&amp;gt; lmh: JoinEui=00-00-00-00-00-00-00-00
&amp;lt;info&amp;gt; lmh: Send OTAA Join Request, status: OK
&amp;lt;info&amp;gt; app: TWI RX Done.
&amp;lt;info&amp;gt; app: Temperature: 29 Celsius degrees.
&amp;lt;info&amp;gt; lmh: Send OTAA Join Request, status: OK
&amp;lt;info&amp;gt; app: TWI RX Done.
&amp;lt;info&amp;gt; app: Temperature: 29 Celsius degrees.
&amp;lt;info&amp;gt; lmh: Send OTAA Join Request, status: Busy
&amp;lt;info&amp;gt; app: TWI RX Done.
&amp;lt;info&amp;gt; app: Temperature: 29 Celsius degrees.
&amp;lt;info&amp;gt; lmh: Send OTAA Join Request, status: OK&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The more complex the program, the greater the opportunity to copy-paste sample code, but I would consider the possibility that the sample program reserves the ID.&lt;/p&gt;
&lt;p&gt;Thank you for your kind advice.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;tyro&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF_ERROR_BUSY at TWI embedded code</title><link>https://devzone.nordicsemi.com/thread/370864?ContentTypeID=1</link><pubDate>Fri, 03 Jun 2022 11:48:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:76edd300-b6a2-4227-86bd-a1b211142d1a</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;One serial instance can only be used either as SPI or TWI peripheral at the same time. The GitHub library you linked are using &lt;a href="https://github.com/insightsip/ISP4520-examples/blob/master/src/lora/boards/board.h#L78"&gt;SPI_INSTANCE 0&lt;/a&gt;&amp;nbsp;in the &lt;a href="https://github.com/insightsip/ISP4520-examples/blob/master/src/lora/boards/ISP4520B-AS/spi-board.c#L53"&gt;SPI init functions&lt;/a&gt;, while you are using the same instance 0 for your TWI_INSTANCE in above code:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define TWI_INSTANCE_ID     0

...

/* TWI instance. */
static const nrf_drv_twi_t m_twi = NRF_DRV_TWI_INSTANCE(TWI_INSTANCE_ID);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;You need to select a different instance in one of the codes, or make sure that SPI and TWI are not initialized at the same time.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>