<?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 read is not happening fine,</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/792/spi-read-is-not-happening-fine</link><description>Hi 
 We have custom nrf51822 board. 
 in that we have nor flash which is spi compatible. 
 so in order to read device id i used spi_master sample source code. 
 i am able to write data in to Nor flash. 
 i check with debugging also. 
 it is giving</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 22 Sep 2015 00:47:32 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/792/spi-read-is-not-happening-fine" /><item><title>RE: Spi read is not happening fine,</title><link>https://devzone.nordicsemi.com/thread/3978?ContentTypeID=1</link><pubDate>Tue, 22 Sep 2015 00:47:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aa9a38c2-3c8d-409a-a4ad-cc1e0605ff3e</guid><dc:creator>hassan789</dc:creator><description>&lt;p&gt;Had the same issue... Make sure your SPI CLK line has an external pull-DOWN... per the N25Q datasheet&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Spi read is not happening fine,</title><link>https://devzone.nordicsemi.com/thread/3977?ContentTypeID=1</link><pubDate>Thu, 31 Oct 2013 16:11:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fe2dfc4d-926d-4be8-b3da-4159fff89d7f</guid><dc:creator>syntroniks</dc:creator><description>&lt;p&gt;&amp;quot;chip select pin as pull up.&amp;quot;
Please verify that the microcontroller is pulling this line low when you are executing spi_master_tx_rx. MODE0 is pretty common and I don&amp;#39;t see any issues with MOSI/MISO being swapped.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Spi read is not happening fine,</title><link>https://devzone.nordicsemi.com/thread/3976?ContentTypeID=1</link><pubDate>Thu, 31 Oct 2013 10:59:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a896a890-287a-4667-88b0-8a5527ea1a85</guid><dc:creator>balaji</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Here Is my configuration,&lt;/p&gt;
&lt;p&gt;for Nor flash.&lt;/p&gt;
&lt;p&gt;i set DQ0 as MOSI&lt;/p&gt;
&lt;p&gt;i set DQ1 as MISO.&lt;/p&gt;
&lt;p&gt;i kept clock frequency as 1 Mbps.&lt;/p&gt;
&lt;p&gt;i set mode MODE0 means Sample data at rising edge of clock and shift serial data at falling edge&lt;/p&gt;
&lt;p&gt;i  make wp pin,hold pin and chip select pin as pull up.&lt;/p&gt;
&lt;p&gt;then i am able to send data over MOSI which is i saw in CRO.&lt;/p&gt;
&lt;p&gt;but there is no data in MISO.&lt;/p&gt;
&lt;p&gt;I  am trying to read device id as 0X20BA20. by sending read id command 0x9F.&lt;/p&gt;
&lt;p&gt;Kndly suggest me&lt;/p&gt;
&lt;p&gt;Regards
Balaji&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/4846.n25q_5F00_512mb_5F00_1ce_5F00_3v_5F00_65nm.pdf"&gt;n25q_512mb_1ce_3v_65nm.pdf&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Spi read is not happening fine,</title><link>https://devzone.nordicsemi.com/thread/3975?ContentTypeID=1</link><pubDate>Wed, 30 Oct 2013 20:12:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a82c60e8-1f1e-415e-93fd-15f5206487dc</guid><dc:creator>balaji</dc:creator><description>&lt;p&gt;Hi  Syntroniks,&lt;/p&gt;
&lt;p&gt;Here i am uploading datasheet also.&lt;/p&gt;
&lt;p&gt;kindly suggest me.&lt;/p&gt;
&lt;p&gt;Regards
Balaji&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/n25q_5F00_512mb_5F00_1ce_5F00_3v_5F00_65nm.pdf"&gt;n25q_512mb_1ce_3v_65nm.pdf&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Spi read is not happening fine,</title><link>https://devzone.nordicsemi.com/thread/3974?ContentTypeID=1</link><pubDate>Wed, 30 Oct 2013 19:27:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c5039269-1cf7-48c6-93f1-d788177d0675</guid><dc:creator>balaji</dc:creator><description>&lt;p&gt;HI Syntroniks,&lt;/p&gt;
&lt;p&gt;Sorry for my bad variables.&lt;/p&gt;
&lt;p&gt;I am using Micron Nor Flash N25Q512.&lt;/p&gt;
&lt;p&gt;Kindly some hints.&lt;/p&gt;
&lt;p&gt;Regards
Balaji&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Spi read is not happening fine,</title><link>https://devzone.nordicsemi.com/thread/3973?ContentTypeID=1</link><pubDate>Wed, 30 Oct 2013 18:52:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7717a558-2633-48db-b7e2-4390119dc044</guid><dc:creator>syntroniks</dc:creator><description>&lt;pre&gt;&lt;code&gt;static void halAfe_ConfigSPI(void)
{
  /* UART/SPI Peripheral configuration */
	spi_handle = spi_master_init(SPI0, SPI_MODE0, false);
	if (spi_handle == 0)
		; // uh-oh
}
void HalAfe_HW_Init(void)
{
  /* Initialize AFE IO lines */
  halAfe_ConfigIO();

  /* Initialize SPI */
  halAfe_ConfigSPI();
  HalAfe_HW_Defaults();
}
void HalAfe_HW_EnterReadMode()
{
	uint32_t txdat = 1;
	uint8_t rxdat[] = {0, 0, 0, 1};
	txdat = swap_uint32(txdat);
	if (spi_handle != 0)
		spi_master_tx_rx(spi_handle, 4, (uint8_t*)&amp;amp;txdat, rxdat);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;spi_master_cfg.h&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#define SPI_PSELSCK0              8   
#define SPI_PSELMOSI0             10   
#define SPI_PSELMISO0             9   
#define SPI_PSELSS0               11  

&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You should buy a logic analyzer if you don&amp;#39;t have one. Your variables and names are very confusing.&lt;/p&gt;
&lt;p&gt;Post your part number as well. How should I know what flash you have?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>