<?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 Manager / Sensor interfacing with register-less sensor</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/46900/twi-manager-sensor-interfacing-with-register-less-sensor</link><description>Hi everyone, I&amp;#39;m having trouble deciding on the &amp;quot;best&amp;quot; / &amp;quot;most sane&amp;quot; way to interface two I2C sensors with the nRF5832. Both sensors are on the same I2C bus. The first sensor is well supported by the nRF52 SDK v15.0.0 with a driver using the TWI Manager</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 29 May 2019 14:21:46 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/46900/twi-manager-sensor-interfacing-with-register-less-sensor" /><item><title>RE: TWI Manager / Sensor interfacing with register-less sensor</title><link>https://devzone.nordicsemi.com/thread/189926?ContentTypeID=1</link><pubDate>Wed, 29 May 2019 14:21:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:73db6b8e-0d00-4555-8472-527afb8631c7</guid><dc:creator>lhochstetter</dc:creator><description>&lt;p&gt;Hi Jared,&lt;br /&gt;&lt;br /&gt;thanks again for your input! &lt;/p&gt;
[quote userid="73165" url="~/f/nordic-q-a/46900/twi-manager-sensor-interfacing-with-register-less-sensor/189312"]But I think the best and safest option would be to base the&amp;nbsp;&lt;span&gt;MS5607&amp;nbsp;on the nrf_twi_mngr driver instead of the nrf_twi_drv.&amp;nbsp;&lt;/span&gt;[/quote]
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I skimmed the nrf_twi_mngr documentation and noticed that you can actually perform quite &amp;quot;low level&amp;quot; I2C transactions (i.e. the nrf_twi_senor allows you only to read a register but not from an I2C address, but the nrf_twi_mngr seems to be less restrictive).&lt;br /&gt;&lt;br /&gt;This might be an option to interface both the MS5607 and the LIS2DH12 using the nrf_twi_mngr ... I&amp;#39;ll definetly try!&lt;br /&gt;&lt;br /&gt;Thanks and kind regards&lt;br /&gt;&lt;br /&gt;lhochstetter&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI Manager / Sensor interfacing with register-less sensor</title><link>https://devzone.nordicsemi.com/thread/189312?ContentTypeID=1</link><pubDate>Mon, 27 May 2019 12:21:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b72f07a6-e3ff-4259-bafa-af9af9a32cc6</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Sorry for the late response. Unfortunately, I meant using two separate lines. Each instance requires two unique pins.&lt;/p&gt;
&lt;p&gt;On the other hand, I&amp;#39;ve might have given an impression in my previous reply that using one instance is more complicated then it really is.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;What you would have to do to use one instance with two separate drivers is to use one of the initialize functions of either driver to initialize the instance, and then use the same instance when calling functions from either driver. It&amp;#39;s important that you only initialize the instance once and don&amp;#39;t use the instance in a operation with one driver when it&amp;#39;s already busy in another operation with the other driver. This could give unpredictable behavior. I would recommend that you use the initialize function from the nrf_twi_sensor to initialize the instance, as it use the transaction manager which again use nrf_drv_twi.&amp;nbsp;The transaction manager will reinitialize every time the config parameters changes from the previous transaction, using another configuration outside of the driver can therefore give error.&amp;nbsp;&lt;/p&gt;
[quote user="lhochstetter"]I might just port the LIS2DH12 driver to use the nrf_drv_twi functions if I can&amp;#39;t come up with another idea.[/quote]
&lt;p&gt;This&amp;nbsp;should be a viable option. But I think the best and safest option would be to base the&amp;nbsp;&lt;span&gt;MS5607&amp;nbsp;on the nrf_twi_mngr driver instead of the nrf_twi_drv.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Jared&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI Manager / Sensor interfacing with register-less sensor</title><link>https://devzone.nordicsemi.com/thread/187596?ContentTypeID=1</link><pubDate>Thu, 16 May 2019 19:46:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fcb95d14-d6d6-4c94-a697-deea81880df9</guid><dc:creator>lhochstetter</dc:creator><description>&lt;p&gt;Hi Jared,&lt;br /&gt;&lt;br /&gt;thanks for your input! Just to be sure I understand you correctly:&lt;br /&gt;&lt;br /&gt;I&amp;#39;d be using TWI 0 and TWI 1 on the same SDA and SCL pins (Note: both sensors are on the same I2C bus): TWI 0 would be used by the LIS2DH12 and TWI 1 would be used by the MS5607.&lt;br /&gt;&lt;br /&gt;i.e.&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;TWI 0-|                   |-LIS2DH12
      |----|SDA + SCL|----|
