<?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>SPIM &amp;amp; easyDMA: understanding Soft Device interrupts and timing</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/22147/spim-easydma-understanding-soft-device-interrupts-and-timing</link><description>I have another longer question regarding an SPI led driver I’m working with that has some strict timings, but I wanted to ask a more succinct question here since I think I may not be entirely clear on how the EasyDMA works with SPIM and an answer here</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sun, 21 May 2017 09:16:42 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/22147/spim-easydma-understanding-soft-device-interrupts-and-timing" /><item><title>RE: SPIM &amp; easyDMA: understanding Soft Device interrupts and timing</title><link>https://devzone.nordicsemi.com/thread/87040?ContentTypeID=1</link><pubDate>Sun, 21 May 2017 09:16:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3cba997e-970d-43e0-96a0-ceaf3ae010f1</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;Please confirm if a initiated 2 byte transfer has a delay between the two bytes, or if two 2 byte transfers have delay between them. If you want to send 52 bytes just call nrf_drv_spi_transfer() with a pointer to the 52 byte buffer.&lt;/p&gt;
&lt;p&gt;I mean that the entire SPI transfer can be delayed but that with EasyDMA the transfer wont gap once started.&lt;/p&gt;
&lt;p&gt;The SDK version shouldn&amp;#39;t matter, but if you want me to try to reproduce we should have similar setups.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPIM &amp; easyDMA: understanding Soft Device interrupts and timing</title><link>https://devzone.nordicsemi.com/thread/87039?ContentTypeID=1</link><pubDate>Sun, 21 May 2017 01:14:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3094a3c5-52f9-4180-b47a-57ac40c4e2fa</guid><dc:creator>dmf3030</dc:creator><description>&lt;p&gt;• I also do have easy dma enabled in the config and I confirmed it was on via segger for one of the spi instances but for the one in question I couldnt find the driver instance structure during debug, but Ill log its status to double check easy dma is getting enabled.&lt;/p&gt;
&lt;p&gt;• Lastly I realized that I was on SDK 12.1, but today I updated to 12.3, not sure if that should make any difference.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Finally I did sort a work around to all this by wiggling my data a bit and making sure my most important two bytes are always sent as the head of an spi write so they now always seem to go together but it would still be nice to know why Im seeing breaks in my spi write even while supposedly using easy dma.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Ill report back when I get a chance to do some more debugging monday.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPIM &amp; easyDMA: understanding Soft Device interrupts and timing</title><link>https://devzone.nordicsemi.com/thread/87038?ContentTypeID=1</link><pubDate>Sun, 21 May 2017 01:10:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:291eb75d-86ee-4582-95b7-78207ae2a732</guid><dc:creator>dmf3030</dc:creator><description>&lt;p&gt;Thank you for the reply and information, Ill grab a full logic capture Monday. To a few of your points:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The two byte transfer I saw interrupted was when I moved to sending all 52 bytes in two byte packets with the spi_handler setting up the next transfer after each was done.  I saw all the data go over in nice tight two byte packets until very rarely those two bytes had extra time between them.  I assumed that maybe I was sending too fast for the spi call to fill the double buffer but Im not sure if thats possible. This might be harder to grab a logic capture for since it was rare and I moved away from that solution.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;• When you say the SPI interrupt can be delayed do you mean the interrupt that sends the next byte thus causing more time between bytes occasionally or do you mean the entire spi transfer can be delayed but that with easydma the transfer wont gap once started?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPIM &amp; easyDMA: understanding Soft Device interrupts and timing</title><link>https://devzone.nordicsemi.com/thread/87037?ContentTypeID=1</link><pubDate>Sat, 20 May 2017 18:12:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e6c618e1-5304-4777-948b-e455f301c896</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;blockquote&gt;
&lt;p&gt;Ive been told this is exactly what
EasyDMA does, schedules a transfer
that won’t be interrupted up to 255
bytes. I’ve tried with EasyDMA enabled
though and I still occasionally see
the clock hang for close to 30us.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;An initiated transfer shouldn&amp;#39;t be interrupted, but the SPI interrupt can be delayed if the SoftDevice is active in a higher interrupt context. The SoftDevice can also interrupt the initiation of the next transfer.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;I also tried sending only two bytes at
a time using the
nrf_drv_spi_transfer() method and then
sending the next pair of bytes when I
get the return event. This seemed to
work great since the first two bytes
sent together because of the double
buffer, but then on the rare occasion
I would see the bytes split again by
10us+&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Sounds like you are saying that you are interrupted in a middle of a 2 byte transfer, that shouldn&amp;#39;t happen.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Question: Would moving these transfers
to the main context either via a flag
or the app scheduler prevent the soft
device from breaking in?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Main context has the lowest priority, so that wouldn&amp;#39;t protect you against interrupts at all.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Question: Is there simply no way to
guarantee the soft device won’t break
in, even for as little as two bytes?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;An initiated 2 byte transfer shouldn&amp;#39;t be interrupted.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Question: if this should be working
via EasyDMA, can someone point me to a
clear way to test if easyDMA is
enabled (I’m in segger embedded) but a
simple way to check the DMA status at
runtime and log it works too!&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;You can check the use_easy_dma in the driver instance:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;typedef struct
{
    void *    p_registers;  ///&amp;lt; Pointer to the structure with SPI/SPIM peripheral instance registers.
    IRQn_Type irq;          ///&amp;lt; SPI/SPIM peripheral instance IRQ number.
    uint8_t   drv_inst_idx; ///&amp;lt; Driver instance index.
    bool      use_easy_dma; ///&amp;lt; True if the peripheral with EasyDMA (SPIM) shall be used.
} nrf_drv_spi_t;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You should have the following in sdk_config.h&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#ifndef SPI0_ENABLED
#define SPI0_ENABLED 1
#endif
#if  SPI0_ENABLED
// &amp;lt;q&amp;gt; SPI0_USE_EASY_DMA  - Use EasyDMA
 

#ifndef SPI0_USE_EASY_DMA
#define SPI0_USE_EASY_DMA 1
#endif
&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;-I&amp;#39;ve attached a logic capture showing the breaks though prob not necessary
since this is ideally cut and dry and
I can either reliable block the soft
device or I can&amp;#39;t, hopefully a nordic
employee can put this to rest
relatively easily. !&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Can you please attach the actual capture (not picture) so I can look at it?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>