<?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>nRF52840 SDK16 - Problem with TWI</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/65351/nrf52840-sdk16---problem-with-twi</link><description>Hi everyone, 
 I try to write using I2C but I fail and I cannot figure out the issue 
 This is my code snippet. 
 
 When I run it it returns the following error 
 
 It fails inside the nrf_drv_twi_tx() function.. When I set the len parameter to one then</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 01 Sep 2020 06:34:22 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/65351/nrf52840-sdk16---problem-with-twi" /><item><title>RE: nRF52840 SDK16 - Problem with TWI</title><link>https://devzone.nordicsemi.com/thread/267338?ContentTypeID=1</link><pubDate>Tue, 01 Sep 2020 06:34:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7f52f73c-ca00-4ce2-b0f8-a2388ad9cd41</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Please share the whole file. The error is reporting that it asserts at line 484 in main.c&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 SDK16 - Problem with TWI</title><link>https://devzone.nordicsemi.com/thread/267337?ContentTypeID=1</link><pubDate>Tue, 01 Sep 2020 06:24:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aa6d29be-fd9b-4794-89f0-e33763a9973f</guid><dc:creator>Nikosant03</dc:creator><description>&lt;p&gt;Hi Jared,&lt;/p&gt;
&lt;p&gt;I enable the Softdevice before&amp;nbsp;initializing the TWI driver and finally my BMX160 and BQ27421 I2C sensors. This is my main()&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;int main(void) {

  log_init(); // na - Initialize the logger module

  createInterrupt();                             // Create the interrupts
  timers_init();                                 // na - Initialize the Timer Library
  power_management_init();                       // Initializing power management
  ble_stack_init();                              // BLE Stack initiallization
  sd_power_dcdc_mode_set(NRF_POWER_DCDC_ENABLE); // na - Enabling the DCDC converter for lower current consumption after calling ble_stack_init - You can enable the DC/DC at any time after you have enabled the SoftDevice
  gap_params_init();                             // GAP initiallization, the Generic Access Profile, specifies the ways devices advertise, discover and connect to each other
  gatt_init();                                   // GATT initiallization, the Generic Attribute Profile, is the one that handles attributes, characteristics and services
  services_init();                               // Initialize the services
  advertising_init();                            // Initilize the advertising

  conn_params_init();  // Initialize the connection parameters
  peer_manager_init(); // Initialize the Peer Manager Module. The peer manager module handles encryption, pairing, and bonding

  
  twi_init();
  Acc_delay_ms(50);

  BMI160_init();
  Acc_delay_ms(100);


  BQ27421_initialize(); // na - Initialize the battery monitor

  //***************SAADC-FLEXI FORCE***************
  nrf_gpio_range_cfg_output(pinStartOut, pinStopOut); // na - pinout for EB v.1
  selectMuxPin(callback_counter);                     // na - set the control pin of MUX to zero
  saadc_init();                                       // na -  consumes high current when the saadc is initiated. Check this example to minimize the consumption https://github.com/NordicPlayground/nRF52-ADC-examples/blob/master/saadc_low_power/main.c

  //---------------------------------------------------------------------------------------------------------------------------

  nrf_gpio_cfg_output(vibrator); // na - configure vibrator as OUTPUT
  nrf_gpio_pin_clear(vibrator);  // na - initialize the pin to low (no vibration)
  nrf_gpio_cfg_output(CTRL);     // na - configure the CTRL pin as output (this pin set and unset converter&amp;#39;s LOAD output)
  nrf_gpio_pin_set(CTRL);        // Enable the LOAD output of buck converter (TPS62740) by setting high its CTRL pin
  nrf_delay_ms(10);              // na - add a small delay to give some time to complete the pin configuration

  /** @brief : RAM retention - Writes the NRF_POWER-&amp;gt;RAM[index].POWERSET register
   *
   *  @param[in] index : Contains the index in the NRF_POWER-&amp;gt;RAM[index].POWERSET register to write to.
   *  @param[in] ram_powerset : Contains the word to write to the NRF_POWER-&amp;gt;RAM[index].POWERSET register.
   *
   *  @retval : NRF_SUCCESS
   */
  ret_code_t err_code;
  err_code = sd_power_ram_power_set(RAM_AHB_slave, POWER_RAM_POWER_S0RETENTION_On &amp;lt;&amp;lt; POWER_RAM_POWER_S0RETENTION_Pos); // na - retain RAM AHB 2, index 0.
  APP_ERROR_CHECK(err_code);


  // Enter main loop.
  for (;;) {

    // Enter system On sleep mode
    idle_state_handle(); // na - The Power Management library is safer to use than the inline functions __SEV, __WFE, __WFI especially when SoftDevice is used.
  }
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 SDK16 - Problem with TWI</title><link>https://devzone.nordicsemi.com/thread/267250?ContentTypeID=1</link><pubDate>Mon, 31 Aug 2020 13:00:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1b45ef2b-e92c-4c37-a628-35320a0091ff</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Could you post more of your code? I&amp;#39;m not sure if it actually is asserting at that function since the error message is reporting that you haven&amp;#39;t enabled the Softdevice and this is not a error that is returned by that function. Could you share your main file?&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></channel></rss>