<?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>TWIM 1 Timeslot no interrupt</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/89260/twim-1-timeslot-no-interrupt</link><description>Hi, 
 As i2c communication + computation takes 45ms in my timer interrupt that happen each 100ms and gave issue with SD, I decided to set a flag in the interrupt and execute sensors operation in the main loop. 
 It works but...it was estonishing slow</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 11 Jul 2022 06:53:45 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/89260/twim-1-timeslot-no-interrupt" /><item><title>RE: TWIM 1 Timeslot no interrupt</title><link>https://devzone.nordicsemi.com/thread/376326?ContentTypeID=1</link><pubDate>Mon, 11 Jul 2022 06:53:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:389b4be0-712e-4499-9832-5e02847b231a</guid><dc:creator>Olfox</dc:creator><description>&lt;p&gt;HI Sigurd,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I figure out that the problem of periodic interrupt and clapping to 490ms was coming from my sensor refresh rate. No w it workd properly without scheduling or timeslot.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m a bit disapointted to not have succed in using twim with timelot but i don&amp;#39;t need it anymore.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks for your help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWIM 1 Timeslot no interrupt</title><link>https://devzone.nordicsemi.com/thread/375220?ContentTypeID=1</link><pubDate>Sun, 03 Jul 2022 15:35:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:90ee2f7c-2340-4240-806d-e89ed85a06be</guid><dc:creator>Olfox</dc:creator><description>[quote userid="15146" url="~/f/nordic-q-a/89260/twim-1-timeslot-no-interrupt/375081"]Are you reading 1 and 1 byte?[/quote]
