<?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>Enabling TWIM I2C on nRF52810 DK</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/89432/enabling-twim-i2c-on-nrf52810-dk</link><description>I am currently working on enabling and transmitting/receiving data using TWIM on my nRF52810 development kit. The documentation states that in order to enable TWIM I need to provide a pointer to a structure containing the registers of the peripheral as</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 30 Jun 2022 18:32:20 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/89432/enabling-twim-i2c-on-nrf52810-dk" /><item><title>RE: Enabling TWIM I2C on nRF52810 DK</title><link>https://devzone.nordicsemi.com/thread/374972?ContentTypeID=1</link><pubDate>Thu, 30 Jun 2022 18:32:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0430ddff-6a8a-4c48-978d-6eb05f6cf060</guid><dc:creator>EthanDP</dc:creator><description>&lt;p&gt;Ah I was using the nRF Connect SDK, so unfortunately this example won&amp;#39;t apply. Thank you very much for the help!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Enabling TWIM I2C on nRF52810 DK</title><link>https://devzone.nordicsemi.com/thread/374792?ContentTypeID=1</link><pubDate>Wed, 29 Jun 2022 15:53:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0fbcee54-4931-4ad7-8264-3168c144b3ed</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&lt;span&gt;NRF_TWIM_Type&amp;nbsp;&lt;/span&gt;is defined in chip header file in the MDK (e.g &lt;a href="https://github.com/NordicSemiconductor/nrfx/blob/v2.8.0/mdk/nrf52810.h#L1059"&gt;nrf52810.h&lt;/a&gt; for nRF52810 chip).&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not sure exactly which API you are referring to in your initial post, but it sounds like you are using nRF Connect SDK from your comment about prj.conf.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Zephyr provides an &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.0.0/zephyr/hardware/peripherals/i2c.html"&gt;I2C driver API&lt;/a&gt;, which you can use if you do not want to write your own TWIM driver. This uses nrfx_twi(m) internally, and should use TWIM/EasyDMA if you set &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.0.0/kconfig/index.html#CONFIG_NRFX_TWIM0"&gt;CONFIG_NRFX_TWIMx&lt;/a&gt;&lt;span&gt;&amp;nbsp;in your prj.conf file.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;br /&gt;Jørgen&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Enabling TWIM I2C on nRF52810 DK</title><link>https://devzone.nordicsemi.com/thread/374677?ContentTypeID=1</link><pubDate>Wed, 29 Jun 2022 07:51:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fd67ea78-09ea-4a05-8721-f483cea56964</guid><dc:creator>YaroslavRakhnenko</dc:creator><description>&lt;p&gt;sdk_config.h is the configuration file for the nRF SDK. If you open example-projects inside SDK you will see it&lt;/p&gt;
&lt;p&gt;(for ex.: nRF5_SDK_17.1.0\examples\peripheral\blinky\pca10040e\blank\ses)&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1656489019238v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;nrf_drv_twi maybe you don&amp;#39;t need this. Try first with nrfx_twim_XXXX&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Enabling TWIM I2C on nRF52810 DK</title><link>https://devzone.nordicsemi.com/thread/374623?ContentTypeID=1</link><pubDate>Tue, 28 Jun 2022 20:08:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:08b42cfc-64d5-485b-a714-0c4007428284</guid><dc:creator>EthanDP</dc:creator><description>&lt;p&gt;Thank you very much for this example! A couple beginner questions, when you refer to sdk_config do you mean prj.conf or is this a different configuration file that I need to find? In addition how might I use TWIM to transmit data. It seems that in your example you are sending data. Also I can&amp;#39;t seem to import nrf_drv_twi is that part of the old sdk or is it a user created file?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Enabling TWIM I2C on nRF52810 DK</title><link>https://devzone.nordicsemi.com/thread/374620?ContentTypeID=1</link><pubDate>Tue, 28 Jun 2022 19:31:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:900327fa-4f37-4b5d-80cf-0bd3468aabd5</guid><dc:creator>YaroslavRakhnenko</dc:creator><description>&lt;p&gt;Hope this will help you. Mine code for nRF52810:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;quot;nrf_drv_twi.h&amp;quot;
#include &amp;quot;nrfx_twim.h&amp;quot;

/**
 *Pins
 */
#define SCL_PIN 14
#define SDA_PIN 12

/**
 *Create TWI instance.
 */
#define TWI_INSTANCE_ID 0

static const nrfx_twim_t m_twi = NRFX_TWIM_INSTANCE(TWI_INSTANCE_ID);

/**
 * @brief  Function for i2c bus init.
 * @param  none
 * @return none
 */
void twi_init()
{
  ret_code_t err_code;

  const nrfx_twim_config_t twi_config = {
    .scl = SCL_PIN,
    .sda = SDA_PIN,
    .frequency = NRF_TWIM_FREQ_400K,
    .interrupt_priority = APP_IRQ_PRIORITY_HIGH,
    .hold_bus_uninit = false
  };

  err_code = nrfx_twim_init(&amp;amp;m_twi, &amp;amp;twi_config, NULL, NULL); // initialize I2C
  APP_ERROR_CHECK(err_code);

  nrfx_twim_enable(&amp;amp;m_twi); // enable I2C
}

/**
 * @brief  Function to write one byte into XXXXX register at specified register address
 * @param  16 bit register address + 1 byte of data to be written
 * @return true if transmission was successful, otherwise false
 */
bool XXXXX_register_write_byte(uint8_t register, uint8_t value)
{
  ret_code_t err_code;

  uint8_t tx_buffer[2]; // buffer to hold registry address + data

  tx_buffer[0] = register; // register address byte
  tx_buffer[1] = value;    // value to write

  while (nrfx_twim_is_busy(&amp;amp;m_twi)) { }
  err_code = nrfx_twim_tx(&amp;amp;m_twi, your_dev_addr, tx_buffer, sizeof(tx_buffer), false);

  if (NRF_SUCCESS != err_code) {
    return false;
  }
  return true;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;and sdk_config:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1656444716432v1.png" /&gt;&lt;/p&gt;
&lt;div id="simple-translate"&gt;
&lt;div&gt;
&lt;div class="simple-translate-button isShow" style="height:22px;left:132px;top:179px;width:22px;"&gt;&lt;/div&gt;
&lt;div class="simple-translate-panel " style="background-color:#181818;font-size:13px;height:200px;left:0px;top:0px;width:300px;"&gt;
&lt;div class="simple-translate-result-wrapper" style="overflow:hidden;"&gt;
&lt;div class="simple-translate-move"&gt;&lt;/div&gt;
&lt;div class="simple-translate-result-contents"&gt;
&lt;p class="simple-translate-result" style="color:#e6e6e6;" dir="auto"&gt;&lt;/p&gt;
&lt;p class="simple-translate-candidate" style="color:#aaaaaa;" dir="auto"&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>