<?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>Reading JEDEC ID with SPI on nrf9160</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/69363/reading-jedec-id-with-spi-on-nrf9160</link><description>Hello, 
 I have an external flash w25n01gv, I am using this simple spi loopback example to test the spi functionality of nrf9160. I want to read the jedec id of my device and my code is like: 
 
 
 The dataset of my externaş flash says: 
 
 so I am expecting</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 07 Jan 2021 10:15:51 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/69363/reading-jedec-id-with-spi-on-nrf9160" /><item><title>RE: Reading JEDEC ID with SPI on nrf9160</title><link>https://devzone.nordicsemi.com/thread/287902?ContentTypeID=1</link><pubDate>Thu, 07 Jan 2021 10:15:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f1dda7d4-0f05-471c-809b-c120707de62b</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;I&amp;#39;m sorry for being unclear. All devices in Zephyr are added through the macro DEVICE_AND_API_INIT(), eg. for spi_nor it is done here:&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/3366927a54986ad0ddf060d0e08ecc578adf11f0/drivers/flash/spi_nor.c#L1042"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/3366927a54986ad0ddf060d0e08ecc578adf11f0/drivers/flash/spi_nor.c#L1042&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;You can see that an init function is passed to&amp;nbsp;&lt;span&gt;DEVICE_AND_API_INIT(), and Zephyr will gather all these init functions and run it before main() runs. It happens here:&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v2.1.99-ncs1/kernel/device.c#L49-L54"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/v2.1.99-ncs1/kernel/device.c#L49-L54&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Regarding the other functions inside spi_nor.c, these will not get called directly from main, but instead Zephyr will map the functions in&amp;nbsp;include/drivers/flash.h to the appropriate driver, depending on what is enabled in dts and Kconfig. E.g. &lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/ff214d637e8391d94ef2c83612978aebd9cf0c57/samples/drivers/spi_flash/src/main.c#L57"&gt;flash_erase()&lt;/a&gt;&amp;nbsp;is mapped to spi_nor_erase() through:&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/ff214d637e8391d94ef2c83612978aebd9cf0c57/include/drivers/flash.h#L164"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/ff214d637e8391d94ef2c83612978aebd9cf0c57/include/drivers/flash.h#L164&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/3366927a54986ad0ddf060d0e08ecc578adf11f0/drivers/flash/spi_nor.c#L965"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/3366927a54986ad0ddf060d0e08ecc578adf11f0/drivers/flash/spi_nor.c#L965&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Simon&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading JEDEC ID with SPI on nrf9160</title><link>https://devzone.nordicsemi.com/thread/287748?ContentTypeID=1</link><pubDate>Wed, 06 Jan 2021 14:14:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c15fb212-b1e0-4bbd-a6b6-3ae6029825e4</guid><dc:creator>verulia</dc:creator><description>&lt;p&gt;Hi Simon,&lt;/p&gt;
