<?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>Reading external sensor using I2C on nrf9160dk</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/58430/reading-external-sensor-using-i2c-on-nrf9160dk</link><description>Hello, 
 I want to read external accelerometer on nrf9160dk using I2C. But when I connect SDA and SCL pins of sensor to nrf91, there is no output. 
 The Code is: 
 
 When I don&amp;#39;t connect sensor to nrf91, then continuously it prints &amp;quot;I2C_BUFFER =&amp;quot; 
 When</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 06 Jan 2022 09:04:46 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/58430/reading-external-sensor-using-i2c-on-nrf9160dk" /><item><title>RE: Reading external sensor using I2C on nrf9160dk</title><link>https://devzone.nordicsemi.com/thread/346377?ContentTypeID=1</link><pubDate>Thu, 06 Jan 2022 09:04:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6b7d2e80-00d1-4768-afc7-9cff11ace231</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Captain CK, Let&amp;#39;s continue in your post here:&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/support-private/support/282135"&gt;https://devzone.nordicsemi.com/support-private/support/282135&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading external sensor using I2C on nrf9160dk</title><link>https://devzone.nordicsemi.com/thread/346341?ContentTypeID=1</link><pubDate>Thu, 06 Jan 2022 06:11:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:00d403b6-b2b3-4428-b0e4-ea2071f37ed1</guid><dc:creator>Captain CK</dc:creator><description>&lt;p&gt;Hello,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I&amp;nbsp; compile and debug the above code. Also, I edited the &amp;quot;prj.conf&amp;quot; file, but the I couldn&amp;#39;t find the &amp;quot;&lt;span&gt;.overlay&amp;quot; file to edit. Then I Debug the program. But it stopped at,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;line 38:&amp;nbsp;&amp;nbsp;printk(&amp;quot;I2C: Device driver not found.\n&amp;quot;);&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Here, I have not connected any I2C compatible sensor&amp;nbsp; with nRf9160 dk board.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Does this code print the address if only I2C sensor connected ?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Can you help me solve this issue.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank You.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading external sensor using I2C on nrf9160dk</title><link>https://devzone.nordicsemi.com/thread/345534?ContentTypeID=1</link><pubDate>Fri, 31 Dec 2021 11:41:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d82af1b0-68ae-4e11-8c98-188eb3f1893f</guid><dc:creator>Captain CK</dc:creator><description>&lt;p&gt;From where did you find this &amp;quot;i2c.h&amp;quot; library&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading external sensor using I2C on nrf9160dk</title><link>https://devzone.nordicsemi.com/thread/238802?ContentTypeID=1</link><pubDate>Mon, 09 Mar 2020 12:46:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:562ef0cb-1d92-4c87-9826-632a7066b387</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;If you are getting&amp;nbsp;NRFX_TWIS_EVT_READ_REQ event, you need to call&amp;nbsp;nrfx_twis_tx_prepare(). And try to change&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;nrfx_twis_rx_prepare(&amp;amp;m_twis, I2C_BUFFER, size); &lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;to&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;nrfx_twis_rx_prepare(&amp;amp;m_twis, I2C_BUFFER, sizeof(I2C_BUFFER)); &lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading external sensor using I2C on nrf9160dk</title><link>https://devzone.nordicsemi.com/thread/238769?ContentTypeID=1</link><pubDate>Mon, 09 Mar 2020 10:32:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:02f5e56a-34cd-48d5-8e8b-df4515d83031</guid><dc:creator>Jagruti</dc:creator><description>&lt;p&gt;I did not understand what you are trying to say. Can you please explain. I am still getting the same error.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading external sensor using I2C on nrf9160dk</title><link>https://devzone.nordicsemi.com/thread/238244?ContentTypeID=1</link><pubDate>Thu, 05 Mar 2020 11:08:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e7fe9843-a069-4dcb-b068-a2dc51e64e1a</guid><dc:creator>Turbo J</dc:creator><description>&lt;p&gt;My crystal ball says: Don&amp;#39;t use msg buffer on the stack with fire-and-forget (read event based) TWIS functions.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading external sensor using I2C on nrf9160dk</title><link>https://devzone.nordicsemi.com/thread/238196?ContentTypeID=1</link><pubDate>Thu, 05 Mar 2020 09:07:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bb90a084-b79d-4dbc-a300-f860cdfa9b69</guid><dc:creator>Jagruti</dc:creator><description>&lt;p&gt;Thank you so much. Your solution is working.&lt;/p&gt;
