<?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>SPI RX problem (Only receive 0x00)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/48682/spi-rx-problem-only-receive-0x00</link><description>Hello, 
 I try to make my NRF52832 communicates with a memory (MX25R1635FZUIL0) in SPI. 
 When I try to read the memory ID, the RX buffer is fill with 0x00. But when I observe the MISO pin on the oscilloscope, I see the memory send some data. 
 I configure</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 18 Jun 2019 08:31:25 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/48682/spi-rx-problem-only-receive-0x00" /><item><title>RE: SPI RX problem (Only receive 0x00)</title><link>https://devzone.nordicsemi.com/thread/193330?ContentTypeID=1</link><pubDate>Tue, 18 Jun 2019 08:31:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8caf6614-516d-4bc6-85b8-f9089bf9ef2a</guid><dc:creator>Malo</dc:creator><description>&lt;p&gt;I found the solution of my problem !&lt;/p&gt;
&lt;p&gt;When you want to use a NFC pin as GPIO you have to add in the project prepocessor definitions &amp;quot;CONFIG_NFCT_PINS_AS_GPIOS&amp;quot; as explain &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/29041/how-to-enable-p0-09-and-p0-10-as-gpio-pins-on-the-nrf52-instead-of-nfc-pins"&gt;here&lt;/a&gt;. This also applies to SPI pins and other protocols I imagine. &lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Malo&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI RX problem (Only receive 0x00)</title><link>https://devzone.nordicsemi.com/thread/193300?ContentTypeID=1</link><pubDate>Tue, 18 Jun 2019 06:55:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:55a73dd1-bb3d-43b3-82a7-da143eef5439</guid><dc:creator>Malo</dc:creator><description>&lt;p&gt;I can&amp;#39;t change the SPI pins on my board (it is very integrated). But I have tested exactly the same code except the SPI and memory Reset and WP pins with the DWM1001 development board connected the same memory model in a different package and it worked well with the following pins :&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;miso : 7&lt;/li&gt;
&lt;li&gt;mosi : 6&lt;/li&gt;
&lt;li&gt;slk : 4&lt;/li&gt;
&lt;li&gt;cs : 3&lt;/li&gt;
&lt;li&gt;RST : 8&lt;/li&gt;
&lt;li&gt;WP : 15&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;My code is inserted below :&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void Initial_Spi()
{
    nrf_gpio_pin_write(MX25_WP, 1);
    nrf_gpio_pin_write(MX25_CS, 1);

    nrf_drv_spi_config_t spi_config = NRF_DRV_SPI_DEFAULT_CONFIG;
    spi_config.ss_pin   = NRF_DRV_SPI_PIN_NOT_USED;
    spi_config.miso_pin = MX25_SO;
    spi_config.mosi_pin = MX25_SI;
    spi_config.sck_pin  = MX25_SCLK;
    spi_config.bit_order = NRF_DRV_SPI_BIT_ORDER_MSB_FIRST;

    spi_config.mode = NRF_DRV_SPI_MODE_3;
    spi_config.frequency = NRF_SPI_FREQ_8M;
    
    APP_ERROR_CHECK(nrf_drv_spi_init(&amp;amp;MXspi, &amp;amp;spi_config, spi_event_handler, NULL));

    // Wait flash warm-up
    Wait_Flash_WarmUp();

    // Release the chip from powerdown mode
    CS_Low();
    SendByte( FLASH_CMD_RES, SIO );
    CS_High();

    nrf_delay_us(30000);
}

void CS_Low()
{
    nrf_gpio_pin_write(MX25_CS, 0);
}

void CS_High()
{
    nrf_gpio_pin_write(MX25_CS, 1);
    nrf_gpio_pin_write(MX25_WP, 1);
}

void SendByte( uint8_t byte_value)
{
    spi_xfer_done = false;
    APP_ERROR_CHECK(nrf_drv_spi_transfer(&amp;amp;MXspi, &amp;amp;byte_value, 1, NULL, 0));
    while(spi_xfer_done == false)
    {
      __WFE();
    }
}

uint8_t GetByte( void )
{
    uint8_t data_buf = 0;

    spi_xfer_done = false;
    APP_ERROR_CHECK(nrf_drv_spi_transfer(&amp;amp;MXspi, NULL, 0, &amp;amp;data_buf, 1));
    while(spi_xfer_done == false)
    {
      __WFE();
    }
    return data_buf;
}

ReturnMsg CMD_RDID( uint32_t *Identification )
{
    uint32_t temp;
    uint8_t  gDataBuffer[3];

    // Chip select go low to start a flash command
    CS_Low();

    // Send command
    SendByte( FLASH_CMD_RDID);

    //nrf_delay_us(10);
    // Get manufacturer identification, device identification
    gDataBuffer[0] = GetByte();
    gDataBuffer[1] = GetByte();
    gDataBuffer[2] = GetByte();
    
    // Chip select go high to end a command
    CS_High();

    // Store identification
    temp =  gDataBuffer[0];
    temp =  (temp &amp;lt;&amp;lt; 8) | gDataBuffer[1];
    *Identification =  (temp &amp;lt;&amp;lt; 8) | gDataBuffer[2];

    return FlashOperationSuccess;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Malo&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI RX problem (Only receive 0x00)</title><link>https://devzone.nordicsemi.com/thread/193255?ContentTypeID=1</link><pubDate>Mon, 17 Jun 2019 17:10:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3e22b995-7f4a-43f9-a02d-6bc1bd47c7d6</guid><dc:creator>Tai</dc:creator><description>&lt;p&gt;I don&amp;#39;t think reading in PIN 9 makes you not to receive anything. You can try other pins to check it, btw. Can you post your SPI code to read the memory ID?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>