<?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 and BLE integration test</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/73087/twi-and-ble-integration-test</link><description>Dear, manager. 
 
 Hi, 
 
 I am currently testing the use of TWI and BLE together. 
 
 However, Data (24bit) is received and read through TWI every 4ms. BLE is only initialized, and TWI data becomes strange by simply turning on BLE, whether it is initialization</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 29 Mar 2021 09:43:08 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/73087/twi-and-ble-integration-test" /><item><title>RE: TWI and BLE integration test</title><link>https://devzone.nordicsemi.com/thread/302323?ContentTypeID=1</link><pubDate>Mon, 29 Mar 2021 09:43:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:09304b85-5943-43c7-9b24-969248d5e142</guid><dc:creator>awneil</dc:creator><description>[quote userid="90626" url="~/f/nordic-q-a/73087/twi-and-ble-integration-test/302316#302316"]it was resolved[/quote]
&lt;p&gt;Great!&lt;/p&gt;
&lt;p&gt;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f603.svg" title="Smiley"&gt;&amp;#x1f603;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/36604._5F00_Verify_2D00_answer_2D00_nordic_5F00_2.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI and BLE integration test</title><link>https://devzone.nordicsemi.com/thread/302316?ContentTypeID=1</link><pubDate>Mon, 29 Mar 2021 08:42:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d7bf47bc-dac2-4d81-af0d-38688c1ead9c</guid><dc:creator>Daeho</dc:creator><description>&lt;p&gt;Thank you for your reply.&lt;/p&gt;
&lt;p&gt;I used the TWI function. Then it was resolved.&lt;/p&gt;
&lt;p&gt;I wanted to solve it using registers.&lt;/p&gt;
&lt;p&gt;Thank you.&lt;/p&gt;
&lt;p&gt;Regards.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI and BLE integration test</title><link>https://devzone.nordicsemi.com/thread/301979?ContentTypeID=1</link><pubDate>Thu, 25 Mar 2021 15:59:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:541ab891-ae53-471d-be3f-a1e0de9447dc</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Okey, I just saw the code you suppled were using both &amp;#39;data&amp;#39; and &amp;#39;readData&amp;#39;, so just wanted to make sure that the values you listed were the actual twi data (&amp;#39;readData&amp;#39;), and not a calculation of twi data (&amp;#39;data&amp;#39;).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I think next step is really to decode those twi data on a logic analyzer. I do not see how BLE can interfere here.&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI and BLE integration test</title><link>https://devzone.nordicsemi.com/thread/301909?ContentTypeID=1</link><pubDate>Thu, 25 Mar 2021 13:06:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:65a8d5d1-0dda-4ad3-bb00-0aa5502b5285</guid><dc:creator>Daeho</dc:creator><description>&lt;p&gt;It&amp;#39;s listed as a table in the first question, or are you referring to something else?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI and BLE integration test</title><link>https://devzone.nordicsemi.com/thread/301904?ContentTypeID=1</link><pubDate>Thu, 25 Mar 2021 13:01:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:892dd268-1814-43c3-93ae-5d84370777b0</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Can you also output the&amp;nbsp;readData1,&amp;nbsp;readData2, and&amp;nbsp;readData3 to terminal?&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI and BLE integration test</title><link>https://devzone.nordicsemi.com/thread/301834?ContentTypeID=1</link><pubDate>Thu, 25 Mar 2021 09:39:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:954ae6ce-c8f9-4185-9664-a216be3ddbb8</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;So your scope is an Agilent&amp;nbsp;DSOX1204A:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1616665136769v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;It can do protocol decoding!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI and BLE integration test</title><link>https://devzone.nordicsemi.com/thread/301829?ContentTypeID=1</link><pubDate>Thu, 25 Mar 2021 09:26:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e75bebd2-041b-4a03-84ea-ec79113e31b3</guid><dc:creator>Daeho</dc:creator><description>&lt;p&gt;thank you for reply.&lt;/p&gt;
&lt;p&gt;When I read TWI I use the code below.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;void twiInit()
{
  //TWI init function
  //TWI disable
  NRF_TWI0 -&amp;gt; ENABLE = 0;

  //TWI Pin map
  NRF_TWI0 -&amp;gt; PSELSCL = TWI_SCL;
  NRF_TWI0 -&amp;gt; PSELSDA = TWI_SDA;

  //frequency set
  NRF_TWI0 -&amp;gt; FREQUENCY = 0x06680000; //400kHz
  //NRF_TWI0 -&amp;gt; FREQUENCY = 0x01980000; //100kHz

  //TWI interrupt disable
  NRF_TWI0 -&amp;gt; INTENCLR = 0xFFFFFFFF;

  //Communication enable
  NRF_TWI0 -&amp;gt; ENABLE = 5;

  //Event clear
  NRF_TWI0 -&amp;gt; EVENTS_RXDREADY = 0;
  NRF_TWI0 -&amp;gt; EVENTS_TXDSENT = 0;
}


