<?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 driver stuck on nrfx_spim_xfer</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/37028/spim-driver-stuck-on-nrfx_spim_xfer</link><description>I&amp;#39;m trying to use the SPIM driver on nRF52832. The setup is: 
 Chip: nRF52832 
 SDK: 15 
 Softdevice: s132 v6 
 Toolchain: GCC 
 For some reason the call to nrfx_spim_xfer never returns. 
 The code: 
 
 nrfx_gpiote_in_config_t icm_int1 = NRFX_GPIOTE_CONFIG_IN_SENSE_LOTOHI</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 27 Nov 2018 04:56:36 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/37028/spim-driver-stuck-on-nrfx_spim_xfer" /><item><title>RE: SPIM driver stuck on nrfx_spim_xfer</title><link>https://devzone.nordicsemi.com/thread/159140?ContentTypeID=1</link><pubDate>Tue, 27 Nov 2018 04:56:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:50b4eae7-8318-4ee0-a4cf-47b881352231</guid><dc:creator>nero</dc:creator><description>&lt;p&gt;Hi，I have met it too. Have you solved? I develop based on freertos, but i don&amp;#39;t think it is related with os.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPIM driver stuck on nrfx_spim_xfer</title><link>https://devzone.nordicsemi.com/thread/142687?ContentTypeID=1</link><pubDate>Thu, 02 Aug 2018 16:09:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:56a84c14-5007-4ec6-9c33-849af729af51</guid><dc:creator>TomerAb</dc:creator><description>&lt;p&gt;We managed to solve it.&lt;/p&gt;
&lt;p&gt;We found that pins 9 and 10 are shared with the NFC pins, and according to the documentation they are enabled as NFC pins by default. So all we had to do to solve this was adding CONFIG_NFCT_PINS_AS_GPIOS definition in the Makefile.&lt;/p&gt;
&lt;p&gt;P.S&lt;/p&gt;
&lt;p&gt;This exact same code did work before without CONFIG_NFCT_PINS_AS_GPIOS . I suspect that when we started developing the bootloader for our product, and did a lot of full chip erases this setting suddenly came back. Is that a bug or there&amp;#39;s some something related to those pins saved in the flash?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPIM driver stuck on nrfx_spim_xfer</title><link>https://devzone.nordicsemi.com/thread/142665?ContentTypeID=1</link><pubDate>Thu, 02 Aug 2018 15:13:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f7f18477-e23e-457d-9d6c-af1ad4d2434c</guid><dc:creator>TomerAb</dc:creator><description>&lt;p&gt;I&amp;#39;ve created a project by copying the example from &amp;quot;\nRF5_SDK_15.0.0_a53641a\examples\peripheral\spi\pca10040\blank&amp;quot; and modified it to use the exact same code. So in this project there is no Softdevice, but this problem still happens both on our custom board and the PCA10040 custom board.&lt;/p&gt;
&lt;p&gt;Note that if you modify, for example, the sck_pin in the config to 11 instead of 10, it will work which is very weird.&lt;/p&gt;
&lt;p&gt;This is the project:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.dropbox.com/s/6o51dvgcexqmgzt/spi.zip?dl=0"&gt;https://www.dropbox.com/s/6o51dvgcexqmgzt/spi.zip?dl=0&lt;/a&gt;\&lt;/p&gt;
&lt;p&gt;The only thing you need to change is the SDK location in the make file, and then use &amp;quot;make flash&amp;quot;&lt;/p&gt;
&lt;p&gt;Alternatively you can modify the example that I modified and paste the following code to main.c:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;quot;nrf_drv_spi.h&amp;quot;
#include &amp;quot;app_util_platform.h&amp;quot;
#include &amp;quot;nrf_gpio.h&amp;quot;
#include &amp;quot;nrf_delay.h&amp;quot;
#include &amp;quot;boards.h&amp;quot;
#include &amp;quot;app_error.h&amp;quot;
#include &amp;lt;string.h&amp;gt;
#include &amp;quot;nrf_log.h&amp;quot;
#include &amp;quot;nrf_log_ctrl.h&amp;quot;
#include &amp;quot;nrf_log_default_backends.h&amp;quot;
#include &amp;lt;nrfx_gpiote.h&amp;gt;

static const nrfx_spim_t _spi_instance = NRFX_SPIM_INSTANCE(0);

int main(void)
{
    APP_ERROR_CHECK(nrfx_gpiote_init());

    nrfx_gpiote_out_config_t led_cfg = NRFX_GPIOTE_CONFIG_OUT_SIMPLE(true);
    nrfx_gpiote_out_init(26, &amp;amp;led_cfg);

    nrfx_gpiote_out_toggle(26);

    APP_ERROR_CHECK(NRF_LOG_INIT(NULL));
    NRF_LOG_DEFAULT_BACKENDS_INIT();

    NRF_LOG_INFO(&amp;quot;startup&amp;quot;);

    nrfx_spim_config_t spi_cfg =
    {
        .sck_pin = 10,
        .mosi_pin = 9,
        .miso_pin = 3,
        .ss_pin = 2,
        .ss_active_high = false,
        .irq_priority = NRFX_SPIM_DEFAULT_CONFIG_IRQ_PRIORITY,
        .orc = 0xFF,
        .frequency = NRF_SPIM_FREQ_1M,
        .mode = NRF_SPIM_MODE_3,
        .bit_order = NRF_SPIM_BIT_ORDER_MSB_FIRST,
        NRFX_SPIM_DEFAULT_EXTENDED_CONFIG        
    };

    APP_ERROR_CHECK(nrfx_spim_init(&amp;amp;_spi_instance, &amp;amp;spi_cfg, NULL, NULL));

    uint8_t tx[2] = { 0x00 | 0x80, 0 };
    uint8_t rx[2] = { 0 };

    nrfx_spim_xfer_desc_t xfer =
    {
        .p_tx_buffer = tx,
        .tx_length = 2,
        .p_rx_buffer = rx,
        .rx_length= 2,
    };
    
    NRF_LOG_INFO(&amp;quot;manual xfer&amp;quot;);

    while(1)
    {
        nrfx_spim_xfer(&amp;amp;_spi_instance, &amp;amp;xfer, 0);
        NRF_LOG_INFO(&amp;quot;ICM20649: WHOAMI = 0x%X&amp;quot;, rx[1]);
        nrfx_gpiote_out_toggle(26);
        nrf_delay_ms(200);
    }
}
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPIM driver stuck on nrfx_spim_xfer</title><link>https://devzone.nordicsemi.com/thread/142442?ContentTypeID=1</link><pubDate>Wed, 01 Aug 2018 14:17:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4023b8bc-1911-44cd-ab3f-4dd03390fec7</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;I have not spotted any issues with the code you included. Can you upload a&amp;nbsp;full&amp;nbsp;example that demonstrate the issue?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>