&lt;p&gt;No i&amp;#39;m using Easy DMA with TWIM1 . Here is the function i&amp;#39;m using:&lt;/p&gt;
&lt;p&gt;As it is 16bit register , i need to switch msb and lsb by using a for loop at the end of the function.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;ret_code_t I2CRead(uint8_t slaveAddr, uint16_t startAddress, uint16_t nMemAddressRead, uint16_t *data){

    ret_code_t err_code; 
    uint8_t addr[2] = {0,0};
    uint16_t lsb,msb;

    addr[0] = startAddress &amp;gt;&amp;gt; 8;       //msb first
    addr[1] = startAddress &amp;amp; 0x00FF;   //lsb first


    const nrfx_twim_xfer_desc_t    my_xfer   =    {.type = NRFX_TWIM_XFER_TXRX,
                                                    .address=slaveAddr,
                                                    .primary_length   = 2,
                                                    .secondary_length = (nMemAddressRead&amp;lt;&amp;lt;1),
                                                    .p_primary_buf    = &amp;amp;addr,
                                                    .p_secondary_buf  = data
                                                  };

    err_code = nrfx_twim_xfer(&amp;amp;my_twi, &amp;amp;my_xfer ,0);
    APP_ERROR_CHECK(err_code);


    while(nrfx_twim_is_busy(&amp;amp;my_twi)){;}

    for(int i=0; i &amp;lt; nMemAddressRead; i++){

        lsb = (data[i]&amp;amp;0xff00) &amp;gt;&amp;gt; 8;
        msb=  data[i] &amp;amp;  0xff;
        data[i] = (msb&amp;lt;&amp;lt;8) | lsb;
    }

    return err_code;
  
} &lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="15146" url="~/f/nordic-q-a/89260/twim-1-timeslot-no-interrupt/375081"]Are you in a connection when doing this test?[/quote]
&lt;p&gt;Yes i&amp;#39;m connected when i read the sensor for sure.&lt;/p&gt;
[quote userid="15146" url="~/f/nordic-q-a/89260/twim-1-timeslot-no-interrupt/375081"]Have you tried increasing the connection interval?[/quote]
&lt;p&gt;Yes here is my settings. But is doesn&amp;#39;t impact the 184us periodic interval i see on scope. But i se impact on power consumption with PPK.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define MIN_CONN_INTERVAL MSEC_TO_UNITS(100, UNIT_1_25_MS) /**&amp;lt; Minimum acceptable connection interval (0.1 seconds). */
#define MAX_CONN_INTERVAL MSEC_TO_UNITS(200, UNIT_1_25_MS) /**&amp;lt; Maximum acceptable connection interval (0.2 second). */&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Remember,&amp;nbsp;when i do this communication at the entry point of the program, just after main ( first operation) it&amp;nbsp;takes only 45ms for this test.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;So from what this periodic interrupt can comes from?&lt;/p&gt;
&lt;p&gt;And did you already succed in using timeslot with twim please ?&lt;/p&gt;
&lt;p&gt;As tried scheduler but it doesn&amp;#39;t bring any advantages compared to execute in timer handler.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m losing a bit hope at the moment i hope you will have answer to this issue.&lt;/p&gt;
&lt;p&gt;Thanks a lot&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWIM 1 Timeslot no interrupt</title><link>https://devzone.nordicsemi.com/thread/375081?ContentTypeID=1</link><pubDate>Fri, 01 Jul 2022 11:59:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e042a252-e83a-4e68-b546-81c7bce39dc0</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;1)&lt;/p&gt;
&lt;p&gt;Are you reading 1 and 1 byte?&lt;/p&gt;
&lt;p&gt;The TWIM peripheral have EasyDMA,&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fps_nrf52833%2Ftwim.html"&gt;https://infocenter.nordicsemi.com/index.jsp?topic=%2Fps_nrf52833%2Ftwim.html&lt;/a&gt;&amp;nbsp;so you can&amp;nbsp;transfer&amp;nbsp;multiple bytes without CPU involvement.&lt;/p&gt;
&lt;p&gt;2)&lt;/p&gt;
[quote user=""]I guess Soft Device (s113 in my case) take this time. For example, communication that should take 13ms when no sd is running ( on the 45ms in total for my sensors tasks, rest is big float computation) takes 350ms ! 26 times the time it should ![/quote]
&lt;p&gt;Are you in a connection when doing this test? Have you tried increasing the connection interval? Even as a BLE peripheral, you can request a higher connection interval. If you are&amp;nbsp;advertising, try&amp;nbsp;temporarily disabling the adverting.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWIM 1 Timeslot no interrupt</title><link>https://devzone.nordicsemi.com/thread/374246?ContentTypeID=1</link><pubDate>Sun, 26 Jun 2022 15:50:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b80528d0-e93d-4c5c-9a9b-33c91383f825</guid><dc:creator>Olfox</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I finally tried the scheduler without improvement.&lt;/p&gt;
&lt;p&gt;So i decided to check with the scope what happens during transmision when it is done into the main, but i it is the same effect in interrupt app timer handler.&lt;/p&gt;
&lt;p&gt;It seems twim communication is interrupted each 184us, during 34us and sometime even more.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;So iguess timeslot is the own solution.&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/com-twim-interompu-chaque-184us-pr-qqch-exterieur.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWIM 1 Timeslot no interrupt</title><link>https://devzone.nordicsemi.com/thread/374074?ContentTypeID=1</link><pubDate>Fri, 24 Jun 2022 08:42:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c915dffd-302b-4259-bcbc-eba5d4728729</guid><dc:creator>Olfox</dc:creator><description>&lt;p&gt;Hi Sigurd,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I found the Einard tutorial concerning scheduler here:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/guides/short-range-guides/b/software-development-kit/posts/scheduler-tutorial"&gt;nRF5 SDK Scheduler Tutorial&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It confirms what i understood previouly but doesn&amp;#39;t help me to&amp;nbsp;undestand why i will be able to not be interrupted during my 45s sensor task (by SD i guess)&lt;/p&gt;
&lt;p&gt;Even with scheduler, i don&amp;#39;t see how it will avoid to increase my sensors task time from 45ms to 490ms.&lt;/p&gt;
&lt;p&gt;A part of timeslot i don&amp;#39;t see any other way in fact a the moment. May be&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/members/einarh"&gt;Einarh&lt;/a&gt;&amp;nbsp; have good argument too :D ?&lt;/p&gt;
&lt;p&gt;Thanks a for your help&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWIM 1 Timeslot no interrupt</title><link>https://devzone.nordicsemi.com/thread/373981?ContentTypeID=1</link><pubDate>Thu, 23 Jun 2022 14:13:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1fd5b804-fb80-4489-8462-2acea03e13b9</guid><dc:creator>Olfox</dc:creator><description>&lt;p&gt;Hi Sigurd,&lt;/p&gt;
[quote userid="15146" url="~/f/nordic-q-a/89260/twim-1-timeslot-no-interrupt/373957"]1) What issue with the SD are you getting? Could you elaborate on that.[/quote]
&lt;p&gt;I mean i had issue because the 45ms it should take was also taking too long in the interrupt timer and i&amp;#39;m not able to read caracteristic sometimes, program is stuck&lt;/p&gt;
[quote userid="15146" url="~/f/nordic-q-a/89260/twim-1-timeslot-no-interrupt/373957"]2) Did you try using the scheduler as suggest by Einar Thorsrud in your other post?&amp;nbsp;[/quote]
&lt;p&gt;To be honnest i look at it, but i was not convinced it would help more than the first proposal Einar did ( jut set a flag into the timer interrupt and check it into main() ). It looks complex compared than just a flag set and clear once done.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;By studying the link you gave, i don&amp;#39;t really see added value to the scheduler ( may be i don&amp;#39;t see benefit because a lack of knowledge). So to deeply understand i compared both method but even with that, i don&amp;#39;t clearly see how scheduler will avoid SD to take the lead.&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/pastedimage1655992259513v1.png" /&gt;&lt;/p&gt;
&lt;p&gt;A part of adding the orange time, what is the benefit on timing or how it could help with my issue ?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;3) Also, why timeslot is not the most appropriate solution compared to scheduler for example? I have the feeling to do something really complex, but it is just communicate with a sensor and to be able to get a ble carac updated each max 100ms with my sensor data. Is it a special complex case ? I guess it is a common customer need no ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;May be timeslot is overkill in this case. I will be really happy to understand and being convinced that scheduler will help, can you guide me a bit more in detail on how to properly proceed in the big line please . I will start to learn about it on devzone because infocenter documentation is a bit light on this subject.&lt;/p&gt;
&lt;p&gt;Thank a lot Sigurd for your help i hope to have this working really really soon.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWIM 1 Timeslot no interrupt</title><link>https://devzone.nordicsemi.com/thread/373957?ContentTypeID=1</link><pubDate>Thu, 23 Jun 2022 13:15:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:46f30d8c-3293-4492-af69-3a8c51cc0a2e</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="Olfox"]&lt;p&gt;Then how to proceed to be able to communicate with my i2c sensors during timeslot?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;[/quote]
&lt;p&gt;I don&amp;#39;t think timeslot is suited for&amp;nbsp;the issue you are trying to solve here.&lt;/p&gt;
[quote user=""]As i2c communication + computation takes 45ms in my timer interrupt that happen each 100ms and gave issue with SD[/quote]
&lt;p&gt;1) What issue with the SD are you getting? Could you elaborate on that.&lt;/p&gt;
&lt;p&gt;2) Did you try using the scheduler as suggest by Einar Thorsrud in your other post?&amp;nbsp;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/89172/communicate-with-sensor-in-timer-interrupt-occurs-issue"&gt;Communicate with sensor in timer interrupt occurs issue&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWIM 1 Timeslot no interrupt</title><link>https://devzone.nordicsemi.com/thread/373878?ContentTypeID=1</link><pubDate>Thu, 23 Jun 2022 09:18:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0851f5f1-7152-4f0a-922d-9df047c84d6e</guid><dc:creator>Olfox</dc:creator><description>&lt;p&gt;I tried to set interrupt from 2 to 0 but it is the same, still blocked on the while.&lt;/p&gt;
&lt;p&gt;But i can see all the byte on twim line on my scope so the hardware/twim send fucntion works properly when called in the timeslot).&lt;/p&gt;
&lt;p&gt;It is just the interrupt that seems to be not autorized.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;i can confirm that by mentionning the soft device specification:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:204px;max-width:554px;" height="204" src="https://devzone.nordicsemi.com/resized-image/__size/1108x408/__key/communityserver-discussions-components-files/4/pastedimage1655976252885v1.png" width="554" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Then how to proceed to be able to communicate with my i2c sensors during timeslot?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I tried to replace while ( is busy) that wait for interuption by nrf(delay) even it is dirty, without succes yet. It is not really a solution but ...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>