TWI 1-|                   |-MS5607&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;How do I guarantee in this case, that e.g. a transfer on TWI 0 does not interfere with a ongoing transfer on TWI 1 or vice versa?&lt;br /&gt;&lt;br /&gt;Or did your suggestion inclue two separate I2C buses / separate SDA and SCL lines? If so, I cannot use your solution as I&amp;#39;m bound by the hardware design.&lt;/p&gt;
&lt;p&gt;i.e.&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;TWI 0-|----|SDA + SCL|----|-LIS2DH12

TWI 1-|----|SDA + SCL|----|-MS5607&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;I might just port the LIS2DH12 driver to use the nrf_drv_twi functions if I can&amp;#39;t come up with another idea.&lt;br /&gt;&lt;br /&gt;Kind regards,&lt;br /&gt;&lt;br /&gt;lhochstetter&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI Manager / Sensor interfacing with register-less sensor</title><link>https://devzone.nordicsemi.com/thread/187298?ContentTypeID=1</link><pubDate>Wed, 15 May 2019 13:46:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:68330fe5-52db-47cb-84a2-0ee6354a334b</guid><dc:creator>Jared</dc:creator><description>&lt;div&gt;&lt;span&gt;Hi,&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;Unfortunately, i&amp;#39;m not so sure if this is as straight forward as one would think since the LIS2DH12 is based on nrf_twi_sensor which use the nrf_drv_twi at a lower layer.The easiest solution would be to have to separate TWI instances for the devices. Using a single instance might require you to init and de initialize the driver between every transfer when you switch device. You can maybe avoid the init and de init when you switch between the devices by re-creating the state the peripheral was in before you switched device.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp;&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&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI Manager / Sensor interfacing with register-less sensor</title><link>https://devzone.nordicsemi.com/thread/185999?ContentTypeID=1</link><pubDate>Wed, 08 May 2019 13:53:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:982d28fd-dc6e-447b-bc1f-25e29ec2f08e</guid><dc:creator>lhochstetter</dc:creator><description>&lt;p&gt;Hi Jared,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m using following sensors: LIS2DH12 and MS5607.&lt;br /&gt;&lt;br /&gt;The LIS2DH12 sensor&amp;#39;s driver is provided in the SDK using nrf_twi_sensor functions.&lt;br /&gt;&lt;br /&gt;For the MS5607 sensor I&amp;#39;m using the driver provided by the manufacturer:&lt;br /&gt;&lt;a href="https://www.te.com/commerce/DocumentDelivery/DDEController?Action=showdoc&amp;amp;DocId=Data+Sheet%7FMS5607-02BA03%7FB2%7Fpdf%7FEnglish%7FENG_DS_MS5607-02BA03_B2.pdf%7FCAT-BLPS0035"&gt;Datasheet&lt;/a&gt;&lt;br /&gt;&lt;a href="https://www.amsys-sensor.eu/sheets/amsys.fr.an520_e.pdf"&gt;Driver&lt;br /&gt;&lt;br /&gt;&lt;/a&gt;Kind regards,&lt;br /&gt;&lt;br /&gt;lhochstetter&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI Manager / Sensor interfacing with register-less sensor</title><link>https://devzone.nordicsemi.com/thread/185995?ContentTypeID=1</link><pubDate>Wed, 08 May 2019 13:45:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:93ce46fc-ecb9-47b2-a71b-cca9c4e9cbbc</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not sure I understand which nrf_twi_sensor library you are referring to. Exactly which sensor are you using?&lt;/p&gt;
&lt;p&gt;Jared&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>