<?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>nrf_drv_spi_xfer, descriptor, pointers</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/60171/nrf_drv_spi_xfer-descriptor-pointers</link><description>I want to send packets of 16 bit data over SPI at regular periods from a buffer. I&amp;#39;d appreciate a bit of clarification how to use the SPI xfer function (I already have the timer &amp;amp; PPI set up). 
 Code snippet below, I have a couple of questions: 
 1. How</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 20 Apr 2020 14:13:57 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/60171/nrf_drv_spi_xfer-descriptor-pointers" /><item><title>RE: nrf_drv_spi_xfer, descriptor, pointers</title><link>https://devzone.nordicsemi.com/thread/245592?ContentTypeID=1</link><pubDate>Mon, 20 Apr 2020 14:13:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9adbf107-6c92-4e9e-98ed-ba2cdce03917</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Great!&lt;br /&gt;As I said, you may well still use the nrf_drv_* functions, but they are legacy and just forwarding macros to the nrfx drivers.&lt;/p&gt;
[quote user="Nick_RA"]I&amp;#39;ll raise a separate ticket(s) if I need to.[/quote]
&lt;p&gt;Absolutely, please do.&lt;br /&gt;&lt;br /&gt;Let me know if you encounter any other issues or questions in the future!&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_drv_spi_xfer, descriptor, pointers</title><link>https://devzone.nordicsemi.com/thread/245483?ContentTypeID=1</link><pubDate>Mon, 20 Apr 2020 10:14:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0ff5dcfe-18b6-4ea3-a9bc-082df0e4e0cc</guid><dc:creator>Nick_RA</dc:creator><description>&lt;p&gt;Yes thanks. I&amp;#39;m not going to try it just yet as I&amp;#39;ve started the process of re-writing my application with nrfx drivers - which has caused its own headaches - but I&amp;#39;ll raise a separate ticket(s) if I need to.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_drv_spi_xfer, descriptor, pointers</title><link>https://devzone.nordicsemi.com/thread/245255?ContentTypeID=1</link><pubDate>Fri, 17 Apr 2020 13:39:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:485e28ca-b8fc-4d15-b56c-d34ff1e94cbf</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hi Nick,&lt;br /&gt;&lt;br /&gt;Yes, the list feature is useful when requiring the least possible CPU inference between transfers - using arraylist allows you to allocate a long buffer to be used in the repeated transfers triggered by PPI, without requiring CPU interference.&lt;br /&gt;But as you state, you may very well just use uint8_t arrays instead, as long as they are in the easyDMA region.&lt;br /&gt;&lt;br /&gt;Does this answer your questions?&lt;br /&gt;&lt;br /&gt;Feel free to come back if you should encounter any more issues or questions in the future! :)&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_drv_spi_xfer, descriptor, pointers</title><link>https://devzone.nordicsemi.com/thread/244881?ContentTypeID=1</link><pubDate>Thu, 16 Apr 2020 07:57:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b7b7a059-9ae9-4b21-87fe-676169d29f32</guid><dc:creator>Nick_RA</dc:creator><description>&lt;p&gt;IHi&lt;/p&gt;
&lt;p&gt;&amp;#39;m using the nRF52 DK currently, which is hooked up to a SD card adapter and 2-channel DAC both by SPI.&lt;/p&gt;
&lt;p&gt;Yes, I need to fire the SPI from the timer hence the PPI. I&amp;#39;ve already got the timer and PPI working, currently it&amp;#39;s just toggling a gpio so the next progression is to move tfrom a gpio to a SPI task.&lt;/p&gt;
&lt;p&gt;The 52832 docs differ from the 52840 docs,&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.nrf52832.ps.v1.1%2Fspim.html&amp;amp;cp=2_1_0_30_1_0&amp;amp;anchor=topic"&gt;this&lt;/a&gt;&amp;nbsp;is what I was reading&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;EasyDMA list&lt;br /&gt;EasyDMA supports one list type.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;The supported list type is:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Array list&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;..which infers that one MUST use a list, and that&amp;#39;s the only reason I was. Quite happy to use a simple byte array!&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Nick&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_drv_spi_xfer, descriptor, pointers</title><link>https://devzone.nordicsemi.com/thread/244871?ContentTypeID=1</link><pubDate>Thu, 16 Apr 2020 07:37:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:34a8d6fa-ed55-4dae-ad6e-afc9a74b6f24</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello again,&lt;/p&gt;
[quote user="Nick_RA"]OK firstly as to which libraries - I&amp;#39;m just picking up bits &amp;amp; pieces from the web and examples (many of the SDK examples seem to use the old libraries) in order to get a proof of concept working.[/quote]
&lt;p&gt;I understand. This is correct, many of the examples use the nrf_drv_* - which is still fully functional -&amp;nbsp; but for new developments we recommend going with the nrfx_* right off the bat, to make future development and maintenance easier.&lt;/p&gt;
[quote user="Nick_RA"]Regarding the buffer type, I need to use PPI to send the buffer with a timer event &amp;amp; SPI task and was going by&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/13523/ppi-to-spim-task-how-to"&gt;this article&lt;/a&gt;&amp;nbsp;hence using EasyDMA as per the article (and according to EasyDMA docs&amp;nbsp;&lt;span&gt;ArrayList_type is the only data type supported).&lt;/span&gt;[/quote]
&lt;p&gt;Are you working on a Development kit? If so, is it the nRF52 DK, or the nRF52840 DK?&lt;br /&gt;Are you here referring to the array list section of the&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fps_nrf52840%2Feasydma.html"&gt;easyDMA documentation&lt;/a&gt;?&lt;/p&gt;
[quote user="Nick_RA"]This by the way will be with a Softdevice running and an active GATT connection which is why I opted for DMA to keep CPU overhead down.&amp;nbsp;[/quote]
&lt;p&gt;Yes, using easyDMA is a great strength when using peripherals such as SPIM in combination with the SoftDevice and other CPU tasks.&lt;/p&gt;
[quote user="Nick_RA"]So I presume it can be done from the article I linked?[/quote]
&lt;p&gt;Yes, you may very well connect a peripheral to a timer/other peripheral using PPI. Do I understand you correctly that you would like the SPIM transfer to happen at a given interval?&lt;br /&gt;As Kenneth mentions in the DevZone ticket you linked to, the saadc example demonstrates how to set up a peripheral(the SAADC in this case) with PPI, and link the PPI to a given timer.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
[quote user="Nick_RA"] I&amp;#39;m pretty impressed with this device even if getting to grips with the libraries can be a little daunting[/quote]
&lt;p&gt;Thanks, I am glad to hear you are impressed with our product! &lt;br /&gt;You are right that there is a small threshold to get to know all the different libraries and functionality, but feel free to ask around here on DevZone with any questions or issues you might encounter.&lt;br /&gt;We are happy to help! :)&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_drv_spi_xfer, descriptor, pointers</title><link>https://devzone.nordicsemi.com/thread/244801?ContentTypeID=1</link><pubDate>Wed, 15 Apr 2020 16:35:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c6eeda41-554b-4d51-8709-283b2d180e0f</guid><dc:creator>Nick_RA</dc:creator><description>&lt;p&gt;OK firstly as to which libraries - I&amp;#39;m just picking up bits &amp;amp; pieces from the web and examples (many of the SDK examples seem to use the old libraries) in order to get a proof of concept working.&lt;/p&gt;
&lt;p&gt;Regarding the buffer type, I need to use PPI to send the buffer with a timer event &amp;amp; SPI task and was going by&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/13523/ppi-to-spim-task-how-to"&gt;this article&lt;/a&gt;&amp;nbsp;hence using EasyDMA as per the article (and according to EasyDMA docs&amp;nbsp;&lt;span&gt;ArrayList_type is the only data type supported). &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;I&amp;#39;m not even sure if I need EasyDMA... the job here is to write out 16 bits at a time from a buffer at a rate of 44100 per sec which as you can probably guess is for playing audio. &lt;/span&gt;&lt;span&gt;This by the way will be with a Softdevice running and an active GATT connection which is why I opted for DMA to keep CPU overhead down.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;So I presume it can be done from the article I linked? If so I&amp;#39;m pretty impressed with this device even if getting to grips with the libraries can be a little daunting&amp;nbsp;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f615.svg" title="Confused"&gt;&amp;#x1f615;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_drv_spi_xfer, descriptor, pointers</title><link>https://devzone.nordicsemi.com/thread/244789?ContentTypeID=1</link><pubDate>Wed, 15 Apr 2020 15:25:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fbc209bf-001e-4272-9581-22026cb542c0</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
[quote user=""]1. How to set the pointer in the descriptor? I get an &amp;quot;incompatible pointer type&amp;quot; warning (this may be my inexperience with &amp;#39;C&amp;#39; showing)[/quote]
&lt;p&gt;&amp;nbsp;As you can see in the &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/structnrf__drv__spi__xfer__desc__t.html"&gt;nrf_drv_spi_xfer_desc_t documentation&lt;/a&gt;&amp;nbsp;the pointer to tx buffer must be a unint8_t type pointer. You are providing a pointer to a ArrayList_type struct. You could set the buffer as demonstrated in the SPI example:&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;..

#define SPI_INSTANCE  0 /**&amp;lt; SPI instance index. */
static const nrf_drv_spi_t spi = NRF_DRV_SPI_INSTANCE(SPI_INSTANCE);  /**&amp;lt; SPI instance. */

..

#define TEST_STRING &amp;quot;Nordic&amp;quot;
static uint8_t       m_tx_buf[] = TEST_STRING;           /**&amp;lt; TX buffer. */
static uint8_t       m_rx_buf[sizeof(TEST_STRING) + 1];    /**&amp;lt; RX buffer. */
static const uint8_t m_length = sizeof(m_tx_buf);        /**&amp;lt; Transfer length. */

..

    nrf_drv_spi_transfer(&amp;amp;spi, m_tx_buf, m_length, m_rx_buf, m_length);

..&lt;/pre&gt;&lt;/p&gt;
[quote user=""]2. What to do with the RX values when the application is transmit only? Leave blank, or set up a dummy receive buffer?[/quote]
&lt;p&gt;Just supply a dummy buffer. If the slave is not sending anything, it will remain empty.&lt;br /&gt;&lt;br /&gt;As a side note, I notice that you are using the nrf_drv, which is deprecated, and would suggest that you instead move to use the SPIM or SPIS driver - if this is not done for a particular reason? the nrf_drv drivers are fully functional, but will be discontinued in future(not immediate) SDK releases, so using the nrfx_ drivers will be easier to maintain.&lt;br /&gt;&lt;br /&gt;For further detail you should see the &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/group__nrfx__spim.html"&gt;SPIM API Reference&lt;/a&gt;.&lt;br /&gt;Additionally, I can also recommend you to have a look at the &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/nrfx_spim_example.html"&gt;SPIM&lt;/a&gt; and &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/spi_slave_example.html"&gt;SPIS&lt;/a&gt; examples.&lt;br /&gt;&lt;br /&gt;Let me know if you should encounter any more issues or questions in the future!&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>