<?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>Question about SPI transaction manager</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/27484/question-about-spi-transaction-manager</link><description>Hello, 
 Some problems I meet when I try to use spi manager in ble_template example to read &amp;quot;who_am_i&amp;quot; register of LIS2DH12. The environment is set as below: 
 
 
 nRF52832 DevelopKit with SDK 14.1.0, ble_app_template project. 
 
 
 Connect the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 23 Nov 2017 08:15:11 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/27484/question-about-spi-transaction-manager" /><item><title>RE: Question about SPI transaction manager</title><link>https://devzone.nordicsemi.com/thread/108559?ContentTypeID=1</link><pubDate>Thu, 23 Nov 2017 08:15:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ed58f288-122f-4460-880c-1017f05dc130</guid><dc:creator>Daniel</dc:creator><description>&lt;p&gt;It&amp;#39;s clear! Thank you, Jakub! Appreciated!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Question about SPI transaction manager</title><link>https://devzone.nordicsemi.com/thread/108561?ContentTypeID=1</link><pubDate>Thu, 23 Nov 2017 08:07:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9c44738c-8a65-4cdb-819d-f039cb875128</guid><dc:creator>Jakub Rzeszutko</dc:creator><description>&lt;p&gt;You can always use it.
This macro is changed to &amp;quot;const&amp;quot; if you &lt;strong&gt;are not&lt;/strong&gt; using EasyDMA or it is empty if you &lt;strong&gt;are&lt;/strong&gt; using EasyDMA.&lt;/p&gt;
&lt;p&gt;Here is definition:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#ifndef NRF_SPI_MNGR_BUFFERS_IN_RAM
  #define NRF_SPI_MNGR_BUFFERS_IN_RAM defined(SPIM_PRESENT)  // SPIM_PRESENT == EasyDMA present
#endif

#if NRF_SPI_MNGR_BUFFERS_IN_RAM
  #define NRF_SPI_MNGR_BUFFER_LOC_IND
#else
  #define NRF_SPI_MNGR_BUFFER_LOC_IND const
