<?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>nrf52dk not able to build the SPI project.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/118741/nrf52dk-not-able-to-build-the-spi-project</link><description>Hello, 
 We are using nrf52dk, with zephyr OS also we have done the setup in VS code with extension. 
 Toolchain version: v2.9.0 
 SDK version: 3.7.99-ncs2, these all came in extension of nrf connect in vs code. 
 Expectation: We need to communicate the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 10 Feb 2025 12:54:05 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/118741/nrf52dk-not-able-to-build-the-spi-project" /><item><title>RE: nrf52dk not able to build the SPI project.</title><link>https://devzone.nordicsemi.com/thread/522192?ContentTypeID=1</link><pubDate>Mon, 10 Feb 2025 12:54:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:21779417-0a36-49f8-85a7-98edcdaeaa67</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;There are three alternatives as I see it:&lt;/p&gt;
&lt;p&gt;1. I see that zephyr has drivers for some different max chips. See &lt;a href="https://docs.zephyrproject.org/latest/samples/sensor/sensor.html"&gt;sensor samples&lt;/a&gt;. While this is not the exact sensor you got, sometimes the interface is similar enough so that you can just use the same driver. Worth a try.&lt;/p&gt;
&lt;p&gt;2.&amp;nbsp; Learn how to use SPI in our &lt;a href="https://academy.nordicsemi.com/courses/nrf-connect-sdk-intermediate/lessons/lesson-5-serial-peripheral-interface-spi/"&gt;DevAcademy lesson&amp;nbsp; on SPI&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;3. If you want to integrate the sensor more properly, but wich requires some more work: see &lt;a href="https://academy.nordicsemi.com/courses/nrf-connect-sdk-intermediate/lessons/lesson-7-device-driver-model/"&gt;DevAcademy Intermediate: Lesson 7 – Device driver model&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52dk not able to build the SPI project.</title><link>https://devzone.nordicsemi.com/thread/521949?ContentTypeID=1</link><pubDate>Fri, 07 Feb 2025 13:31:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2de4662d-081a-4533-a0e7-7693d3c8cbbb</guid><dc:creator>Sagar Patel</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;
&amp;amp;spi1 {
	compatible = &amp;quot;nordic,nrf-spi&amp;quot;;
	status = &amp;quot;okay&amp;quot;;
	pinctrl-0 = &amp;lt;&amp;amp;spi1_default&amp;gt;;
	pinctrl-1 = &amp;lt;&amp;amp;spi1_sleep&amp;gt;;
	pinctrl-names = &amp;quot;default&amp;quot;, &amp;quot;sleep&amp;quot;;
	cs-gpios = &amp;lt;&amp;amp;gpio0 28 GPIO_ACTIVE_LOW&amp;gt;;
	reg_my_spi_master: spi-dev-a@0 {
		reg = &amp;lt;0&amp;gt;;
		spi-max-frequency = &amp;lt;4000000&amp;gt;;  // Set frequency to 4 MHz
	};
};&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Overlay file&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52dk not able to build the SPI project.</title><link>https://devzone.nordicsemi.com/thread/521948?ContentTypeID=1</link><pubDate>Fri, 07 Feb 2025 13:30:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:40d2d225-7cff-417b-951c-c5ef3ce9112d</guid><dc:creator>Sagar Patel</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;zephyr/kernel.h&amp;gt;
#include &amp;lt;zephyr/drivers/gpio.h&amp;gt;
#include &amp;lt;zephyr/drivers/spi.h&amp;gt;

static const struct spi_dt_spec spi1_spec = SPI_DT_SPEC_GET(
    DT_NODELABEL(reg_my_spi_master),  // Device tree node label
    SPI_WORD_SET(8),                  // 8-bit word size
    0                                 // CS release delay
);

static void readRegister()
{
	int err;
	uint8_t chip_id[3];
	uint8_t spiTxCommand[1];
	spiTxCommand[0] = ((0x0F &amp;lt;&amp;lt; 1) | 0x01);

	const struct spi_buf tx_buf = {
		.buf = &amp;amp;spiTxCommand,
		.len = sizeof(spiTxCommand)
	};

    const struct spi_buf_set tx = {
		.buffers = &amp;amp;tx_buf,
		.count = 1
	};

    struct spi_buf rx_buf[2] = {
		{
			.buf = NULL,
			.len = 1
		},
		{
			.buf = chip_id,
			.len = 3
		}
	}; // 24 bit register + 1 dummy byte
    
	const struct spi_buf_set rx = {
		.buffers = rx_buf,
		.count = 2
	};
	
	do
	{
		err = spi_transceive_dt(&amp;amp;spi1_spec, &amp;amp;tx, &amp;amp;rx);
		if (err  &amp;lt; 0) { break; }

	} while (false);

	printk(&amp;quot;MAX30001 ID: 0x%02X 0x%02X 0x%02X\n&amp;quot;, (uint8_t)chip_id[0], (uint8_t)chip_id[1], (uint8_t)chip_id[2]);
}