&lt;p&gt;But there is other problem. I receive some data then it shows &amp;quot;*** buffer overflow detected ***: terminated&amp;quot;. When I run same program on nRF52840 with NRFX TWIS drivers there is no problem.&lt;/p&gt;
&lt;p&gt;How can I avoid RX buffer overflow?&lt;/p&gt;
&lt;p&gt;Output:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;***** Booting Zephyr OS build v1.14.99-ncs3-snapshot2-2647-gd6e67554cfeb *****
Starting TWIS program!
Data = ,,,,,,,0,
Data = ,,,,,,,0,
Data = ,,,,,,,0,
Data = ,,,,,,,0,
*** buffer overflow detected ***: terminated
exit&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading external sensor using I2C on nrf9160dk</title><link>https://devzone.nordicsemi.com/thread/238126?ContentTypeID=1</link><pubDate>Wed, 04 Mar 2020 17:23:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:423658e7-f2d0-4732-9f32-f81db72653a5</guid><dc:creator>Sigurd</dc:creator><description>[quote user="Jagruti_N2A"]but it shows error.[/quote]
&lt;p&gt;Try using&amp;nbsp;&lt;span&gt;UARTE3_SPIM3_SPIS3_TWIM3_TWIS3_IRQn instead.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
[quote user="Jagruti_N2A"]Is it necessary to&lt;span&gt;&amp;nbsp;declare the interrupt vector for the TWIS?&lt;/span&gt;[/quote]
&lt;p&gt;&amp;nbsp;Yes, try to use the same approach as in the link.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading external sensor using I2C on nrf9160dk</title><link>https://devzone.nordicsemi.com/thread/238117?ContentTypeID=1</link><pubDate>Wed, 04 Mar 2020 16:55:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4610a0ae-35ac-467d-9539-8059529ded4b</guid><dc:creator>Jagruti</dc:creator><description>&lt;p&gt;Is it necessary to&lt;span&gt;&amp;nbsp;declare the interrupt vector for the TWIS? In this link&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/50656/using-pdm-mic-on-nrf9160dk/204715#204715"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/50656/using-pdm-mic-on-nrf9160dk/204715#204715&lt;/a&gt;&amp;nbsp;they are adding the interrupt handling. I tried to do this in my project also, but it shows error.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The code&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;ISR_DIRECT_DECLARE(twis_isr_handler)
{
	nrfx_twis_3_irq_handler();
	ISR_DIRECT_PM();

	return 1;
}

