<?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 end of TX</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/90714/spi-end-of-tx</link><description>Hi there, 
 We&amp;#39;re using nRF52840, IAR 8.40.1, nRF5_SDK_16.0.0_98a08e2. My question is, I need to toggle a GPIO pin right after SPI finishes the TX transaction and right before it starts the RX transaction. Is it possible to do that? If yes, where in the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 18 Aug 2022 23:53:54 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/90714/spi-end-of-tx" /><item><title>RE: SPI end of TX</title><link>https://devzone.nordicsemi.com/thread/382358?ContentTypeID=1</link><pubDate>Thu, 18 Aug 2022 23:53:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b4007c5f-8120-40de-a29d-2efcb695aec4</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;You&amp;#39;re welcome but note you can do 3-wire SPI without a hardware hack or DCX which means you can use any of the 4 SPIM channels. I can post details if needed.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI end of TX</title><link>https://devzone.nordicsemi.com/thread/382356?ContentTypeID=1</link><pubDate>Thu, 18 Aug 2022 23:13:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:468e9323-3122-4b26-aac0-f4c82cd21094</guid><dc:creator>Cecylia</dc:creator><description>&lt;p&gt;That&amp;#39;s a great idea! &amp;nbsp;But, after discussing with the HW team, we ended up using 1 SPI and did some tricks to enable multiple slaves. &amp;nbsp;&lt;br /&gt;&lt;br /&gt;This DCX ended up getting used for our &amp;quot;hack&amp;quot; of a 3-wire SPI, btw. &amp;nbsp;So when DCX is high, we send MOSI and when DCX is low, we get MISO &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;We got it working now. &amp;nbsp;Thanks again &lt;a href="https://devzone.nordicsemi.com/members/hmolesworth"&gt;hmolesworth&lt;/a&gt;&amp;nbsp;! :D&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/IMG_5F00_0069-2.JPG" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI end of TX</title><link>https://devzone.nordicsemi.com/thread/381067?ContentTypeID=1</link><pubDate>Wed, 10 Aug 2022 21:25:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c8b01c4d-6bc9-49e9-b08c-7dff9872466b</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;You&amp;#39;re very welcome. If you can spare another pin and don&amp;#39;t require simultaneous SPI to both devices maybe use 2 x /CS, one for each device, and change the .cs pin before each transfer. The other signals can all be common between the devices.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI end of TX</title><link>https://devzone.nordicsemi.com/thread/381066?ContentTypeID=1</link><pubDate>Wed, 10 Aug 2022 21:13:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6f46a176-74b3-4df5-a736-c1ef01decf76</guid><dc:creator>Cecylia</dc:creator><description>&lt;p&gt;I ported the nrfx_spim driver from SDK 16&amp;#39;s examples. &amp;nbsp;I could successfully toggled the&amp;nbsp;GPIO pin. &amp;nbsp;Very nice! &amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/IMG_5F00_9970.jpeg" /&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m supposed to do this to 2 SPI, though. &amp;nbsp;And, this extended feature only works for one SPI - SPIM3. &amp;nbsp;I guess, I still need to figure out what to do with the other SPI.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;This is very helpful, though. &amp;nbsp;Thank you very much &lt;a href="https://devzone.nordicsemi.com/members/hmolesworth"&gt;hmolesworth&lt;/a&gt;&amp;nbsp;!&lt;br /&gt;&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/members/edvin-holmseth"&gt;Edvin&lt;/a&gt;&amp;nbsp;any other suggestions? At least for the other SPI?&lt;br /&gt;&lt;br /&gt;Thanks,&lt;br /&gt;Cecylia&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI end of TX</title><link>https://devzone.nordicsemi.com/thread/380903?ContentTypeID=1</link><pubDate>Wed, 10 Aug 2022 00:30:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:73e4b4db-1cdb-4d1d-ab6d-e28bb31c5600</guid><dc:creator>Cecylia</dc:creator><description>&lt;p&gt;Cool! &amp;nbsp;I saw nrfx_spim in the examples directory. &amp;nbsp;So I&amp;#39;m going to try that first. &amp;nbsp;Thanks so much &lt;a href="https://devzone.nordicsemi.com/members/hmolesworth"&gt;hmolesworth&lt;/a&gt;&amp;nbsp;!!&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI end of TX</title><link>https://devzone.nordicsemi.com/thread/380692?ContentTypeID=1</link><pubDate>Tue, 09 Aug 2022 00:31:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:32d9d8e4-976b-4b8d-9c11-28bcebee997e</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;(NRFX_SPIM_EXTENDED_ENABLED needs to be set to enable the DCX stuff in nrfx_spim.h - DCX allows multiple lead bytes, probably what you are looking for. Common with some displays; may need later SDKs v17 on, not sure about SDK16 but you can copy the v17 stuff to v16, fairly straightforward.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI end of TX</title><link>https://devzone.nordicsemi.com/thread/380685?ContentTypeID=1</link><pubDate>Mon, 08 Aug 2022 23:04:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a7d9529a-42e8-445d-9d2a-3f684834aed0</guid><dc:creator>Cecylia</dc:creator><description>&lt;p&gt;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/members/hmolesworth"&gt;hmolesworth&lt;/a&gt;&amp;nbsp;thanks! That sounds very much like what I&amp;#39;m looking for.&lt;br /&gt;&lt;br /&gt;I&amp;#39;m going to find more examples on how to set the DCX pin.&amp;nbsp; But, from quick&amp;nbsp;browsing on the SDK,&amp;nbsp;it looks like I will have to change the nrf_drv_spi_init() in the driver? Because during this SPI init, it will call SPIM init, but I don&amp;#39;t see any code that sets &amp;#39;dcx_pin&amp;#39;.&lt;br /&gt;&lt;br /&gt;Did you have to change the driver, too?&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;ret_code_t nrf_drv_spi_init(nrf_drv_spi_t const * const p_instance,
                            nrf_drv_spi_config_t const * p_config,
                            nrf_drv_spi_evt_handler_t    handler,
                            void *                       p_context)
{
...

#ifdef SPIM_PRESENT
        nrfx_spim_config_t config_spim = NRFX_SPIM_DEFAULT_CONFIG;
        config_spim.sck_pin        = p_config-&amp;gt;sck_pin;
        config_spim.mosi_pin       = p_config-&amp;gt;mosi_pin;
        config_spim.miso_pin       = p_config-&amp;gt;miso_pin;
        config_spim.ss_pin         = p_config-&amp;gt;ss_pin;
        config_spim.irq_priority   = p_config-&amp;gt;irq_priority;
        config_spim.orc            = p_config-&amp;gt;orc;
        
// Where can we set the &amp;#39;dcx_pin&amp;#39;??? Need to modify nrf_drv_spi_init??? 

        config_spim.frequency      = (nrf_spim_frequency_t)p_config-&amp;gt;frequency;
        config_spim.mode           = (nrf_spim_mode_t)p_config-&amp;gt;mode;
        config_spim.bit_order      = (nrf_spim_bit_order_t)p_config-&amp;gt;bit_order;
        result = nrfx_spim_init(&amp;amp;p_instance-&amp;gt;u.spim,
                                &amp;amp;config_spim,
                                handler ? spim_evt_handler : NULL,
                                (void *)inst_idx);
#endif&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI end of TX</title><link>https://devzone.nordicsemi.com/thread/380454?ContentTypeID=1</link><pubDate>Fri, 05 Aug 2022 23:59:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d0e1d23f-68ee-4413-99f8-4cf9b7294d34</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;Maybe just use the DCX function available on SPIM3 to drive the pin&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/DCX.JPG" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI end of TX</title><link>https://devzone.nordicsemi.com/thread/380453?ContentTypeID=1</link><pubDate>Fri, 05 Aug 2022 23:25:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b10c6a6a-b7a4-4d6b-bb8f-35ef2b0b634a</guid><dc:creator>Cecylia</dc:creator><description>&lt;p&gt;Hi Edvin,&lt;/p&gt;
[quote userid="26071" url="~/f/nordic-q-a/90714/spi-end-of-tx/380409"]That depends on the application and the HW that you are connecting to. It depends on how many bytes that you expect to write, and how many bytes you expect to receive, if any.&amp;nbsp;[/quote]
&lt;p&gt;Suppose we&amp;#39;re just sending one byte and expect to receive back one byte, how would you go about intercepting the code right before we receive back the&amp;nbsp;MISO?&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1659741885326v1.png" alt=" " /&gt;&lt;/p&gt;
[quote userid="26071" url="~/f/nordic-q-a/90714/spi-end-of-tx/380409"]&lt;p&gt;This will give you a callback event spi_event_handler() in main.c when you receive data.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;[/quote]
&lt;p&gt;But I need to intercept &lt;em&gt;before&lt;/em&gt; MISO comes in. &amp;nbsp;The spi_event_handler() is typically called &lt;em&gt;after&lt;/em&gt; the whole MOSI+MISO transaction is finished.&lt;br /&gt;&lt;br /&gt;Thank you,&lt;br /&gt;Cecylia&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI end of TX</title><link>https://devzone.nordicsemi.com/thread/380409?ContentTypeID=1</link><pubDate>Fri, 05 Aug 2022 13:44:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bc8d8190-5e61-4ead-8584-b4c09646526a</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello Cecylia,&lt;/p&gt;
[quote user=""]&lt;p&gt;NRF_SPIM_EVENT_ENDTX&lt;/p&gt;
&lt;p&gt;Is this the event where we just finished sending to MOSI and are about to receive from MISO?&lt;/p&gt;[/quote]
&lt;p&gt;That depends on the application and the HW that you are connecting to. It depends on how many bytes that you expect to write, and how many bytes you expect to receive, if any.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;If you want to do some testing, you can test the example found in SDK\examples\peripheral\spi.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This will give you a callback event spi_event_handler() in main.c when you receive data.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>