<?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>Sample program to use asynchronous SPI</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/83222/sample-program-to-use-asynchronous-spi</link><description>Hi, 
 
 I need to know on how to work with asynchronous SPI for my application use case evaluation, However i found no sample/example projects demonstrating the use of nCS API 
 Kindly point me to any example where use of &amp;quot;spi_transceive_async&amp;quot; has been</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 08 Feb 2022 14:02:38 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/83222/sample-program-to-use-asynchronous-spi" /><item><title>RE: Sample program to use asynchronous SPI</title><link>https://devzone.nordicsemi.com/thread/351840?ContentTypeID=1</link><pubDate>Tue, 08 Feb 2022 14:02:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:295b66a3-8820-4d03-a129-b71191568604</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;You have received an answer in this&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/84480/bus-fault-in-application-code-using-k_poll/"&gt;case&lt;/a&gt;.&lt;br /&gt;Since there is no benefit for our customers if we duplicate cases, please continue communication there.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sample program to use asynchronous SPI</title><link>https://devzone.nordicsemi.com/thread/351628?ContentTypeID=1</link><pubDate>Mon, 07 Feb 2022 17:30:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f076f0cb-0b66-4187-8805-0ae2087630a4</guid><dc:creator>Ubaid_M</dc:creator><description>&lt;p&gt;Hello dejans,&lt;br /&gt;&lt;br /&gt;My app code using spi_transceive_async always returns error, The API executes successfully, post which it throws a thread error&lt;br /&gt;Can you kindly suggest where it is wrong:&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;void main(void)
{	struct k_poll_signal async_sig;
	uint8_t data = 40, val =0, sz = 9;

	    struct spi_buf bufs = {
            .buf = &amp;amp;data,
            .len = sizeof(data)
    };
    struct spi_buf_set tx = {
        .buffers = &amp;amp;bufs
    };

    tx.count = 1;

	struct spi_buf rbufs = {
            .buf = &amp;amp;val,
            .len = sizeof(val)
    };
    struct spi_buf_set rx = {
        .buffers = &amp;amp;rbufs
    };

 spi_config spi_cfg;
spi_cs_control cs_ctrl;
    cs_ctrl.gpio_dev = device_get_binding(&amp;quot;GPIO_0&amp;quot;);
    cs_ctrl.gpio_pin = 11;
    cs_ctrl.delay = 0;
    spi_cfg.operation = SPI_WORD_SET(8) | SPI_OP_MODE_MASTER 
    //                    | SPI_MODE_CPOL | SPI_MODE_CPHA 
                        | SPI_LINES_SINGLE; 
    spi_cfg.frequency = 1000000;
	spi_cfg.cs = &amp;amp;cs_ctrl;

	const device * sp;
	sp = device_get_binding(&amp;quot;SPI_0&amp;quot;);

		data++;
			struct k_poll_event  async_evt =
		K_POLL_EVENT_INITIALIZER(K_POLL_TYPE_SIGNAL,
					 K_POLL_MODE_NOTIFY_ONLY,
					 &amp;amp;async_sig);

			printk(&amp;quot;transmitted data: %u \n&amp;quot;, data);
			int error = spi_transceive_async(sp,&amp;amp;spi_cfg,&amp;amp;tx, &amp;amp;rx,&amp;amp;async_sig);
			int ret = k_poll(&amp;amp;async_evt, 1, K_MSEC(1000));
			printk(&amp;quot;received data: %u \n&amp;quot;, val);

}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Error:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1644255019219v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sample program to use asynchronous SPI</title><link>https://devzone.nordicsemi.com/thread/349634?ContentTypeID=1</link><pubDate>Tue, 25 Jan 2022 17:41:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0b656717-a7ad-406b-bd7d-d988c2ea91d2</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You can read more about SPI on our documentation pages -&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/spi.html?cp=4_0_0_5_23"&gt;SPI&lt;/a&gt;,&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/spim.html?cp=4_0_0_5_24"&gt;SPIM&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/spis.html?cp=4_0_0_5_25"&gt;SPIS&lt;/a&gt;.&lt;br /&gt;You can also read more about&amp;nbsp;&lt;a href="https://docs.zephyrproject.org/latest/reference/misc/notify.html"&gt;asynchronous notifications&lt;/a&gt;&amp;nbsp;and look at&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v2.7.0-ncs1/tests/drivers/adc/adc_api/src/test_adc.c#L494"&gt;test_adc&lt;/a&gt;&amp;nbsp;example.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sample program to use asynchronous SPI</title><link>https://devzone.nordicsemi.com/thread/349444?ContentTypeID=1</link><pubDate>Tue, 25 Jan 2022 08:30:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:420d8614-9c15-488d-ad0e-32c7c72863c5</guid><dc:creator>Ubaid_M</dc:creator><description>&lt;p&gt;Hello&amp;nbsp;&lt;a class="internal-link view-user-profile" href="https://devzone.nordicsemi.com/members/dejans"&gt;dejans&lt;/a&gt;,&lt;br /&gt;&lt;br /&gt;Can you kindly point me to the difference between&amp;nbsp;synchronous SPI &amp;amp; asynchronous SPI..?&lt;br /&gt;As in I need to know where I can use&amp;nbsp;&lt;span&gt;asynchronous SPI &amp;amp; what are it&amp;#39;s use cases.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;br /&gt;&lt;br /&gt;Thanks,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Ubaid&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sample program to use asynchronous SPI</title><link>https://devzone.nordicsemi.com/thread/347140?ContentTypeID=1</link><pubDate>Tue, 11 Jan 2022 12:00:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:308200c1-ebdf-4397-b9be-b42334f5d8d1</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;With regard to k_poll_signal, please take a look at the&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.8.0/zephyr/reference/kernel/other/polling.html#polling-api"&gt;polling-api&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;For examples and depending on your use case, you could visit a page with sensor samples -&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.8.0/zephyr/samples/sensor/sensor.html"&gt;link to sensor samples&lt;/a&gt;. There you could find some SPI examples (e.g. &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.8.0/zephyr/samples/sensor/bme280/README.html"&gt;BME280 sensor&lt;/a&gt;&amp;nbsp;could be connected via SPI).&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sample program to use asynchronous SPI</title><link>https://devzone.nordicsemi.com/thread/347105?ContentTypeID=1</link><pubDate>Tue, 11 Jan 2022 09:33:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fdf8e613-9ec3-4656-a44f-fec04e72b541</guid><dc:creator>Ubaid_M</dc:creator><description>&lt;p&gt;Hello&amp;nbsp;&lt;a class="internal-link view-user-profile" href="https://devzone.nordicsemi.com/members/dejans"&gt;dejans&lt;/a&gt;,&lt;br /&gt;&lt;br /&gt;Thanks for the reference, can you please point me to a working project for&amp;nbsp;&lt;span&gt;spi_transceive_async.?!&lt;br /&gt;I mean complete with prj.conf, overlays &amp;amp; main.&lt;br /&gt;I am having difficulty setup the &amp;quot;&lt;/span&gt;k_poll_signal signal&amp;quot;, hence the request.&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;br /&gt;&lt;br /&gt;Thanks,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Ubaid&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sample program to use asynchronous SPI</title><link>https://devzone.nordicsemi.com/thread/345468?ContentTypeID=1</link><pubDate>Thu, 30 Dec 2021 12:23:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:902433b0-6515-4c59-a0ab-fe970b7ab406</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;In the nRF Connect SDK navigate to the file&amp;nbsp;zephyr\tests\drivers\spi\spi_loopback\src\spi.c and search for spi_transceive_async.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>