void main(void)
{
        IRQ_DIRECT_CONNECT(TWIS_IRQn, 0,  /*error for TWIS_IRQn*/
			   twis_isr_handler, 0);&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Error:&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;1&amp;gt; ../src/main.c:293:28: error: &amp;#39;TWIS_IRQn&amp;#39; undeclared (first use in this function); did you mean &amp;#39;I2S_IRQn&amp;#39;?
1&amp;gt; C:/ncs/zephyr/include/sw_isr_table.h:70:5: note: in definition of macro &amp;#39;Z_ISR_DECLARE&amp;#39;
1&amp;gt; C:/ncs/zephyr/include/irq.h:119:2: note: in expansion of macro &amp;#39;Z_ARCH_IRQ_DIRECT_CONNECT&amp;#39;
1&amp;gt; ../src/main.c:293:9: note: in expansion of macro &amp;#39;IRQ_DIRECT_CONNECT&amp;#39;
1&amp;gt; ../src/main.c:293:28: note: each undeclared identifier is reported only once for each function it appears in
1&amp;gt; C:/ncs/zephyr/include/sw_isr_table.h:70:5: note: in definition of macro &amp;#39;Z_ISR_DECLARE&amp;#39;
1&amp;gt; C:/ncs/zephyr/include/irq.h:119:2: note: in expansion of macro &amp;#39;Z_ARCH_IRQ_DIRECT_CONNECT&amp;#39;
1&amp;gt; ../src/main.c:293:9: note: in expansion of macro &amp;#39;IRQ_DIRECT_CONNECT&amp;#39;
Build failed&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading external sensor using I2C on nrf9160dk</title><link>https://devzone.nordicsemi.com/thread/238075?ContentTypeID=1</link><pubDate>Wed, 04 Mar 2020 14:36:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ecaf7834-0aae-4627-9b53-fb9c4275c55f</guid><dc:creator>Jagruti</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I followed the above guide and NRFX TWIS drivers are included in the program.&lt;/p&gt;
&lt;p&gt;But still there are few doubts. Now is there any need of overlay file? How does the prj.conf file should look like? How to assign the SDA and SCL pins for TWIS?&lt;/p&gt;
&lt;p&gt;Now I have removed the overlay file from the project and removed I2C from prj.conf.&lt;/p&gt;
&lt;p&gt;prj.conf looks like this&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_TRUSTED_EXECUTION_NONSECURE=y
CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_COMPILER_OPT=&amp;quot;-DNRF_TWIS3=NRF_TWIS3 -DNRFX_TWIS3_ENABLED=1&amp;quot;


CONFIG_NEWLIB_LIBC=y


#CONFIG_LOG=y
#CONFIG_I2C_LOG_LEVEL_DBG=y
#CONFIG_LOG_BACKEND_UART=y
#CONFIG_I2C_INIT_PRIORITY=60&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The code:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#include &amp;lt;nrf9160.h&amp;gt;
#include &amp;lt;zephyr.h&amp;gt;
#include &amp;lt;misc/printk.h&amp;gt;
#include &amp;lt;i2c.h&amp;gt;
#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;string.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;
#include &amp;lt;math.h&amp;gt;
#include &amp;lt;nrfx_twis.h&amp;gt;

#include &amp;lt;gpio.h&amp;gt;

#define TWI_ADDRESSES   60
static const nrfx_twis_t m_twis = NRFX_TWIS_INSTANCE(3);
uint8_t I2C_BUFFER[35];
char hold_icm_acc[100];
size_t size = 29;
bool I2C_xfer_Done;


static void twis_event_handler(nrfx_twis_evt_t const * const p_event)
   {
    switch(p_event-&amp;gt;type)
    {
    case NRFX_TWIS_EVT_READ_REQ:
        if(p_event-&amp;gt;data.buf_req)
        {
        }
        break;
    case  NRFX_TWIS_EVT_READ_DONE:
        break;
    case NRFX_TWIS_EVT_WRITE_REQ:
        if(p_event-&amp;gt;data.buf_req)
        {
            nrfx_twis_rx_prepare(&amp;amp;m_twis, I2C_BUFFER, size);            
        }
        break;
    case NRFX_TWIS_EVT_WRITE_DONE:
        /* code to be done */

        I2C_xfer_Done=true;

        default:
        break;
    }
}

void twis_init (void) 
{

    const nrfx_twis_config_t config =
    {
        .addr               = TWI_ADDRESSES,
        .scl                = 11,   /* How to assign SCL and SDA pins*/
        .sda                = 12
       // .interrupt_priority = APP_IRQ_PRIORITY_HIGH
        
    };

    /* Init TWIS */
    do
    {
        nrfx_twis_init(&amp;amp;m_twis, &amp;amp;config, twis_event_handler);
        nrfx_twis_enable(&amp;amp;m_twis);
    }while (0);


}

void main(void)
{
	printk(&amp;quot;Starting TWIS program!\n&amp;quot;);
        printk(&amp;quot;ICM data = %d&amp;quot;, I2C_BUFFER);

	twis_init();
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;In twis_init() function, how to assign SCL and SDA pins. Now I have just given the numbers which I want to use.&lt;/p&gt;
&lt;p&gt;Actually I connected SCL, SDA pins to the Master&amp;#39;s SCL, SDA. But as soon as I do connections, Master stops giving data. One more thing I observed is: there is no voltage level at SCL and SDA pins of nRF9160dk. What I am doing wrong? is there any problem in my code? I think I am not assigning the SCL, SDA pins properly. Please tell me how to do that.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading external sensor using I2C on nrf9160dk</title><link>https://devzone.nordicsemi.com/thread/237840?ContentTypeID=1</link><pubDate>Tue, 03 Mar 2020 15:27:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b793dfc1-5786-4d3c-975f-d321bcbedde3</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;It seems like I forgot the link in my last post. Here it is:&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/50656/using-pdm-mic-on-nrf9160dk/204715#204715"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/50656/using-pdm-mic-on-nrf9160dk/204715#204715&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This post shows you how to add nrfx driver for PDM. If you want to try this approach for TWIS, you will need to add the corresponding TWIS function and defines, e.g.&amp;nbsp;&lt;span&gt;NRFX_TWIS_ENABLED instead of&amp;nbsp;NRFX_PDM_ENABLED.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading external sensor using I2C on nrf9160dk</title><link>https://devzone.nordicsemi.com/thread/237837?ContentTypeID=1</link><pubDate>Tue, 03 Mar 2020 15:22:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:848f974a-a4ed-4d84-b8b6-712d42dfec2f</guid><dc:creator>Jagruti</dc:creator><description>&lt;p&gt;Ok thank you for the reply.&lt;/p&gt;
&lt;p&gt;So how can I use nrfx TWIS driver. what should I add in prj.conf and overlay file to include this driver?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading external sensor using I2C on nrf9160dk</title><link>https://devzone.nordicsemi.com/thread/237760?ContentTypeID=1</link><pubDate>Tue, 03 Mar 2020 13:17:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c624a386-ceaf-4e0b-831c-e548d85088e6</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;The I2C-slave driver support seems to be missing in Zephyr for nrf. You can create a feature request in Zephyr if this is something you need. Note that you might be able to use the nrfx TWIS driver directly instead, see this post on how to use nrfx directly. Alternately, you can use the nRF9160 as I2C master, and the SAM as slave. Or you can use a different protocol between the nRF9160 and the SAM. E.g. UART or SPI.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading external sensor using I2C on nrf9160dk</title><link>https://devzone.nordicsemi.com/thread/237191?ContentTypeID=1</link><pubDate>Fri, 28 Feb 2020 14:50:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:387ed57e-5667-4848-b156-04ccd0385211</guid><dc:creator>Jagruti</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I am trying to configure I2C_3 as slave on nrf9160. But I couldn&amp;#39;t found any driver for that. There is i2c_nrfx_twim.c for master. But there is no such driver for slave. In i2c.h and nrf9160.h files there are definitions and registers for slave. But how to use them. I am not understanding how to do configuration. Please guide me for this.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading external sensor using I2C on nrf9160dk</title><link>https://devzone.nordicsemi.com/thread/237124?ContentTypeID=1</link><pubDate>Fri, 28 Feb 2020 12:39:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8662fa89-7732-4097-bb63-bcd22c3a2ddc</guid><dc:creator>Jagruti</dc:creator><description>&lt;p&gt;Yes I want to use nRF91 as pure slave. So how to configure it, that is the question. What are the settings required in prj.conf file?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;nRF91 will be slave and SAM will be Master. SAM will write data on address 60 and nRF91 will read at that address. So how to configure nRF9160 as slave for I2C?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading external sensor using I2C on nrf9160dk</title><link>https://devzone.nordicsemi.com/thread/237105?ContentTypeID=1</link><pubDate>Fri, 28 Feb 2020 11:55:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:deb486b5-86f4-40b0-b538-5166ce0c3e27</guid><dc:creator>Turbo J</dc:creator><description>&lt;p&gt;Impossible with the TWI hardware on NRF chips - these want to be bus master or act as a slave.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Almost&lt;/em&gt; impossible (read: very hard) to do in software.&lt;/p&gt;
&lt;p&gt;By extensively using the I&amp;sup2;C clock streching feature (and GPIOs in open drain mode), one could implement I&amp;sup2;C in software that can read and track another I&amp;sup2;C master&amp;#39;s transactions.&lt;/p&gt;
&lt;p&gt;A more sensible solution would use the NRF chip as pure slave and have the SAM transfer the data it just read from the accelerometer back to the NRF chip in another bus transaction (maybe even on a second bus).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading external sensor using I2C on nrf9160dk</title><link>https://devzone.nordicsemi.com/thread/237074?ContentTypeID=1</link><pubDate>Fri, 28 Feb 2020 09:38:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:04a33488-fcb9-471b-92f4-83417f19af2a</guid><dc:creator>Jagruti</dc:creator><description>&lt;p&gt;I am using ICM20648. Actually I encountered the problem.&lt;/p&gt;
&lt;p&gt;Atmel SAM is interfaced to ICM20648 by using I2C. Now I just want to read this data on nRF91. It means SAM is master and ICM, nRF91 are slaves. But when I ran the code, nRF91 was acting as Master and it read the address of ICM which is 0x69 and it stopped the communication between SAM and ICM.&lt;/p&gt;
&lt;p&gt;So now the question is how to configure nRF91 as slave and read the sensor data received at SAM which is Master?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading external sensor using I2C on nrf9160dk</title><link>https://devzone.nordicsemi.com/thread/237067?ContentTypeID=1</link><pubDate>Fri, 28 Feb 2020 09:20:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6d94502d-722e-4d1b-8454-dcb0d6cc98b8</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;What&amp;nbsp;&lt;span&gt;accelerometer sensor are you using ?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading external sensor using I2C on nrf9160dk</title><link>https://devzone.nordicsemi.com/thread/237056?ContentTypeID=1</link><pubDate>Fri, 28 Feb 2020 08:43:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e5156b00-7fc1-48e9-bbf4-26b415bf7b13</guid><dc:creator>Jagruti</dc:creator><description>&lt;p&gt;I tested the above same code again and now the address is 0x69. But when I try to read at this address there is nothing. And the address is 60 so why it is showing 69. I am not getting this.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading external sensor using I2C on nrf9160dk</title><link>https://devzone.nordicsemi.com/thread/237046?ContentTypeID=1</link><pubDate>Fri, 28 Feb 2020 08:18:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b889cf15-3c6c-42e3-bf05-e018b9bdaa96</guid><dc:creator>Jagruti</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I tested the above code with accelerometer.&lt;/p&gt;
&lt;p&gt;This is the Output:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;***** Booting Zephyr OS build v1.14.99-ncs3-snapshot2-2647-gd6e67554cfeb *****
Starting i2c scanner...
Value of NRF_TWIM3_NS-&amp;gt;PSEL.SCL: 11 
Value of NRF_TWIM3_NS-&amp;gt;PSEL.SDA: 12 
Value of NRF_TWIM3_NS-&amp;gt;FREQUENCY: 26738688 
26738688 -&amp;gt; 100k
error 251 
error 251 
0x 6 FOUND
error 251 
error 251 &lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Why that error is coming? The problem is with nrf91 or at accelerometer side? The address is 60 and it is showing 6.&lt;/p&gt;
&lt;p&gt;Is there anything else I have to configure on nrf91?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading external sensor using I2C on nrf9160dk</title><link>https://devzone.nordicsemi.com/thread/236979?ContentTypeID=1</link><pubDate>Thu, 27 Feb 2020 18:15:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8ec6b116-8ee9-4731-a2cd-f107eb84feac</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Here is some code that you can test to see if you get a response from the sensor.&amp;nbsp;&lt;span&gt;If there is an ACK for the address, it prints the address&amp;nbsp;it found.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;main.c&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#include &amp;lt;nrf9160.h&amp;gt;
#include &amp;lt;zephyr.h&amp;gt;
#include &amp;lt;misc/printk.h&amp;gt;
#include &amp;lt;i2c.h&amp;gt;
#include &amp;lt;string.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;
#include &amp;lt;math.h&amp;gt;


#include &amp;lt;gpio.h&amp;gt;

#define I2C_ACCEL_WRITE_ADDR 0x32
#define I2C_ACCEL_READ_ADDR 0x75

struct device * i2c_accel;
uint8_t WhoAmI = 0u;


static struct device  *led_port;

#ifdef CONFIG_SOC_NRF9160
#define I2C_DEV &amp;quot;I2C_3&amp;quot;
#else
#define I2C_DEV &amp;quot;I2C_1&amp;quot;
#endif


void main(void)
{
	struct device *i2c_dev;
	
	k_sleep(500);

	printk(&amp;quot;Starting i2c scanner...\n&amp;quot;);

	i2c_dev = device_get_binding(I2C_DEV);
	if (!i2c_dev) {
		printk(&amp;quot;I2C: Device driver not found.\n&amp;quot;);
		return;
	}
	
	uint8_t error = 0u;
	
	i2c_configure(i2c_dev, I2C_SPEED_SET(I2C_SPEED_STANDARD));


	printk(&amp;quot;Value of NRF_TWIM3_NS-&amp;gt;PSEL.SCL: %ld \n&amp;quot;,NRF_TWIM3_NS-&amp;gt;PSEL.SCL);
	printk(&amp;quot;Value of NRF_TWIM3_NS-&amp;gt;PSEL.SDA: %ld \n&amp;quot;,NRF_TWIM3_NS-&amp;gt;PSEL.SDA);
	printk(&amp;quot;Value of NRF_TWIM3_NS-&amp;gt;FREQUENCY: %ld \n&amp;quot;,NRF_TWIM3_NS-&amp;gt;FREQUENCY);
	printk(&amp;quot;26738688 -&amp;gt; 100k\n&amp;quot;);
	
	
	
	for (u8_t i = 4; i &amp;lt;= 0x77; i++) {
		struct i2c_msg msgs[1];
		u8_t dst = 1;

		/* Send the address to read from */
		msgs[0].buf = &amp;amp;dst;
		msgs[0].len = 1U;
		msgs[0].flags = I2C_MSG_WRITE | I2C_MSG_STOP;
		
		error = i2c_transfer(i2c_dev, &amp;amp;msgs[0], 1, i);
		if (error == 0) {
			printk(&amp;quot;0x%2x FOUND\n&amp;quot;, i);
		}
		else {
			//printk(&amp;quot;error %d \n&amp;quot;, error);
		}
		
		
	}
	

	
	
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;nrf9160_pca10090ns.overlay&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;amp;i2c3 {
	status = &amp;quot;ok&amp;quot;;
	compatible = &amp;quot;nordic,nrf-twim&amp;quot;;
	sda-pin = &amp;lt; 12 &amp;gt;;
	scl-pin = &amp;lt; 11 &amp;gt;;
    clock-frequency = &amp;lt;I2C_BITRATE_STANDARD&amp;gt;;  
};
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;prj.conf&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;
#CONFIG_SERIAL=y
#CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_I2C=y
CONFIG_I2C_NRFX=y
CONFIG_I2C_3=y
CONFIG_I2C_3_NRF_TWIM=y

CONFIG_NEWLIB_LIBC=y


#CONFIG_LOG=y
#CONFIG_I2C_LOG_LEVEL_DBG=y
#CONFIG_LOG_BACKEND_UART=y
#CONFIG_I2C_INIT_PRIORITY=60&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading external sensor using I2C on nrf9160dk</title><link>https://devzone.nordicsemi.com/thread/236974?ContentTypeID=1</link><pubDate>Thu, 27 Feb 2020 17:25:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f0ef7504-35a9-4569-8786-9715c6e09b24</guid><dc:creator>Turbo J</dc:creator><description>&lt;p&gt;i2c_read() has a return value - you might want to check that for communication errors...&lt;/p&gt;
&lt;p&gt;Also, I2C_BUFFER is not a string. The binary data might just have a zero in the first place...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>