<?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>AD5721R problem with SPI latency</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/45659/ad5721r-problem-with-spi-latency</link><description>Hi, 
 I am working on a project where I need to create a ~23 kHz square wave signal with a 12-bit DAC ( AD5721 ). The communication works via SPI. 
 I got it working alright by using the spi driver and the timer driver. The problem is, I can’t reach the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 08 Apr 2019 09:30:19 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/45659/ad5721r-problem-with-spi-latency" /><item><title>RE: AD5721R problem with SPI latency</title><link>https://devzone.nordicsemi.com/thread/180688?ContentTypeID=1</link><pubDate>Mon, 08 Apr 2019 09:30:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c0e43d66-e186-4485-a401-4406ec4e3cec</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I suspect this works &amp;quot;better&amp;quot; because you don&amp;#39;t have any interrupt delays.&amp;nbsp;If you are using the driver in blocking mode (e.g. no callback handler registered when init spi driver), then this should be a safe usage.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: AD5721 problem with SPI speed</title><link>https://devzone.nordicsemi.com/thread/180485?ContentTypeID=1</link><pubDate>Fri, 05 Apr 2019 12:06:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:085077ba-0067-4ffd-aae5-c148188fc76f</guid><dc:creator>Niklas_H</dc:creator><description>&lt;p&gt;I resolved the issue by using the spi master driver instance in blocking mode.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;nrf_drv_spi_init(&amp;amp;spi, &amp;amp;spi_config, NULL,NULL);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;And by commenting out the while loop with WFE() in the write function of the DAC.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void ad5721r_write( uint8_t reg_addr_cmd, uint16_t reg_data)
{
	uint8_t data[3];
	ret_code_t ret;

	data[0] = reg_addr_cmd; 
	data[1] = (reg_data &amp;amp; 0xFF00) &amp;gt;&amp;gt; 8; 
	data[2] = (reg_data &amp;amp; 0x00FF) &amp;gt;&amp;gt; 0; 

    memset(m_rx_buf, 0, m_length);
	spi_xfer_done = 0;
	nrf_drv_spi_transfer(&amp;amp;spi, data, 3, m_rx_buf, 0);
//	while (!spi_xfer_done)
//		{
//			__WFE();
//		}
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I guess this will make it more dangerous to call it too often without checking the status of the transfer? Could this cause bigger issues when using BLE softdevice or other interrupts?&lt;/p&gt;
&lt;p&gt;So far I had no problem running the DAC at 24 KHz and higher.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: AD5721 problem with SPI speed</title><link>https://devzone.nordicsemi.com/thread/180210?ContentTypeID=1</link><pubDate>Thu, 04 Apr 2019 08:36:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0fd5f8df-2eec-4142-8ffe-b4ef172192b7</guid><dc:creator>Niklas_H</dc:creator><description>&lt;p&gt;Thanks for the quick reply.&lt;/p&gt;
&lt;p&gt;I checked, the spi driver is using EasyDMA. The application so far is pretty bare bone, no BLE softdevice or other interrupts are enabled. But I plan on using Bluetooth in the future.&lt;/p&gt;
&lt;p&gt;The timer handler works fine to toggle a specific pin. Once the SPI handler is running the pin toggle also differs in duration. I&amp;rsquo;m starting to wonder if the DAC is limiting the frequency output.&lt;/p&gt;
&lt;p&gt;I won&amp;rsquo;t be able to use the nrf58240 for my project. But good to know for future applications.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: AD5721 problem with SPI speed</title><link>https://devzone.nordicsemi.com/thread/179853?ContentTypeID=1</link><pubDate>Tue, 02 Apr 2019 19:30:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:edde3ec9-85c7-445f-abab-f984d2181513</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;I think the best option is to get yourself an nRF52840-DK instead, this chip have a new SPIM3 module with hardware SYNC (called CSN here) pin and faster clock speed:&lt;br /&gt;&lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52840.ps/spim.html?cp=2_0_0_5_24"&gt;http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52840.ps/spim.html?cp=2_0_0_5_24&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you want to continue investigate a bit the nRF52832 I would likely have tried to look at your interrupt priorities, and for instance toggle a specific pin while timer handler is executing and a different pin when spi handler is running, to check the order of the interrupts or the duration differs also here.&lt;/p&gt;
&lt;p&gt;Make sure to check if the&amp;nbsp;spi driver is using EasyDMA by looking at the sdk_config.h file, e.g.:&lt;/p&gt;
&lt;p&gt;#ifndef SPI0_USE_EASY_DMA&lt;br /&gt;#define SPI0_USE_EASY_DMA 1&lt;br /&gt;#endif&lt;/p&gt;
&lt;p&gt;Is the BLE softdevice enabled in your application? and/or other interrupts?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>