#endif
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Question about SPI transaction manager</title><link>https://devzone.nordicsemi.com/thread/108560?ContentTypeID=1</link><pubDate>Thu, 23 Nov 2017 08:00:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c99c21a8-9311-4bd9-a009-5891b80ac963</guid><dc:creator>Daniel</dc:creator><description>&lt;p&gt;Thanks! It works! Another question is, there are some prefix declarations in the st7565LCD.c file, like&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static NRF_SPI_MNGR_BUFFER_LOC_IND uint8_t m_command_buffer[]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So what is the NRF_SPI_MNGR_BUFFER_LOC_IND? And when should we use that?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Question about SPI transaction manager</title><link>https://devzone.nordicsemi.com/thread/108558?ContentTypeID=1</link><pubDate>Thu, 23 Nov 2017 07:47:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a0aa9b90-9ef3-420f-b874-308a429acf1e</guid><dc:creator>Jakub Rzeszutko</dc:creator><description>&lt;p&gt;As I suspected problem was with data location. When you are using function nrf_spi_mngr_schedule you need to:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Always ensure that data will not change after leaving function &lt;strong&gt;nrf_spi_mngr_schedule&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Ensure that data is in RAM area when you are using EasyDMA mode.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You need to correct your main file.
Change:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static void read_accl_info(void)
{
    ret_code_t ret_val;
    uint8_t tx_cmd[] = {0x8F, 0xFF};

    nrf_spi_mngr_transfer_t transfer = 
        NRF_SPI_MNGR_TRANSFER(tx_cmd, sizeof(tx_cmd), rx_data, sizeof(rx_data));

    nrf_spi_mngr_transaction_t trans = 
    {
        .begin_callback      = accl_spi_transfer_begin_cb,
        .end_callback        = accl_spi_transfer_done_cb,
        .p_user_data         = NULL,
        .p_transfers         = &amp;amp;transfer,
        .number_of_transfers = 1,
        .p_required_spi_cfg  = NULL
    };

    ret_val = nrf_spi_mngr_schedule(&amp;amp;m_nrf_spi_mngr, &amp;amp;trans);
    APP_ERROR_CHECK(ret_val);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;uint8_t m_tx_cmd[] = {0x8F, 0xFF};  // global variable to initialize static variable: transfer

static void read_accl_info(void)
{
    ret_code_t ret_val;

    // static - data in RAM and it will not change during transfer
    static nrf_spi_mngr_transfer_t transfer = 
        NRF_SPI_MNGR_TRANSFER(m_tx_cmd, sizeof(m_tx_cmd), rx_data, sizeof(rx_data));

    static nrf_spi_mngr_transaction_t const trans = 
    {
        .begin_callback      = accl_spi_transfer_begin_cb,
        .end_callback        = accl_spi_transfer_done_cb,
        .p_user_data         = NULL,
        .p_transfers         = &amp;amp;transfer,
        .number_of_transfers = 1,
        .p_required_spi_cfg  = NULL
    };

    ret_val = nrf_spi_mngr_schedule(&amp;amp;m_nrf_spi_mngr, &amp;amp;trans);
    APP_ERROR_CHECK(ret_val);
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Question about SPI transaction manager</title><link>https://devzone.nordicsemi.com/thread/108557?ContentTypeID=1</link><pubDate>Thu, 23 Nov 2017 07:26:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cde0530d-8a3c-4ebb-bb7a-905a6e759bd7</guid><dc:creator>Daniel</dc:creator><description>&lt;p&gt;Hi Jakub, I upload my main.c at the end of the question. Just copy /examples/peripheral/spi_master_using_nrf_spi_mngr project and replace the main.c file in the folder. Only a few changes to the original project main.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Question about SPI transaction manager</title><link>https://devzone.nordicsemi.com/thread/108556?ContentTypeID=1</link><pubDate>Thu, 23 Nov 2017 07:02:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ce2c9015-bb57-4899-96fe-c9982f7140a7</guid><dc:creator>Jakub Rzeszutko</dc:creator><description>&lt;p&gt;It is hard to guess. Please maybe share a source how you use this nrf_pwr_mgmt_run function.&lt;/p&gt;
&lt;p&gt;Regarding your first case I was asking about SPI/SPIM because when using SPIM (EasyDMA) you cannot have &amp;quot;const&amp;quot; transfer variable. All data needs to be in RAM. Your declaration shall be like:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static nrf_spi_mngr_transfer_t transfer[] = 
{
    NRF_SPI_MNGR_TRANSFER(tx_cmd, sizeof(tx_cmd), &amp;amp;rx_data, sizeof(rx_data))
};
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Question about SPI transaction manager</title><link>https://devzone.nordicsemi.com/thread/108555?ContentTypeID=1</link><pubDate>Thu, 23 Nov 2017 02:32:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c99e1ad6-6c63-4b82-b0db-ec0d0a83a6a1</guid><dc:creator>Daniel</dc:creator><description>&lt;p&gt;OK, after some tests, if I comment&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;     nrf_pwr_mgmt_run();
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In the while loop in main function, the spi_manager will go to the end callback, but if the power_mgmt exists, it will not go to the end callback, why?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Question about SPI transaction manager</title><link>https://devzone.nordicsemi.com/thread/108554?ContentTypeID=1</link><pubDate>Thu, 23 Nov 2017 02:16:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d35d0538-c1d3-4b1c-94bf-92e1fb529296</guid><dc:creator>Daniel</dc:creator><description>&lt;p&gt;Well, it seems that I send the wrong command. I use the spi_manager example to make a test, send the right command &amp;quot;tx_cmd[] = {0x8F, 0xFF}&amp;quot;, then I get the correct who_am_i register value. However, I find that the callback function doesn&amp;#39;t work, even if I put a breakpoint in it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Question about SPI transaction manager</title><link>https://devzone.nordicsemi.com/thread/108553?ContentTypeID=1</link><pubDate>Thu, 23 Nov 2017 01:33:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7bd80912-95ba-4357-a3e6-d0ce9be60117</guid><dc:creator>Daniel</dc:creator><description>&lt;p&gt;yes, I turned on the SPI and SPIM2, also tried EasyDMA on and off state, but it leads to the same result.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Question about SPI transaction manager</title><link>https://devzone.nordicsemi.com/thread/108552?ContentTypeID=1</link><pubDate>Wed, 22 Nov 2017 11:32:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:69392ea0-ce19-4cdf-afbc-642aef125506</guid><dc:creator>Jakub Rzeszutko</dc:creator><description>&lt;p&gt;Do you use SPI or SPIM (do you use EasyDMA) ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>