<?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>NRF52 SPIM - send data as two byte pairs instead of one byte per interrupt</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/22139/nrf52-spim---send-data-as-two-byte-pairs-instead-of-one-byte-per-interrupt</link><description>I have an SPI peripheral that has an odd protocol and in trying to sort out why it was acting up I finally caught a logic trace showing about a 13us break in the SPI data I was sending. Normally this wouldn’t be an issue but this peripheral has a clock</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 20 May 2017 18:14:16 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/22139/nrf52-spim---send-data-as-two-byte-pairs-instead-of-one-byte-per-interrupt" /><item><title>RE: NRF52 SPIM - send data as two byte pairs instead of one byte per interrupt</title><link>https://devzone.nordicsemi.com/thread/87002?ContentTypeID=1</link><pubDate>Sat, 20 May 2017 18:14:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:28eff2ab-f036-4d9a-a3bd-91fd125bc839</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;Please confirm that an initiated 2 byte transfer is interrupted in the middle. Please include the actual capture (not picture). Please include how you are calling nrf_drv_spi_transfer() and what your spi_event_handler() looks like. If you do another capture, please also include the chip select signal.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52 SPIM - send data as two byte pairs instead of one byte per interrupt</title><link>https://devzone.nordicsemi.com/thread/87001?ContentTypeID=1</link><pubDate>Thu, 18 May 2017 16:20:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2c895a79-71fd-4a88-bed6-f9a252fadcaa</guid><dc:creator>dmf3030</dc:creator><description>&lt;p&gt;Im on the SDK12.2, the code has alot going on right now and needs a clean down.  Ill try to pull all the pertinent parts to link for testing.  My most recent and most reliable solution is to send 26 byte chunks which causes the first two bytes, which are the most sensitive command bytes to seemingly always send together, while the later bytes can sometimes have extra time between but that is not a total deal breaker.&lt;/p&gt;
&lt;p&gt;I posted in another question, but I guess the main question is whether you can block the soft device or any other interrupt from breaking in to a spim transfer reliably either with easyDMA or using the scheduler to put the transfer in main.  Im finding it hard to find true documentation on how the easyDMA should function and if it is supposed to be an uninterrupted transfer.  Also I&amp;#39;m not reading bytes back on the SPI, only sending if that gives me more options.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52 SPIM - send data as two byte pairs instead of one byte per interrupt</title><link>https://devzone.nordicsemi.com/thread/87005?ContentTypeID=1</link><pubDate>Thu, 18 May 2017 13:12:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ae97f1f2-b5c7-4564-94c9-76ed55c7fcf7</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;Strange. What SDK are you using? Could you share your complete code so I can test it here?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52 SPIM - send data as two byte pairs instead of one byte per interrupt</title><link>https://devzone.nordicsemi.com/thread/87004?ContentTypeID=1</link><pubDate>Wed, 17 May 2017 20:16:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d0204b7c-7117-4c0c-908a-edff3c8a448f</guid><dc:creator>dmf3030</dc:creator><description>&lt;p&gt;So the next thing I tried was  to break all my writes up into non blocking two byte transfers. I used the spi event handler to step to the next two bytes of my data each time around and then when finished I pushed my latch.  I know this adds overhead to each transfer but as I said I dont have a problem unless the extra time is before a one bit and this two byte quick send was meant to stop that since I knew every first byte was all zeros.  On the scope I was seeing two byte packets, fixing the flicker, but after watching  I did every so often see the odd flicker.  When I really stepped through some probed data I found that rarely my two byte packets were being split once again into single byte sends with an extra delay between which broke the data.&lt;/p&gt;
&lt;p&gt;So this is a hack but is there a reason that two byte packet got broken up, am I writing too fast for the double buffer to fill?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52 SPIM - send data as two byte pairs instead of one byte per interrupt</title><link>https://devzone.nordicsemi.com/thread/87003?ContentTypeID=1</link><pubDate>Wed, 17 May 2017 20:07:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2ed34197-ba26-4f45-abb1-6d0bb5baead7</guid><dc:creator>dmf3030</dc:creator><description>&lt;p&gt;Okay so here is the update.  First thing I did was enable EasyDMA in the config, I&amp;#39;m actually surprised it wasn&amp;#39;t already enabled.  Previously I was sending my data in blocking mode with no event handler so I just tried again with EasyDMA enabled and still was getting breaks in my SPI data.  This is an LED driver so the results of the breaks can be seen as the occasional slight flicker as the first bit of a brightness register gets lost.  I&amp;#39;ve attached a screenshot of the logic probe showing a data transfer with two gaps.  The data may be slightly confusing because it shows the original data and clock from the NRF and then the retimed cascading data and clock from two more driver chips.  So so far the EASYDMA doesn&amp;#39;t seem to block the Soft device from jumping in unless I&amp;#39;ve implemented it wrong.
&lt;a href="http://imgur.com/a/J0aUL"&gt;logic probe screencaps&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52 SPIM - send data as two byte pairs instead of one byte per interrupt</title><link>https://devzone.nordicsemi.com/thread/87000?ContentTypeID=1</link><pubDate>Wed, 17 May 2017 17:30:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:49e6f601-7a26-488c-a3fd-4092b308e302</guid><dc:creator>dmf3030</dc:creator><description>&lt;p&gt;Definitely on an NRF52, but didnt know the EasyDMA blocked interrupts.  Hopefully thats the quick fix I need, I&amp;#39;ll report back and close this if it works.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52 SPIM - send data as two byte pairs instead of one byte per interrupt</title><link>https://devzone.nordicsemi.com/thread/86999?ContentTypeID=1</link><pubDate>Wed, 17 May 2017 16:59:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:922dee0e-fe1d-470d-ae22-88283aa80d5f</guid><dc:creator>Turbo J</dc:creator><description>&lt;p&gt;Are you really on a NRF52x? Why don&amp;#39;t you just use the SPIM with EasyDMA? Allows up to 255 bytes without any interrupt in between.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>