<?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_drv_twi doesnt read multiple bytes in SDK 12.2</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/21080/nrf_drv_twi-doesnt-read-multiple-bytes-in-sdk-12-2</link><description>I am trying to use the function or any function with my BLE UART application. I have a timer that expires to kickoff reading of some sensors and then when I try to read my sensor it only writes the address and data register then reads the the device address</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 24 Apr 2017 14:05:24 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/21080/nrf_drv_twi-doesnt-read-multiple-bytes-in-sdk-12-2" /><item><title>RE: nrf_drv_twi doesnt read multiple bytes in SDK 12.2</title><link>https://devzone.nordicsemi.com/thread/82370?ContentTypeID=1</link><pubDate>Mon, 24 Apr 2017 14:05:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:04bfdcb0-49a3-41d8-8bd4-f745249e7e87</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Could you post a logic trace from the transfer? Again, which device are you trying to interface?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_drv_twi doesnt read multiple bytes in SDK 12.2</title><link>https://devzone.nordicsemi.com/thread/82362?ContentTypeID=1</link><pubDate>Wed, 19 Apr 2017 20:02:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4aa65a8c-730d-4730-bfc3-0e5444369496</guid><dc:creator>Craig</dc:creator><description>&lt;p&gt;Jorgen, I got it work sort of however I still have the same behavior using nrf_drv_twi_xfer, I had to set flags to 0 and so it does a TX followed by RX of 3 bytes, however I cannot get the software to halt for the 3 bytes to finish it only waits fro one byte even though my scope shows the entire transaction as expected. Interesting to note I still need a breakpoint in order to see the full transaction and it NACKs the address on read when it is free running. Can you please help??? I will try different FLAG settings for this function.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_drv_twi doesnt read multiple bytes in SDK 12.2</title><link>https://devzone.nordicsemi.com/thread/82371?ContentTypeID=1</link><pubDate>Fri, 07 Apr 2017 13:04:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:57400769-233d-4ad8-92d8-e0041f4c83c5</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;It sounds very strange that it works if you set breakpoint. Which sensor modele is this? Are you sure the sensor expects a stop signal after writing the read address?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_drv_twi doesnt read multiple bytes in SDK 12.2</title><link>https://devzone.nordicsemi.com/thread/82369?ContentTypeID=1</link><pubDate>Wed, 05 Apr 2017 20:19:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:91367a36-cfb2-4e05-86e1-982299fc80df</guid><dc:creator>Craig</dc:creator><description>&lt;p&gt;Yes I did....That is the weird thing I am trying to explain if I run it in debug mode with a break point in twi_handler it works, however when the software is free running it does the write data transaction and then starts the read transaction however it never completes and is aborted. Maybe the softdevice is causing this? However I have several other sensors which are working fine using same code. I also saw in the datasheet the device stops sending data as soon as no ACK from master was sent so I am assuming thats why it is aborting the operation as opposed to the other devices, although it doesnt even receive one byte when the transaction is aborted it only had wrote the read address to the I2C bus followed by a stop condition&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_drv_twi doesnt read multiple bytes in SDK 12.2</title><link>https://devzone.nordicsemi.com/thread/82368?ContentTypeID=1</link><pubDate>Wed, 05 Apr 2017 08:07:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ac106e44-0b60-4c9d-a284-8e56695002e1</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;This is how the master should respond. Have you checked the SCL and SDA lines with a logic analyzer, to see if the communication is as expected?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_drv_twi doesnt read multiple bytes in SDK 12.2</title><link>https://devzone.nordicsemi.com/thread/82367?ContentTypeID=1</link><pubDate>Tue, 04 Apr 2017 17:25:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c36ba3b9-d5c2-482f-8662-ecada16de69c</guid><dc:creator>Craig</dc:creator><description>&lt;p&gt;I may have figured out the reason, my device requires an ACK ACK NACK by master to read out all bytes. How can I do this??&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_drv_twi doesnt read multiple bytes in SDK 12.2</title><link>https://devzone.nordicsemi.com/thread/82366?ContentTypeID=1</link><pubDate>Tue, 04 Apr 2017 15:04:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b73e0df1-74e6-4109-bb76-cfb670075dce</guid><dc:creator>Craig</dc:creator><description>&lt;p&gt;Sure thing....thanks so much I have to finish this today and it makes no sense....I do see the event occuring however my software hangs when polling m_xfer_done on RX not on TX it seems to work there....&lt;/p&gt;
&lt;p&gt;void twi_handler(nrf_drv_twi_evt_t const * p_event, void * p_context)
{
uint8_t err_code = 0;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;switch (p_event-&amp;gt;type)
{
case NRF_DRV_TWI_EVT_DONE:
        if (p_event-&amp;gt;xfer_desc.type == NRF_DRV_TWI_XFER_RX)
        {
							err_code = 0;
							err_code = 0;
							err_code = 0;
							//counts += 1;
							twi_rx_done = true;							
        }
  }
  m_xfer_done = true;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;}&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_drv_twi doesnt read multiple bytes in SDK 12.2</title><link>https://devzone.nordicsemi.com/thread/82365?ContentTypeID=1</link><pubDate>Tue, 04 Apr 2017 14:52:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:287d6df4-fc77-480b-9623-9102827037a5</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Do you see the &lt;code&gt;NRF_DRV_TWI_EVT_DONE&lt;/code&gt; event being fired if you place a breakpoint inside the handler? Could you post the code of your twi handler?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_drv_twi doesnt read multiple bytes in SDK 12.2</title><link>https://devzone.nordicsemi.com/thread/82364?ContentTypeID=1</link><pubDate>Tue, 04 Apr 2017 13:35:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d59ef06f-9a41-4ee7-a1b8-3b48f0758800</guid><dc:creator>Craig</dc:creator><description>&lt;p&gt;I just tried no such luck.....however if I change the sizeof(m_sample) to a 1 it reads 1 byte. also my flag in twi_handler from NRF_DRV_TWI_EVT_DONE never gets set. it appears as though I need to wait for something to let me know as when I set a breakpoint in the twi_handler it works&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_drv_twi doesnt read multiple bytes in SDK 12.2</title><link>https://devzone.nordicsemi.com/thread/82363?ContentTypeID=1</link><pubDate>Tue, 04 Apr 2017 13:30:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:23d0f7da-fe61-4540-ae27-af0053fa3845</guid><dc:creator>Craig</dc:creator><description>&lt;p&gt;I will try it again, however I just got to my desk and I am pretty sure I did that yesterday. Any other idea? Basically on my scope i see the write address followed by register address and then a read data transaction and a stop condition. If I change this from 3 bytes to 1 byte it will read 1 byte properly. I do this all over....&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_drv_twi doesnt read multiple bytes in SDK 12.2</title><link>https://devzone.nordicsemi.com/thread/82361?ContentTypeID=1</link><pubDate>Tue, 04 Apr 2017 09:26:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c165c83c-da57-4d5b-aec8-520f4f8eba6f</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You need to provide a buffer to the function &lt;code&gt;nrf_drv_twi_rx()&lt;/code&gt; for storing the additional bytes. Now you are only providing a single variable. Try this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;uint8_t m_sample[3];
nrf_drv_twi_rx(&amp;amp;m_twi, LM75B_ADDR, m_sample, sizeof(m_sample);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>