<?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>TWI hanlder is not called</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/43532/twi-hanlder-is-not-called</link><description>I use Twi for reading data from the lsm sensors. I want to use a twi_handler in which I will set the xfer_done_flag on the true and go off into a sleep mode until the flag is set to a false so that the sensors can successfully read the data. But the problem</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 16 Feb 2019 22:48:23 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/43532/twi-hanlder-is-not-called" /><item><title>RE: TWI hanlder is not called</title><link>https://devzone.nordicsemi.com/thread/171516?ContentTypeID=1</link><pubDate>Sat, 16 Feb 2019 22:48:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5d4c6eb6-58e5-4831-a5b1-833e2c76fe4c</guid><dc:creator>twihtronics</dc:creator><description>&lt;p&gt;one more comment I forgot to add; nfc pins have added capacitance so the frequency at which those pins can operate at will be much lower than normal gpio. depending on your slaves capability for frequency you may not be able to operate i2c over those pins.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI hanlder is not called</title><link>https://devzone.nordicsemi.com/thread/171173?ContentTypeID=1</link><pubDate>Thu, 14 Feb 2019 14:09:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cac65af7-df16-4d40-9f40-9f5f5c18d24b</guid><dc:creator>HTRRA</dc:creator><description>&lt;p&gt;Thank you very much&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI hanlder is not called</title><link>https://devzone.nordicsemi.com/thread/171170?ContentTypeID=1</link><pubDate>Thu, 14 Feb 2019 13:57:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:615a3e54-ee0b-4611-91f3-2a66ddccb3ee</guid><dc:creator>twihtronics</dc:creator><description>&lt;p&gt;same type of thing with all of the multi function pins like P21/Reset. You have to use a macro to allow GPIO usage.&lt;br /&gt;&lt;br /&gt;Also please note since this is a UICR setting you will need to erase the entire chip first then program with your updated code in order for the setting to take place.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI hanlder is not called</title><link>https://devzone.nordicsemi.com/thread/171167?ContentTypeID=1</link><pubDate>Thu, 14 Feb 2019 13:54:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a5fa8a4f-365c-47e5-bc82-071c804fe481</guid><dc:creator>twihtronics</dc:creator><description>&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1550152038440v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Pin 9 and 10 are also NFC1 and NFC2.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You have to disable the NFC functionality in order to use pins 9 &amp;amp; 10.&lt;/p&gt;
&lt;p&gt;I have used the same pins in a similar project using the BT832F&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1550152146057v2.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;It is a setting in UICR.&lt;/p&gt;
&lt;p&gt;You can enable/disable with the&amp;nbsp;&lt;span&gt;CONFIG_NFCT_PINS_AS_GPIOS macro. If this is defined then pins 9 and 10 are used as GPIO.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI hanlder is not called</title><link>https://devzone.nordicsemi.com/thread/171161?ContentTypeID=1</link><pubDate>Thu, 14 Feb 2019 13:41:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9cde1ce0-9518-423f-a7f9-a3d2da622114</guid><dc:creator>HTRRA</dc:creator><description>&lt;p&gt;my scl and sda were connected to p09 and p010. i have changed them to p07 and p08, and everything is working fine. Do you have any idea why the p09 and p010 pins are caused this error?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI hanlder is not called</title><link>https://devzone.nordicsemi.com/thread/170644?ContentTypeID=1</link><pubDate>Tue, 12 Feb 2019 13:42:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c6d4110f-6227-4892-81a0-b000e34cc98e</guid><dc:creator>twihtronics</dc:creator><description>&lt;p&gt;understood but I believe you are running async so without a flag to stop the program from accessing the bus you will most likely always get a error_busy fault. Your handler should clear the flag and application should set the flag.&lt;/p&gt;
&lt;p&gt;reset flag&lt;/p&gt;
&lt;p&gt;call twi_tx&lt;/p&gt;
&lt;p&gt;while((flag) == 0); // wait it handler to clear flag&lt;/p&gt;
&lt;p&gt;reset flag&lt;/p&gt;
&lt;p&gt;call twi_rx&lt;/p&gt;
&lt;p&gt;Note reset, set, clear and be whatever 0 or 1 value logic you pick.&lt;/p&gt;
&lt;p&gt;This is why I think when you have null as the handler it works. Using null make the twi call do a busy wait while providing the handler allows the program to continue executing.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI hanlder is not called</title><link>https://devzone.nordicsemi.com/thread/170613?ContentTypeID=1</link><pubDate>Tue, 12 Feb 2019 12:24:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:778adf43-9131-4467-8ae2-610b2a5a66b8</guid><dc:creator>HTRRA</dc:creator><description>&lt;p&gt;my problem is that the twi_handler function is not called after the twi call. I wanted to use Twi_Hanlder to set flags.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI hanlder is not called</title><link>https://devzone.nordicsemi.com/thread/170376?ContentTypeID=1</link><pubDate>Mon, 11 Feb 2019 13:35:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8f4cb049-7897-4b35-9506-f19e60395e67</guid><dc:creator>twihtronics</dc:creator><description>&lt;p&gt;when you have a handler i believe you are running in async mode vs polling when no handler (null) is used. If this is correct then you would need to wait for the first command to finish before sending the second command. If not then you will be accessing the bus before the bus is clear or released. You can use m_xfer_done as a flag to resolve the issue.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI hanlder is not called</title><link>https://devzone.nordicsemi.com/thread/170272?ContentTypeID=1</link><pubDate>Mon, 11 Feb 2019 08:19:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:55a333b0-0ae4-4156-947c-9e4ce09083cd</guid><dc:creator>HTRRA</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define LSM330D_WHO_AM_I_G 0x0F

bool LSM330DLC_init(uint8_t address_g, uint8_t address_a) {
  //whoami_read_gyro
  uint8_t whoami = LSM330D_WHO_AM_I_G;
  uint8_t resultsWhoAmI;

  nrf_drv_twi_tx(&amp;amp;m_twi, address_g, &amp;amp;whoami, 1, true);
  nrf_drv_twi_rx(&amp;amp;m_twi, address_g, &amp;amp;resultsWhoAmI, 1);

  if (resultsWhoAmI != LSM330D_WHOAMI_G_VAL)
    return false;

  return true;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;When reading from the LSM without using TWI_HANDLER, &amp;quot; NULL&amp;quot; in the nrf_drv_twi_init&lt;br /&gt;function:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;
ret_code_t ret = nrf_drv_twi_init(&amp;amp;m_twi, &amp;amp;twi_lsm330dlc_config, NULL, NULL);
if(ret != NRF_SUCCESS) SEGGER_RTT_TerminalOut(0, &amp;quot;ERROR&amp;quot;);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;no errors are returned. The function returns NRF_SUСCESS.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;But when i use TWI_HANDLER, returns&amp;nbsp;NRF_ERROR_BUSY, in second twi call&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;

ret_code_t ret = nrf_drv_twi_init(&amp;amp;m_twi, &amp;amp;twi_lsm330dlc_config, twi_handler, NULL);
if(ret != NRF_SUCCESS) SEGGER_RTT_TerminalOut(0, &amp;quot;ERROR&amp;quot;);&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI hanlder is not called</title><link>https://devzone.nordicsemi.com/thread/170249?ContentTypeID=1</link><pubDate>Mon, 11 Feb 2019 00:50:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5a46936b-e482-489e-86e6-583500f6c8cc</guid><dc:creator>twihtronics</dc:creator><description>&lt;p&gt;showing the code which makes the twi calls would be helpful. Also are you getting back any error for the call?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>