&lt;p&gt;Thank you for your response. I could&amp;#39;nt figure out what you mean by &amp;quot;&lt;span&gt;spi_nor_init()--&amp;gt;spi_nor_configure()--&amp;gt;&lt;/span&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/3366927a54986ad0ddf060d0e08ecc578adf11f0/drivers/flash/spi_nor.c#L868"&gt;spi_nor_read_jedec_id()&lt;/a&gt;&amp;quot; How should I check these ?I just opened the spi_nor.c and tried to do debugging in those fuction lines but what I realized is that in my main.c , the function doesn&amp;#39;t even go inside the spi_nor.c, so in that case how can I do the debugging in spi_nor functions I could&amp;#39;nt understand it properly can you help me with that ?&lt;/p&gt;
&lt;p&gt;Best&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading JEDEC ID with SPI on nrf9160</title><link>https://devzone.nordicsemi.com/thread/287408?ContentTypeID=1</link><pubDate>Tue, 05 Jan 2021 07:54:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:47b644f9-9fae-4d58-87bf-b0977ffd0dc7</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;Can you try to do some debugging (enable CONFIG_DEBUG_OPTIMIZATIONS) and check if the init function succeeds (&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/3366927a54986ad0ddf060d0e08ecc578adf11f0/drivers/flash/spi_nor.c#L921"&gt;spi_nor_init()&lt;/a&gt;)? As mentioned in &lt;a href="https://devzone.nordicsemi.com/nordic/nrf-connect-sdk-guides/b/getting-started/posts/nrf-connect-sdk-tutorial---part-3-ncs-v1-4-0#h89sk0f70r67s4yr0ru3xvf021v6zh"&gt;NCS Tutorial part-3 1.3. Pitfalls&lt;/a&gt;&amp;nbsp;the call to&amp;nbsp;device_get_binding() will fail (and &amp;quot;SPI&amp;nbsp;flash&amp;nbsp;driver&amp;nbsp;%s&amp;nbsp;was&amp;nbsp;not&amp;nbsp;found&amp;quot; is printed) if the init function fails.&lt;/p&gt;
&lt;p&gt;Try to check the function&amp;nbsp;&lt;span&gt;spi_nor_init()--&amp;gt;spi_nor_configure()--&amp;gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/3366927a54986ad0ddf060d0e08ecc578adf11f0/drivers/flash/spi_nor.c#L868"&gt;spi_nor_read_jedec_id()&lt;/a&gt;&amp;nbsp;and see if&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/3366927a54986ad0ddf060d0e08ecc578adf11f0/drivers/flash/spi_nor.c#L870"&gt;&lt;span&gt;LOG_ERR&lt;/span&gt;(&lt;span&gt;&lt;span&gt;&amp;quot;&lt;/span&gt;JEDEC ID read failed: &lt;span&gt;%d&lt;/span&gt;&lt;span&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, rc)&lt;/a&gt; is triggered.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Simon&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading JEDEC ID with SPI on nrf9160</title><link>https://devzone.nordicsemi.com/thread/286524?ContentTypeID=1</link><pubDate>Thu, 24 Dec 2020 00:32:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:13ef5247-2497-45c1-9c66-9ded43073758</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;A huge part of the support team are currently on Christmas vacaction, and you may experience delayed answers. Most of the staff will be back by january 4th and you can expect an answer after then. My apologies for this.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading JEDEC ID with SPI on nrf9160</title><link>https://devzone.nordicsemi.com/thread/286432?ContentTypeID=1</link><pubDate>Wed, 23 Dec 2020 11:19:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f3053c1f-a8ab-420c-a6cf-a4265b6e5074</guid><dc:creator>verulia</dc:creator><description>&lt;p&gt;Hi Simon,&lt;/p&gt;
&lt;p&gt;I already found that and tried. The problem is that flash has an already existing driver I think thats the problem why it doesn&amp;#39;t work for my case. What should I wrote these parts in the code:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#if (CONFIG_SPI_FLASH_W25QXXDV - 0)
/* NB: W25Q16DV is a JEDEC spi-nor device, but has a separate driver. */
#define FLASH_DEVICE CONFIG_SPI_FLASH_W25QXXDV_DRV_NAME
#define FLASH_NAME &amp;quot;W25QXXDV&amp;quot;
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;the overlay that the sample used is:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;amp;spi3 {
        compatible = &amp;quot;nordic,nrf-spim&amp;quot;;
        status = &amp;quot;okay&amp;quot;;
        sck-pin = &amp;lt;10&amp;gt;;
        mosi-pin = &amp;lt;11&amp;gt;;
        miso-pin = &amp;lt;12&amp;gt;;
        cs-gpios = &amp;lt;&amp;amp;gpio0 13 0&amp;gt;;

        w25q32@0 {
                compatible = &amp;quot;winbond,w25q32&amp;quot;, &amp;quot;jedec,spi-nor&amp;quot;;
                label = &amp;quot;W25Q32&amp;quot;;
                reg = &amp;lt;0&amp;gt;;
                jedec-id = [ef 40 16];
                size = &amp;lt;0x4000000&amp;gt;;
                spi-max-frequency = &amp;lt;1000000&amp;gt;;
        };
};

&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I tried to change the whole code acccording to my external flash which has very similar command set with spi_nor so I though that I can directly use it as my driver then I implemented the code in the following:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;main.c:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/*
 * Copyright (c) 2016 Intel Corporation.
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#include &amp;lt;zephyr.h&amp;gt;
#include &amp;lt;drivers/flash.h&amp;gt;
#include &amp;lt;device.h&amp;gt;
#include &amp;lt;devicetree.h&amp;gt;
#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;string.h&amp;gt;

#if (CONFIG_SPI_FLASH_W25N01GV - 0)
/* NB: W25Q16DV is a JEDEC spi-nor device, but has a separate driver. */
#define FLASH_DEVICE CONFIG_SPI_FLASH_W25N01GV_DRV_NAME
#define FLASH_NAME &amp;quot;W25N01GV&amp;quot;
#elif (CONFIG_SPI_NOR - 0) ||				\
	DT_NODE_HAS_STATUS(DT_INST(0, jedec_spi_nor), okay)