int main(void)
{
	if (!spi_is_ready_dt(&amp;amp;spi1_spec)) {
		printf(&amp;quot;SPI1 DEV NOT READY\n&amp;quot;);
		return 0;
	}

	readRegister();

	while (1) {
		readRegister();
		k_msleep(1000);
	}
	return 0;
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52dk not able to build the SPI project.</title><link>https://devzone.nordicsemi.com/thread/521947?ContentTypeID=1</link><pubDate>Fri, 07 Feb 2025 13:29:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6e8086a2-eb7d-4958-ae28-2fc217463668</guid><dc:creator>Sagar Patel</dc:creator><description>&lt;p&gt;I have attached the logs&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;FAILED: CMakeFiles/app.dir/src/main.c.obj 
C:/nrf52/my_sample/sample_SPI/build/sample_SPI/zephyr/include/generated/zephyr/devicetree_generated.h:12836:42: error: &amp;#39;DT_N_S_soc_S_spi_40004000_S_spi_dev_a_0_P_frame_format&amp;#39; undeclared here (not in a function); did you mean &amp;#39;DT_N_S_soc_S_spi_40004000_S_spi_dev_a_0_P_reg&amp;#39;?
12836 | #define DT_N_NODELABEL_reg_my_spi_master DT_N_S_soc_S_spi_40004000_S_spi_dev_a_0
      |                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/ncs/v2.9.0/zephyr/include/zephyr/devicetree.h:4879:29: note: in definition of macro &amp;#39;DT_CAT3&amp;#39;
 4879 | #define DT_CAT3(a1, a2, a3) a1 ## a2 ## a3
      |                             ^~
C:/ncs/v2.9.0/zephyr/include/zephyr/drivers/spi.h:352:25: note: in expansion of macro &amp;#39;DT_PROP&amp;#39;
  352 |                         DT_PROP(node_id, frame_format) |                        \
      |                         ^~~~~~~
C:/ncs/v2.9.0/zephyr/include/zephyr/drivers/spi.h:404:27: note: in expansion of macro &amp;#39;SPI_CONFIG_DT&amp;#39;
  404 |                 .config = SPI_CONFIG_DT(node_id, operation_, delay_) \
      |                           ^~~~~~~~~~~~~
C:/nrf52/my_sample/sample_SPI/src/main.c:10:45: note: in expansion of macro &amp;#39;SPI_DT_SPEC_GET&amp;#39;
   10 | static const struct spi_dt_spec spi1_spec = SPI_DT_SPEC_GET(
      |                                             ^~~~~~~~~~~~~~~
C:/ncs/v2.9.0/zephyr/include/zephyr/devicetree.h:4877:24: note: in expansion of macro &amp;#39;DT_N_NODELABEL_reg_my_spi_master&amp;#39;
 4877 | #define DT_CAT(a1, a2) a1 ## a2
      |                        ^~
C:/ncs/v2.9.0/zephyr/include/zephyr/devicetree.h:200:29: note: in expansion of macro &amp;#39;DT_CAT&amp;#39;
  200 | #define DT_NODELABEL(label) DT_CAT(DT_N_NODELABEL_, label)
      |                             ^~~~~~
C:/nrf52/my_sample/sample_SPI/src/main.c:11:5: note: in expansion of macro &amp;#39;DT_NODELABEL&amp;#39;
   11 |     DT_NODELABEL(reg_my_spi_master),  // Device tree node label
      |     ^~~~~~~~~~~~
[47/148] Building C object zephyr/arch/arch/arm/core/cortex_m/CMakeFiles/arch__arm__core__cortex_m.dir/scb.c.obj
ninja: build stopped: subcommand failed.
FAILED: _sysbuild/sysbuild/images/sample_SPI-prefix/src/sample_SPI-stamp/sample_SPI-build C:/nrf52/my_sample/sample_SPI/build/_sysbuild/sysbuild/images/sample_SPI-prefix/src/sample_SPI-stamp/sample_SPI-build &lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>