<?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 communication problem</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/45247/spi-communication-problem</link><description>Hello 
 I&amp;#39;m using NRF52 PCA10040 board., SDK 15.2 libraries with GNU ARM GCC and Eclipse as an IDE developing FW on Windows10 x64. 
 I have been facing a problem trying to service external SPI flash memory (AT25SF041, but not only - you can read about</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 02 Apr 2019 06:10:56 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/45247/spi-communication-problem" /><item><title>RE: SPI communication problem</title><link>https://devzone.nordicsemi.com/thread/179636?ContentTypeID=1</link><pubDate>Tue, 02 Apr 2019 06:10:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cd7f5a05-a08b-4672-ac61-d1cc41eab12c</guid><dc:creator>Alan Klimala</dc:creator><description>&lt;p&gt;Thanks for clarification :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI communication problem</title><link>https://devzone.nordicsemi.com/thread/179283?ContentTypeID=1</link><pubDate>Fri, 29 Mar 2019 15:08:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7294fe3b-c787-45d7-8726-72c9868f7b9f</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;You&amp;#39;re welcome. As an aside, the reason this happened is that particular part is extremely fast so any minor high-frequency noise or slow rise/fall time on the rising or falling clock edge can be interpreted as a much faster multiple clock transition than the nominal 125kHz clock; the &amp;#39;scope traces do not show this as the clock is so slow, but if the time-axis resolution were set to (say) 10nSec per division the soggy slope of the clock edge would be clearly seen. Increasing the drive sharpens up the edges and reduces this rise/fall time..&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI communication problem</title><link>https://devzone.nordicsemi.com/thread/179133?ContentTypeID=1</link><pubDate>Fri, 29 Mar 2019 08:15:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6257ea81-ce67-4876-8b8e-656da9f25600</guid><dc:creator>Alan Klimala</dc:creator><description>&lt;p&gt;Thank you&amp;nbsp;&lt;a class="internal-link view-user-profile" href="https://devzone.nordicsemi.com/members/hmolesworth"&gt;hmolesworth&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/a&gt;&amp;nbsp;!! Additional GPIOs configuration solved the problem.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI communication problem</title><link>https://devzone.nordicsemi.com/thread/179129?ContentTypeID=1</link><pubDate>Fri, 29 Mar 2019 07:59:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cf3ad269-708d-4e6c-9deb-f04e0708865c</guid><dc:creator>Alan Klimala</dc:creator><description>&lt;p&gt;Sorry for late answer, I wasn&amp;#39;t at office last two days. I tested all options but communication is still wrong. The only change is the response, but it might be connected to the fact that I switched tfrom nrfx_spi to nrfx_spim driver. Please take a look at screenshots below.&lt;br /&gt;&lt;br /&gt;1. With&amp;nbsp;NRF_GPIO_PIN_NOPULL&lt;br /&gt;&lt;br /&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/8473.DS1Z_5F00_QuickPrint2.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;2. With&amp;nbsp;NRF_GPIO_PIN_PULLDOWN&lt;br /&gt;&lt;br /&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/5850.DS1Z_5F00_QuickPrint3.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;3. With&amp;nbsp;NRF_GPIO_PIN_PULLUP&lt;br /&gt;&lt;br /&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/2742.DS1Z_5F00_QuickPrint5.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI communication problem</title><link>https://devzone.nordicsemi.com/thread/178842?ContentTypeID=1</link><pubDate>Thu, 28 Mar 2019 08:12:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6b114652-0857-403e-a18d-2acd29d08a98</guid><dc:creator>Nguyen Hoan Hoang</dc:creator><description>&lt;p&gt;The clock is always nice sine it is generated by the master. &amp;nbsp;Yet, I have encountered many flash chips that do respond well under 1M. &amp;nbsp;Don&amp;#39; t remember which one.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI communication problem</title><link>https://devzone.nordicsemi.com/thread/178840?ContentTypeID=1</link><pubDate>Thu, 28 Mar 2019 08:06:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0106223a-3da1-4c0e-9428-0498ad733975</guid><dc:creator>Alan Klimala</dc:creator><description>&lt;p&gt;Hi :)&lt;br /&gt;Thank you for your input. The problem is that I can communicate with the device using exactly the same SPI configuration when using STM32 as a host controller. I know that 125K is a little bit slow and I do not plan to use it in production environment (it will be 1M at least). I just set 125K to have a nice looking clock signal, thus show communication on DSO clearly.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI communication problem</title><link>https://devzone.nordicsemi.com/thread/178807?ContentTypeID=1</link><pubDate>Thu, 28 Mar 2019 00:30:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d28f67a9-77b3-45c1-8cbd-91c0e592762d</guid><dc:creator>Nguyen Hoan Hoang</dc:creator><description>&lt;p&gt;I see that you are configuring the SPI freq at 125K. &amp;nbsp;This will not work for many Flash devices. &amp;nbsp;Min would be 1M but some flash would need 4M. &amp;nbsp;So try at 4M first to see if you can read the ID.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI communication problem</title><link>https://devzone.nordicsemi.com/thread/178753?ContentTypeID=1</link><pubDate>Wed, 27 Mar 2019 15:35:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3e11e939-f8d4-43d3-b243-ef8326206f95</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;I would try increasing the SPI clock frequency to at least 1MHz and boosting the drive of the three output signals to the flash; later on you can always investigate reducing drive strength again. Insert this &lt;em&gt;after&lt;/em&gt; configuring SPI:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;   // High power output pins
   nrf_gpio_cfg(CS_PIN,
                NRF_GPIO_PIN_DIR_OUTPUT,
                NRF_GPIO_PIN_INPUT_DISCONNECT,
                NRF_GPIO_PIN_NOPULL,
                NRF_GPIO_PIN_H0H1,       // Require High Drive high and low level
                NRF_GPIO_PIN_NOSENSE);
   nrf_gpio_cfg(SCK_PIN,
                NRF_GPIO_PIN_DIR_OUTPUT,
                NRF_GPIO_PIN_INPUT_DISCONNECT,
                NRF_GPIO_PIN_NOPULL,
                NRF_GPIO_PIN_H0H1,       // Require High Drive high and low level
                NRF_GPIO_PIN_NOSENSE);
   nrf_gpio_cfg(MOSI_PIN,
                NRF_GPIO_PIN_DIR_OUTPUT,
                NRF_GPIO_PIN_INPUT_DISCONNECT,
                NRF_GPIO_PIN_NOPULL,
                NRF_GPIO_PIN_H0H1,       // Require High Drive high and low level
                NRF_GPIO_PIN_NOSENSE);
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I would also reconsider your pin choice, especially when using much higher clock speeds:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;4.3.1 GPIO located near the radio&lt;/em&gt;&lt;br /&gt;&lt;em&gt;Radio performance parameters, such as sensitivity, may be affected by high frequency digital I/O with large sink/source current close to the Radio power supply and antenna pins.&lt;/em&gt;&lt;br /&gt;&lt;em&gt;Table 5: GPIO recommended usage for QFN48 package on page 17 and Table 6: GPIO recommended usage for WLCSP package on page 17 identify some GPIO that have recommended usage guidelines to maximize radio performance in an application.&lt;/em&gt;&lt;br /&gt;&lt;em&gt;Table 5: GPIO recommended usage for QFN48 package&lt;/em&gt;&lt;br /&gt;&lt;em&gt;Pin GPIO&lt;/em&gt;&lt;br /&gt;&lt;em&gt;27 P0.22&lt;/em&gt;&lt;br /&gt;&lt;em&gt;28 P0.23&lt;/em&gt;&lt;br /&gt;&lt;em&gt;29 P0.24&lt;/em&gt;&lt;br /&gt;&lt;em&gt;37 P0.25&lt;/em&gt;&lt;br /&gt;&lt;em&gt;38 P0.26&lt;/em&gt;&lt;br /&gt;&lt;em&gt;39 P0.27&lt;/em&gt;&lt;br /&gt;&lt;em&gt;40 P0.28&lt;/em&gt;&lt;br /&gt;&lt;em&gt;41 P0.29&lt;/em&gt;&lt;br /&gt;&lt;em&gt;42 P0.30&lt;/em&gt;&lt;br /&gt;&lt;em&gt;43 P0.31&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI communication problem</title><link>https://devzone.nordicsemi.com/thread/178652?ContentTypeID=1</link><pubDate>Wed, 27 Mar 2019 12:03:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:08d9f214-af95-4d3d-ba59-29ed13bdf45a</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Can you try changing the&amp;nbsp;NRFX_SPIM_MISO_PULL_CFG in sdk_config.h? It is strange that the device does not respond with the same output when it receive the same command on MOSI line.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI communication problem</title><link>https://devzone.nordicsemi.com/thread/178389?ContentTypeID=1</link><pubDate>Tue, 26 Mar 2019 13:50:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c19b3df5-47bf-4317-af4c-016b841975aa</guid><dc:creator>Alan Klimala</dc:creator><description>&lt;p&gt;Hi &lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a class="internal-link view-user-profile" href="https://devzone.nordicsemi.com/members/joh2"&gt;J&amp;oslash;rgen&lt;/a&gt;,&lt;br /&gt;Unfortunatelly the result is exactly the same. Take a look on a screenshot below:&lt;br /&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/DS1Z_5F00_QuickPrint7.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI communication problem</title><link>https://devzone.nordicsemi.com/thread/178293?ContentTypeID=1</link><pubDate>Tue, 26 Mar 2019 10:27:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:269852e2-73d5-40f7-a00e-a306e12ca508</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;It looks like you are writing more bytes than necessary. If you want to write a single byte and receive 3 bytes&amp;nbsp;&lt;strong&gt;after this&lt;/strong&gt;, I would recommend using the following code:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;uint8_t txBuf[] =
{
	0x9F
};

uint8_t rxBuf[4] = { 0 };

AT25SF041_bXferBytesLL(txBuf, 1, rxBuf, 4);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The peripheral will send out &amp;quot;dummy bytes&amp;quot; to read the following bytes into the RX buffer, you just need to ignore the byte received while transmitting the first byte.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI communication problem</title><link>https://devzone.nordicsemi.com/thread/177998?ContentTypeID=1</link><pubDate>Mon, 25 Mar 2019 07:35:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7881a552-ef08-4e5d-888f-f000ef764db8</guid><dc:creator>Alan Klimala</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;span&gt;J&amp;oslash;rgen,&lt;br /&gt;&lt;br /&gt;1. When I&amp;#39;m sending Read Manufacturer and Device (0x9F) command&amp;nbsp; I call transfer function using such a code:&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;uint8_t txBuf[] =
{
	0x9F,
	0xFF,
	0xFF,
	0xFF
};

uint8_t rxBuf[6] = { 0 };

AT25SF041_bXferBytesLL(txBuf, 6, rxBuf, 6);&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;But as can be seen on the screenshot below I got wrong answer (should be 0x1F 0x84 0x01).&lt;br /&gt;&lt;br /&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/DS1Z_5F00_QuickPrint4.png" /&gt;&lt;br /&gt;&lt;br /&gt;Doing the same with STM32 processor gives communication like on&amp;nbsp; screenshot below:&lt;br /&gt;&lt;br /&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/DS1Z_5F00_QuickPrint2.png" /&gt;&lt;br /&gt;&lt;br /&gt;2. When I&amp;#39;m sending Read ID (0x90) command I call transfer function using such a code:&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;uint8_t txBuf[] =
{
	0x90,
	0x00,
	0x00,
	0x00,
	0xFF,
	0xFF
};
uint8_t rxBuf[6] = { 0 };

AT25SF041_bXferBytesLL(txBuf, 6, rxBuf, 6);&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;And again the result is not as expected (should be 0x1F 0x12):&lt;br /&gt;&lt;br /&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/DS1Z_5F00_QuickPrint6.png" /&gt;&lt;br /&gt;&lt;br /&gt;When I use STM32 I get:&lt;br /&gt;&lt;br /&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/DS1Z_5F00_QuickPrint3.png" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;My SPI configuration from sdk_config.h is as follows:&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;// &amp;lt;e&amp;gt; NRFX_SPI_ENABLED - nrfx_spi - SPI peripheral driver
//==========================================================
#ifndef NRFX_SPI_ENABLED
#define NRFX_SPI_ENABLED 1
#endif
// &amp;lt;q&amp;gt; NRFX_SPI0_ENABLED  - Enable SPI0 instance
 

#ifndef NRFX_SPI0_ENABLED
#define NRFX_SPI0_ENABLED 1
#endif

// &amp;lt;q&amp;gt; NRFX_SPI1_ENABLED  - Enable SPI1 instance
 

#ifndef NRFX_SPI1_ENABLED
#define NRFX_SPI1_ENABLED 0
#endif

// &amp;lt;q&amp;gt; NRFX_SPI2_ENABLED  - Enable SPI2 instance
 

#ifndef NRFX_SPI2_ENABLED
#define NRFX_SPI2_ENABLED 0
#endif

// &amp;lt;o&amp;gt; NRFX_SPI_MISO_PULL_CFG  - MISO pin pull configuration.
 
// &amp;lt;0=&amp;gt; NRF_GPIO_PIN_NOPULL 
// &amp;lt;1=&amp;gt; NRF_GPIO_PIN_PULLDOWN 
// &amp;lt;3=&amp;gt; NRF_GPIO_PIN_PULLUP 

#ifndef NRFX_SPI_MISO_PULL_CFG
#define NRFX_SPI_MISO_PULL_CFG 1
#endif

// &amp;lt;o&amp;gt; NRFX_SPI_DEFAULT_CONFIG_IRQ_PRIORITY  - Interrupt priority
 
// &amp;lt;0=&amp;gt; 0 (highest) 
// &amp;lt;1=&amp;gt; 1 
// &amp;lt;2=&amp;gt; 2 
// &amp;lt;3=&amp;gt; 3 
// &amp;lt;4=&amp;gt; 4 
// &amp;lt;5=&amp;gt; 5 
// &amp;lt;6=&amp;gt; 6 
// &amp;lt;7=&amp;gt; 7 

#ifndef NRFX_SPI_DEFAULT_CONFIG_IRQ_PRIORITY
#define NRFX_SPI_DEFAULT_CONFIG_IRQ_PRIORITY 6
#endif

// &amp;lt;e&amp;gt; NRFX_SPI_CONFIG_LOG_ENABLED - Enables logging in the module.
//==========================================================
#ifndef NRFX_SPI_CONFIG_LOG_ENABLED
#define NRFX_SPI_CONFIG_LOG_ENABLED 0
#endif
// &amp;lt;o&amp;gt; NRFX_SPI_CONFIG_LOG_LEVEL  - Default Severity level
 
// &amp;lt;0=&amp;gt; Off 
// &amp;lt;1=&amp;gt; Error 
// &amp;lt;2=&amp;gt; Warning 
// &amp;lt;3=&amp;gt; Info 
// &amp;lt;4=&amp;gt; Debug 

#ifndef NRFX_SPI_CONFIG_LOG_LEVEL
#define NRFX_SPI_CONFIG_LOG_LEVEL 3
#endif

// &amp;lt;o&amp;gt; NRFX_SPI_CONFIG_INFO_COLOR  - ANSI escape code prefix.
 
// &amp;lt;0=&amp;gt; Default 
// &amp;lt;1=&amp;gt; Black 
// &amp;lt;2=&amp;gt; Red 
// &amp;lt;3=&amp;gt; Green 
// &amp;lt;4=&amp;gt; Yellow 
// &amp;lt;5=&amp;gt; Blue 
// &amp;lt;6=&amp;gt; Magenta 
// &amp;lt;7=&amp;gt; Cyan 
// &amp;lt;8=&amp;gt; White 

#ifndef NRFX_SPI_CONFIG_INFO_COLOR
#define NRFX_SPI_CONFIG_INFO_COLOR 0
#endif

// &amp;lt;o&amp;gt; NRFX_SPI_CONFIG_DEBUG_COLOR  - ANSI escape code prefix.
 
// &amp;lt;0=&amp;gt; Default 
// &amp;lt;1=&amp;gt; Black 
// &amp;lt;2=&amp;gt; Red 
// &amp;lt;3=&amp;gt; Green 
// &amp;lt;4=&amp;gt; Yellow 
// &amp;lt;5=&amp;gt; Blue 
// &amp;lt;6=&amp;gt; Magenta 
// &amp;lt;7=&amp;gt; Cyan 
// &amp;lt;8=&amp;gt; White 

#ifndef NRFX_SPI_CONFIG_DEBUG_COLOR
#define NRFX_SPI_CONFIG_DEBUG_COLOR 0
#endif

// &amp;lt;/e&amp;gt;

// &amp;lt;/e&amp;gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Can you please help me somehow? The problem is that I have already tested three differen SPI FLASH chips and had preety same problems with each of them.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI communication problem</title><link>https://devzone.nordicsemi.com/thread/177863?ContentTypeID=1</link><pubDate>Fri, 22 Mar 2019 14:21:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7b6ef8df-9f09-46fd-9321-07555800a842</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;What ID are you reading, and what do you expect? What parameters do you pass to the function&amp;nbsp;AT25SF041_bXferBytesLL() when you want to read the ID?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>