#define FLASH_DEVICE DT_LABEL(DT_INST(0, jedec_spi_nor))
#define FLASH_NAME &amp;quot;JEDEC SPI-NOR&amp;quot;
#elif (CONFIG_NORDIC_QSPI_NOR - 0) || \
	DT_NODE_HAS_STATUS(DT_INST(0, nordic_qspi_nor), okay)
#define FLASH_DEVICE DT_LABEL(DT_INST(0, nordic_qspi_nor))
#define FLASH_NAME &amp;quot;JEDEC QSPI-NOR&amp;quot;
#else
#error Unsupported flash driver
#endif

#if defined(CONFIG_BOARD_ADAFRUIT_FEATHER_STM32F405)
#define FLASH_TEST_REGION_OFFSET 0xf000
#else
#define FLASH_TEST_REGION_OFFSET 0xff000
#endif
#define FLASH_SECTOR_SIZE        4096




void main(void)
{
	const uint8_t expected[] = { 0x55, 0xaa, 0x66, 0x99 };
	const size_t len = sizeof(expected);
	uint8_t buf[sizeof(expected)];
	const struct device *flash_dev;
	int rc;

	printf(&amp;quot;\n&amp;quot; FLASH_NAME &amp;quot; SPI flash testing\n&amp;quot;);
	printf(&amp;quot;==========================\n&amp;quot;);

	flash_dev = device_get_binding(FLASH_DEVICE);

	if (!flash_dev) {
		printf(&amp;quot;SPI flash driver %s was not found!\n&amp;quot;,
		       FLASH_DEVICE);
		return;
	}

	/* Write protection needs to be disabled before each write or
	 * erase, since the flash component turns on write protection
	 * automatically after completion of write and erase
	 * operations.
	 */
	printf(&amp;quot;\nTest 1: Flash erase\n&amp;quot;);
	flash_write_protection_set(flash_dev, false);

	rc = flash_erase(flash_dev, FLASH_TEST_REGION_OFFSET,
			 FLASH_SECTOR_SIZE);
	if (rc != 0) {
		printf(&amp;quot;Flash erase failed! %d\n&amp;quot;, rc);
	} else {
		printf(&amp;quot;Flash erase succeeded!\n&amp;quot;);
	}

	printf(&amp;quot;\nTest 2: Flash write\n&amp;quot;);
	flash_write_protection_set(flash_dev, false);

	printf(&amp;quot;Attempting to write %u bytes\n&amp;quot;, len);
	rc = flash_write(flash_dev, FLASH_TEST_REGION_OFFSET, expected, len);
	if (rc != 0) {
		printf(&amp;quot;Flash write failed! %d\n&amp;quot;, rc);
		return;
	}

	memset(buf, 0, len);
	rc = flash_read(flash_dev, FLASH_TEST_REGION_OFFSET, buf, len);
	if (rc != 0) {
		printf(&amp;quot;Flash read failed! %d\n&amp;quot;, rc);
		return;
	}

	if (memcmp(expected, buf, len) == 0) {
		printf(&amp;quot;Data read matches data written. Good!!\n&amp;quot;);
	} else {
		const uint8_t *wp = expected;
		const uint8_t *rp = buf;
		const uint8_t *rpe = rp + len;

		printf(&amp;quot;Data read does not match data written!!\n&amp;quot;);
		while (rp &amp;lt; rpe) {
			printf(&amp;quot;%08x wrote %02x read %02x %s\n&amp;quot;,
			       (uint32_t)(FLASH_TEST_REGION_OFFSET + (rp - buf)),
			       *wp, *rp, (*rp == *wp) ? &amp;quot;match&amp;quot; : &amp;quot;MISMATCH&amp;quot;);
			++rp;
			++wp;
		}
	}
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;overlay:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;amp;spi3 {
compatible = &amp;quot;nordic,nrf-spim&amp;quot;;
status = &amp;quot;okay&amp;quot;;
sck-pin = &amp;lt;10&amp;gt;;
mosi-pin = &amp;lt;11&amp;gt;;
miso-pin = &amp;lt;12&amp;gt;;
cs-gpios = &amp;lt;&amp;amp;gpio0 13 0&amp;gt;;

w25n01gv@0 {
//compatible = &amp;quot;winbond,w25q32&amp;quot;, &amp;quot;jedec,spi-nor&amp;quot;;
compatible = &amp;quot;jedec,spi-nor&amp;quot;;
label = &amp;quot;W25N01GV&amp;quot;;
reg = &amp;lt;0&amp;gt;;
jedec-id = [ef AA 21];
size = &amp;lt;0x4000000&amp;gt;;
spi-max-frequency = &amp;lt;4000000&amp;gt;;
};
};

&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;proj.conf&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_STDOUT_CONSOLE=y
CONFIG_FLASH=y
CONFIG_SPI=y
CONFIG_SPI_NOR=y&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;In the output it says that:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1608726002482v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Can you guide me please what I am missing?&lt;/p&gt;
&lt;p&gt;Thank you for the help so much&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading JEDEC ID with SPI on nrf9160</title><link>https://devzone.nordicsemi.com/thread/286425?ContentTypeID=1</link><pubDate>Wed, 23 Dec 2020 10:41:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:de673584-c2f0-4699-9bf3-e5ccc497bfb4</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;Check out &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/64355/is-there-any-spi-example-of-ncs-v1-3-to-refer-to/262533#262533"&gt;this ticket&lt;/a&gt;, where a customer was able to read the JEDEC ID. The sample used is also attached in that ticket.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading JEDEC ID with SPI on nrf9160</title><link>https://devzone.nordicsemi.com/thread/285610?ContentTypeID=1</link><pubDate>Thu, 17 Dec 2020 12:18:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:71619870-d2d3-489e-a7b6-bebd88cd055f</guid><dc:creator>verulia</dc:creator><description>&lt;p&gt;This is what I am seeing on logic analyzer with my initial code(without removing cpol):&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/700x480/__key/communityserver-discussions-components-files/4/LogicAnalzer.PNG" /&gt;&lt;/p&gt;
&lt;p&gt;This is what I am seeing after I remove cpol:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/700x480/__key/communityserver-discussions-components-files/4/Ekran-Al_3101_nt_3101_s_3101_2.PNG" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading JEDEC ID with SPI on nrf9160</title><link>https://devzone.nordicsemi.com/thread/285606?ContentTypeID=1</link><pubDate>Thu, 17 Dec 2020 12:04:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bc2c6e43-f26b-4bba-83e2-1de0ef1ef64c</guid><dc:creator>verulia</dc:creator><description>&lt;p&gt;Hi Simon,&lt;/p&gt;
&lt;p&gt;I tried your last advice&amp;nbsp; but then I always received 0.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading JEDEC ID with SPI on nrf9160</title><link>https://devzone.nordicsemi.com/thread/285479?ContentTypeID=1</link><pubDate>Thu, 17 Dec 2020 02:10:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7fda5e77-c91a-4b75-abf0-a849e940a834</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;Could you test your initial code with&amp;nbsp;SPI_MODE_CPOL removed from&amp;nbsp;spi_cfg = {.operation...&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading JEDEC ID with SPI on nrf9160</title><link>https://devzone.nordicsemi.com/thread/284701?ContentTypeID=1</link><pubDate>Mon, 14 Dec 2020 08:46:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9075a946-e99d-47dc-a6c2-a0d042a9138d</guid><dc:creator>verulia</dc:creator><description>&lt;p&gt;Hi Simon,&lt;/p&gt;
&lt;p&gt;Thank you so much for this detailed answer, that&amp;#39;s so helpful but I couldn&amp;#39;t understand some parts. You said that&amp;nbsp;&amp;quot;Try setting them manually, it seems like it&amp;#39;s &amp;quot; for cs pin. Do you mean should I have to delete the part above&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;struct device * gpio_dev;
struct spi_cs_control cs_control;

gpio_dev = device_get_binding(&amp;quot;GPIO_0&amp;quot;);
if (!gpio_dev) {
  printk(&amp;quot;could not find GPIO device\n&amp;quot;);
  return;
}
cs_control.delay = 0;
cs_control.gpio_dev = gpio_dev;
cs_control.gpio_pin = 13;
spi_cfg.cs = &amp;amp; cs_control;&lt;/pre&gt;&lt;br /&gt;and add only&amp;nbsp; &amp;quot;&lt;span&gt;cs-gpios = &amp;lt;&amp;amp;gpio0 13 0&amp;gt;;&amp;quot; to the overlay file?&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;And for the other parts in these links&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/3c41201293627ba3208e40de06ab117355fabe57/drivers/flash/spi_nor.c#L843-L845"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/3c41201293627ba3208e40de06ab117355fabe57/drivers/flash/spi_nor.c#L843-L845&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/3c41201293627ba3208e40de06ab117355fabe57/drivers/flash/spi_nor.c#L847-L858"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/3c41201293627ba3208e40de06ab117355fabe57/drivers/flash/spi_nor.c#L847-L858&lt;/a&gt;&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I didn&amp;#39;t understand it clearly, where should I have to add these parts? Inside the main.c?&lt;/p&gt;
&lt;p&gt;Thank you so much&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading JEDEC ID with SPI on nrf9160</title><link>https://devzone.nordicsemi.com/thread/284661?ContentTypeID=1</link><pubDate>Sun, 13 Dec 2020 21:43:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b7801b26-b460-449e-90cb-e1956f69fd1c</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;Could you try to do the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Set up the CS pin in the overlay file like done here:
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/3062b87b5f3bba095d7bf3948cacbe43708aa8b0/boards/arm/nrf52840gmouse_nrf52840/nrf52840gmouse_nrf52840.dts#L64"&gt;https://github.com/nrfconnect/sdk-nrf/blob/3062b87b5f3bba095d7bf3948cacbe43708aa8b0/boards/arm/nrf52840gmouse_nrf52840/nrf52840gmouse_nrf52840.dts#L64&lt;/a&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Try setting them manually, it seems like it&amp;#39;s&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Set these as you&amp;#39;ve done before
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/3c41201293627ba3208e40de06ab117355fabe57/drivers/flash/spi_nor.c#L843-L845"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/3c41201293627ba3208e40de06ab117355fabe57/drivers/flash/spi_nor.c#L843-L845&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;In the code provided, it will get the DTS definitions from the&amp;nbsp;&lt;span&gt;jedec_spi_nor sub-node. You don&amp;#39;t have this sub-node in your overlay file, so you have the set these manually&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Set the rest of the spi_cfg fields like done here:&amp;nbsp;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/3c41201293627ba3208e40de06ab117355fabe57/drivers/flash/spi_nor.c#L847-L858"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/3c41201293627ba3208e40de06ab117355fabe57/drivers/flash/spi_nor.c#L847-L858&lt;/a&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;This will get the fields from the SPI node you added in the overlay file&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Read the Jedec ID like done here:
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/3c41201293627ba3208e40de06ab117355fabe57/drivers/flash/spi_nor.c#L868"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/3c41201293627ba3208e40de06ab117355fabe57/drivers/flash/spi_nor.c#L868&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/3c41201293627ba3208e40de06ab117355fabe57/drivers/flash/spi_nor.c#L622"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/3c41201293627ba3208e40de06ab117355fabe57/drivers/flash/spi_nor.c#L622&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/3c41201293627ba3208e40de06ab117355fabe57/drivers/flash/spi_nor.c#L298"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/3c41201293627ba3208e40de06ab117355fabe57/drivers/flash/spi_nor.c#L298&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/3c41201293627ba3208e40de06ab117355fabe57/drivers/flash/spi_nor.c#L256"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/3c41201293627ba3208e40de06ab117355fabe57/drivers/flash/spi_nor.c#L256&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Could you upload an image of the logic analyzer output?&lt;/p&gt;
&lt;p&gt;Do you see that CS pin go from high to low?&lt;/p&gt;
&lt;p&gt;Could you try to attach the logic analyzer to the SPI pins when you&amp;#39;re running the loopback (when everything works) code as well? Just to make sure you are actually able to read the signals properly.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading JEDEC ID with SPI on nrf9160</title><link>https://devzone.nordicsemi.com/thread/284647?ContentTypeID=1</link><pubDate>Sun, 13 Dec 2020 13:24:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c3151e5b-a663-4ea2-b92a-8dacf6e90b76</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;I modified your ticket by placing all the code snippets into code-containers (click on Insert--&amp;gt;Code) to make it more readable, I hope you don&amp;#39;t mind. I&amp;#39;ll look into your issue and see if I can get to the bottom of it.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>