<?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>Can&amp;#39;t transmit single byte over SPIM with DMA</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/8904/can-t-transmit-single-byte-over-spim-with-dma</link><description>Hi, 
 We are trying to transmit a single byte over SPIM using easyDMA but our logic analyzer shows that 16 bits are being clocked out. The first 8 are our message and the second 8 are unknown (possibly the over-read char?). This can be reproduced with</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sun, 15 Apr 2018 17:14:59 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/8904/can-t-transmit-single-byte-over-spim-with-dma" /><item><title>RE: Can't transmit single byte over SPIM with DMA</title><link>https://devzone.nordicsemi.com/thread/128361?ContentTypeID=1</link><pubDate>Sun, 15 Apr 2018 17:14:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:13f0aad0-dba1-4f6c-ab8d-060c87a9e31e</guid><dc:creator>leonhart88</dc:creator><description>&lt;p&gt;I can confirm Tien&amp;#39;s solution...&lt;span&gt;doing something like the following works:&lt;br /&gt;&lt;br /&gt;nrf_drv_spi_transfer(&amp;amp;m_spi_master_0, spiTransmitBuffer, 1, NULL, 0);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't transmit single byte over SPIM with DMA</title><link>https://devzone.nordicsemi.com/thread/32761?ContentTypeID=1</link><pubDate>Wed, 22 Feb 2017 08:05:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:635ae832-1461-49ab-9d60-582a73f73b27</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Do you believe it is related to the PAN that Aryan mentions in his answer? Unfortunately there are no further updates on that.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't transmit single byte over SPIM with DMA</title><link>https://devzone.nordicsemi.com/thread/32760?ContentTypeID=1</link><pubDate>Tue, 21 Feb 2017 11:43:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:51f2081f-ff68-4db6-a7ea-b856e786d0ac</guid><dc:creator>Biketap</dc:creator><description>&lt;p&gt;I noticed the same behavior. CS goes low and goes high before next transfer(if any). Any updates on this issue??&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't transmit single byte over SPIM with DMA</title><link>https://devzone.nordicsemi.com/thread/32763?ContentTypeID=1</link><pubDate>Tue, 31 May 2016 02:24:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dab84d44-0141-4f10-aa59-95d8175b5588</guid><dc:creator>Tien</dc:creator><description>&lt;p&gt;I found another way to solve this problem. Just try RXD.MAXCNT = 0.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't transmit single byte over SPIM with DMA</title><link>https://devzone.nordicsemi.com/thread/32762?ContentTypeID=1</link><pubDate>Wed, 18 Nov 2015 08:33:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:29d9897e-4a8a-45f6-82c0-219ae4c13a92</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;There is a PAN for this with the workaround, you can see this &lt;a href="http://infocenter.nordicsemi.com/pdf/nRF52832_Errata_v1.1.pdf"&gt;here&lt;/a&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;[58] SPIM: SPIM clocks out an
additional byte when RXD.MAXCNT = 1&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;You can use the SPI module same as nRF51 (depreciated but still available at same register addresses) That SPI module can be use for one byte transfers. Else you need to use below workaround&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;/**
 * @brief Work-around for transmitting 1 byte with SPIM.
 *
 * @param spim: The SPIM instance that is in use.
 * @param ppi_channel: An unused PPI channel that will be used by the
 workaround.
 * @param gpiote_channel: An unused GPIOTE channel that will be used by
 the workaround.
 *
 * @warning Must not be used when transmitting multiple bytes.
 * @warning After this workaround is used, the user must reset the PPI
 channel and the GPIOTE channel before attempting to transmit multiple
 bytes.
 */
void setup_workaround_for_ftpan_58(NRF_SPIM_Type * spim, uint32_t
 ppi_channel, uint32_t gpiote_channel)
{
 // Create an event when SCK toggles.
 NRF_GPIOTE-&amp;gt;CONFIG[gpiote_channel] = (
 GPIOTE_CONFIG_MODE_Event &amp;lt;&amp;lt;
 GPIOTE_CONFIG_MODE_Pos
 ) | (
 spim-&amp;gt;PSEL.SCK &amp;lt;&amp;lt;
 GPIOTE_CONFIG_PSEL_Pos
 ) | (
 GPIOTE_CONFIG_POLARITY_Toggle &amp;lt;&amp;lt;
 GPIOTE_CONFIG_POLARITY_Pos
 );
 // Stop the spim instance when SCK toggles.
 NRF_PPI-&amp;gt;CH[ppi_channel].EEP = (uint32_t)&amp;amp;NRF_GPIOTE-
&amp;gt;EVENTS_IN[gpiote_channel];
 NRF_PPI-&amp;gt;CH[ppi_channel].TEP = (uint32_t)&amp;amp;spim-&amp;gt;TASKS_STOP;
 NRF_PPI-&amp;gt;CHENSET = 1U &amp;lt;&amp;lt; ppi_channel;
3 New and inherited anomalies
Page 12
 // The spim instance cannot be stopped mid-byte, so it will finish
 // transmitting the first byte and then stop. Effectively ensuring
 // that only 1 byte is transmitted.
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;What this workaround does is that it uses GPIOTE and PPI to trigger the SPI-&amp;gt;TASKS_STOP when the SPI_CLOCK toggles. And since the SPI transaction cannot be stopped mid byte, it will complete that one byte transfer.&lt;/p&gt;
&lt;p&gt;You have to remember to enable the GPIOTE and PPI channel used for this workaround just before one byte transfer and then disable them when you want to transfer multiple bytes. I verified this and it works.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't transmit single byte over SPIM with DMA</title><link>https://devzone.nordicsemi.com/thread/32759?ContentTypeID=1</link><pubDate>Fri, 13 Nov 2015 21:33:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:85cebd20-e8da-460e-a5ee-c8bf3eaec287</guid><dc:creator>Abhi</dc:creator><description>&lt;p&gt;Hello I came across this post and am having the same issue. I was wondering if you have found any solutions? What I noticed was that the CS signal goes low and then stays low when I try to send 8 bits in a format such as:&lt;/p&gt;
&lt;p&gt;uint8_t bytebuffer = 0x4E;&lt;/p&gt;
&lt;p&gt;spi_send_recv(&amp;amp;bytebuffer, NULL, 1);&lt;/p&gt;
&lt;p&gt;However if I set the length to 2, the CS behaves normally. But the functionality that I need requires 8 bits to be sent with only 8 clock cycles and then the CS should go high after the 8th. Which i haven&amp;#39;t been able to find a way to do yet using the nRF52 Preview DK.
If you could let me know about any progress on this issue or how to solve it, it would be appreciated.
Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't transmit single byte over SPIM with DMA</title><link>https://devzone.nordicsemi.com/thread/32758?ContentTypeID=1</link><pubDate>Tue, 15 Sep 2015 12:27:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:70ac25ad-1c47-4c82-9252-e1644c6b2348</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;So sorry for the late response.
It seems like you have found a product anomaly. We are working on it, but currently we have not found any workarounds.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>