void ReadData(uint8_t reg_addr)
{
  NRF_TWI0 -&amp;gt; ADDRESS = TI_address;  //Slave device set address
  NRF_TWI0 -&amp;gt; TASKS_STARTTX = 1;  //sned start
  NRF_TWI0 -&amp;gt; TXD = reg_addr; //send the read register address
  while(!NRF_TWI0 -&amp;gt; EVENTS_TXDSENT){}  //wait ACK
  NRF_TWI0 -&amp;gt; EVENTS_TXDSENT = 0;   //reset event flag

  NRF_TWI0 -&amp;gt; ADDRESS = TI_address;  //Slave device set address
  NRF_TWI0 -&amp;gt; TASKS_STARTRX = 1; //recive start
  while(NRF_TWI0 -&amp;gt; EVENTS_BB == 0){}  //wait Byte Boundary
  NRF_TWI0 -&amp;gt; EVENTS_BB = 0;  //reset BB flag after recive
  while(NRF_TWI0 -&amp;gt; EVENTS_RXDREADY == 0){} //wait read
  NRF_TWI0 -&amp;gt; EVENTS_RXDREADY = 0; //reset RXDREADY flag
  readData1 = NRF_TWI0 -&amp;gt; RXD;  //bling data buffer

  while(NRF_TWI0 -&amp;gt; EVENTS_BB == 0){}  //wait Byte Boundary
  NRF_TWI0 -&amp;gt; EVENTS_BB = 0;  //reset BB flag after recive
  while(NRF_TWI0 -&amp;gt; EVENTS_RXDREADY == 0){} //wait read
  NRF_TWI0 -&amp;gt; EVENTS_RXDREADY = 0; //reset RXDREADY flag
  readData2 = NRF_TWI0 -&amp;gt; RXD;  //bling data buffer

  while(NRF_TWI0 -&amp;gt; EVENTS_BB == 0){}  //wait Byte Boundary
  NRF_TWI0 -&amp;gt; EVENTS_BB = 0;  //reset BB flag after recive
  NRF_TWI0 -&amp;gt; TASKS_STOP = 1;   //NACK recive befor recive final data
  while(NRF_TWI0 -&amp;gt; EVENTS_RXDREADY == 0){} //wait read
  NRF_TWI0 -&amp;gt; EVENTS_RXDREADY = 0; //reset RXDREADY flag
  readData3 = NRF_TWI0 -&amp;gt; RXD;  //bling data buffer
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The code that receives and handles an interrupt every 4ms is as follows. (Expressed in abbreviated form.)&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;Interrupt handler() //4ms event
{
    data_EN = 1;
}

Main()
{
    if(data_EN == 1)  //Sensor Data ready, Data read
    { 
      data_EN = 0;
      //FIFO_PHASE, Data converter------------------------
      for(int j = 0; j &amp;lt; 4; j++)
      {
        ReadData(0xFF);
        sign = readData1 &amp;amp; 0xC0;  //0b11000000
        readData1 = readData1 &amp;amp; 0x3F;
        if(sign == 0xC0)
        {
          SensorData[j].TestData = -((readData1 &amp;lt;&amp;lt; 16) + (readData2 &amp;lt;&amp;lt; 8) + readData3);
        }
        else if(sign == 0x00)
        {
          SensorData[j].TestData = (readData1 &amp;lt;&amp;lt; 16) + (readData2 &amp;lt;&amp;lt; 8) + readData3;
        }
        data[j] = ((double)(SensorData[j].TestData) * (double)0.0005722045898);
      }
      //---------------------------------------------------
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Interrupt occurs every 4ms, receives a variable from the interrupt, reads and processes TWI data.&lt;/p&gt;
&lt;p&gt;When BLE is initialized and advertising starts or data is sent, the TWI data becomes strange.&lt;/p&gt;
&lt;p&gt;And changing the advertising interval to 1 (625 us) seems to be okay. However, BLE is not available.&lt;/p&gt;
&lt;p&gt;And even if the advertising time is reduced, it is thought that the problem will occur again during transmission.&lt;/p&gt;
&lt;p&gt;And when taken with a scope, it looks like the pictures below.&lt;/p&gt;
&lt;p&gt;When I look at the clock graph, it seems that the data comes in correctly might.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/_70B374C730D1_.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;please help, i need you help.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank you.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regards.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI and BLE integration test</title><link>https://devzone.nordicsemi.com/thread/301820?ContentTypeID=1</link><pubDate>Thu, 25 Mar 2021 08:51:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:633a00c8-c6ed-4b2d-8ab6-3bffaf8ea57e</guid><dc:creator>Kenneth</dc:creator><description>[quote user="Daeho"]I think if there is a delay while receiving data, it can miss the TWI data pulse.[/quote]
&lt;p&gt;That is not possible, all data is clocked from the nRF52832, so no data is lost on TWI. You should be able to zoom in on a scope to check the data of TWI bus, but a logic analyzer is preferred, since it can decode the data directly, else you will need to do it manually by comparing the clock and data line.&lt;/p&gt;
&lt;p&gt;May I ask where and how you have declared the TWI buffers in your code?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI and BLE integration test</title><link>https://devzone.nordicsemi.com/thread/301787?ContentTypeID=1</link><pubDate>Thu, 25 Mar 2021 00:52:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ad71c837-a888-41ab-a6fb-e5875b25c07d</guid><dc:creator>Daeho</dc:creator><description>&lt;p&gt;Thank you for your answer.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Yes, when a BLE delay occurs, it affects the TWI data.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;When the MCU transfers the register to the sensor, data comes in three times in succession from the sensor.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I think if there is a delay while receiving data, it can miss the TWI data pulse.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;And sorry but, we don&amp;#39;t have the logic analyzer.&amp;nbsp;However, with the scope, I was able to check only the continuity of the waveform.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI and BLE integration test</title><link>https://devzone.nordicsemi.com/thread/301748?ContentTypeID=1</link><pubDate>Wed, 24 Mar 2021 15:46:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7b5a0ea6-5070-4079-b459-f4a79e32a85d</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;The BLE will not alter the data on TWI bus, but BLE can introduce delays in the TWI communication, can that be causing problem?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I think having a logic analyzer trace of the TWI bus to check the actual data is a good suggestion for debugging.&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI and BLE integration test</title><link>https://devzone.nordicsemi.com/thread/301717?ContentTypeID=1</link><pubDate>Wed, 24 Mar 2021 14:36:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:de9256e3-85e7-4e82-ba2c-ac30ee33cf88</guid><dc:creator>awneil</dc:creator><description>[quote userid="90626" url="~/f/nordic-q-a/73087/twi-and-ble-integration-test/301690#301690"]Could you possibly know how?[/quote]
&lt;p&gt;Not without more information.&lt;/p&gt;
&lt;p&gt;You need to do some more debugging to find where it&amp;#39;s going wrong.&lt;/p&gt;
&lt;p&gt;As I suggested, look at the I2C bus itself to see if the correct data is actually there; ie, is the data getting lost in your code, or is it getting lost on the hardware link?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI and BLE integration test</title><link>https://devzone.nordicsemi.com/thread/301690?ContentTypeID=1</link><pubDate>Wed, 24 Mar 2021 13:27:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:615edb6e-d536-4ea2-a03e-6c319d032d53</guid><dc:creator>Daeho</dc:creator><description>&lt;p&gt;Currently, TWI organizes data like photos. The BLE softdevice seems to have an effect on receiving data. Could you possibly know how?&lt;/p&gt;
&lt;p&gt;&lt;a href="http://naver.me/xpPrMUgi"&gt;http://naver.me/xpPrMUgi&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI and BLE integration test</title><link>https://devzone.nordicsemi.com/thread/301260?ContentTypeID=1</link><pubDate>Mon, 22 Mar 2021 15:13:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d1d2e14f-ddc3-4dbe-be14-2c3d949b96c7</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;but you also decoded it, and confirmed that the values are correct?&lt;/p&gt;
&lt;p&gt;Remember that we cannot see your scope, or your hardware, or anything else - only what you provide in your posts.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI and BLE integration test</title><link>https://devzone.nordicsemi.com/thread/301225?ContentTypeID=1</link><pubDate>Mon, 22 Mar 2021 13:47:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d86b99e6-d80d-48bb-ace8-1842cfc3e522</guid><dc:creator>Daeho</dc:creator><description>&lt;p&gt;Yes, It was confirmed that the waveform come in clearly without noise on the TWI line.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI and BLE integration test</title><link>https://devzone.nordicsemi.com/thread/301224?ContentTypeID=1</link><pubDate>Mon, 22 Mar 2021 13:41:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cc36ef0a-beca-41f1-a569-e7496fba752e</guid><dc:creator>awneil</dc:creator><description>[quote userid="90626" url="~/f/nordic-q-a/73087/twi-and-ble-integration-test/301198#301198"]When the TWI line is checked using the scope, it is displayed fine[/quote]
&lt;p&gt;So the data is correct on the bus?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI and BLE integration test</title><link>https://devzone.nordicsemi.com/thread/301198?ContentTypeID=1</link><pubDate>Mon, 22 Mar 2021 12:43:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:57d479bb-cf86-4ac9-b065-988d04530fca</guid><dc:creator>Daeho</dc:creator><description>&lt;p&gt;First, thank you for the answer.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I using a&amp;nbsp;P0.14 and&amp;nbsp;P0.15.&lt;/p&gt;
&lt;p&gt;When the TWI line is checked using the scope, it is displayed fine.&lt;/p&gt;
&lt;p&gt;And it works fine without BLE.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;#define TWI_SCL 15&lt;br /&gt;#define TWI_SDA 14&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI and BLE integration test</title><link>https://devzone.nordicsemi.com/thread/301191?ContentTypeID=1</link><pubDate>Mon, 22 Mar 2021 12:33:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aa934ed4-d695-4d3e-bcb1-139b78b34fae</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;So it works fine with no BLE?&lt;/p&gt;
&lt;p&gt;Have you used an analyser or scope to see what&amp;#39;s&amp;nbsp;happening on the TWI lines?&lt;/p&gt;
&lt;p&gt;Which pins are you using?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>