<?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>Using external SPI ADC on nRF5340</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/73106/using-external-spi-adc-on-nrf5340</link><description>Hi, 
 
 I need close to 1Msps rates for my application and am planning on using a ADS7887 SPI ADC from TI. My question is on how to drive the SPIM and if an example exists to do this. 
 These SPI ADCs start the 16 bit collection on a lower going chip</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 12 Apr 2021 12:08:30 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/73106/using-external-spi-adc-on-nrf5340" /><item><title>RE: Using external SPI ADC on nRF5340</title><link>https://devzone.nordicsemi.com/thread/304263?ContentTypeID=1</link><pubDate>Mon, 12 Apr 2021 12:08:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2bd8625d-8d00-48cb-8528-62b2534e0099</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;There are drivers in nRF Connect SDK for the SAADC peripheral. Please make a new question for that though, as it is not related to the topic of this thread (using an external ADC via SPI)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using external SPI ADC on nRF5340</title><link>https://devzone.nordicsemi.com/thread/304112?ContentTypeID=1</link><pubDate>Sat, 10 Apr 2021 00:34:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:43b6f6b5-9933-44db-ae40-9c8176329577</guid><dc:creator>Natael</dc:creator><description>&lt;p&gt;Hi guys,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I would like to ask you if in nRF5340 works the ADC.&lt;/p&gt;
&lt;p&gt;I have been trying to configure It but It fails on:&lt;/p&gt;
&lt;p&gt;ADC= device_get_binding (&amp;quot;ADC&amp;quot;);&lt;/p&gt;
&lt;p&gt;I have also chances the .prog file and the overlay but the error keeps going&lt;/p&gt;
&lt;p&gt;Any sugesttion?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using external SPI ADC on nRF5340</title><link>https://devzone.nordicsemi.com/thread/302070?ContentTypeID=1</link><pubDate>Fri, 26 Mar 2021 08:51:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bedb107d-6fdc-4059-94e5-5412329a0f16</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Sergio,&lt;/p&gt;
&lt;p&gt;I see. Then this should be possible the way you describe. You need to use array list. Then use a timer to control CS via PPI and GPIOTE and also to trigger the START task. You probably want to use a separate CC register for this as the START task needs to be triggered a little later depending on what timing you need. Then also reset the timer on this. This way there will be no CPU intervention needed while sampling the whole set of sample, only for setting it up (and for any subsequent processing).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using external SPI ADC on nRF5340</title><link>https://devzone.nordicsemi.com/thread/301973?ContentTypeID=1</link><pubDate>Thu, 25 Mar 2021 15:43:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1c32e5ba-2bdb-424c-bd92-eac4ee29f022</guid><dc:creator>sssergsss</dc:creator><description>&lt;p&gt;Hi Einar,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The ADC collects 16 bits on per CS period, kicked off by a falling edge CS.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;There is a 10nS setups time from CSlow to SCLKlow.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The CS signal must stay high a min of 40nS after 16 SCLKs&amp;nbsp;&lt;/p&gt;
&lt;p&gt;See the image below.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/ADS7887.JPG" /&gt;&lt;/p&gt;
&lt;p&gt;We want to get as close to 1Msps as possible.&amp;nbsp; I want to collect 5K data samples. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;The idea is to drive CS (start of SPI task) with a timer and I believe use EasyDMA ist functions.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks for your help,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Sergio&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using external SPI ADC on nRF5340</title><link>https://devzone.nordicsemi.com/thread/301860?ContentTypeID=1</link><pubDate>Thu, 25 Mar 2021 10:42:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:443d9265-148b-413b-97d3-d056ebd31e20</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Yes, I can try to explain more. But for that, please clarify precisely how the SPI transaction(s) should be including timing, CS etc. I do not know your ADC IC so please explain in detail seen form SPI. Also explain how sampling is triggered. Should you read 2 bytes at a regular frequency (sampling frequency), read x bytes in bursts how often, etc.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using external SPI ADC on nRF5340</title><link>https://devzone.nordicsemi.com/thread/301755?ContentTypeID=1</link><pubDate>Wed, 24 Mar 2021 15:56:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:46afe91a-b931-4f2d-b871-e1777cc88678</guid><dc:creator>sssergsss</dc:creator><description>&lt;p&gt;Hi Einar,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;We are new to Nordic and have our nRF9160 and nRF5340 kits on the way so initial experience is going to determine whether we use Nordic in our product.&amp;nbsp; We want to reduce our learning curve as much as possible.&amp;nbsp; Instead of me guessing/proposing would it be possible to use your expertise and write down the exact steps so we need to take to accomplish this task of reading ADC values via the SPI port?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks in advance.&amp;nbsp; &amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using external SPI ADC on nRF5340</title><link>https://devzone.nordicsemi.com/thread/301681?ContentTypeID=1</link><pubDate>Wed, 24 Mar 2021 13:04:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a6293581-f0fa-456a-8b01-025f4c4ad784</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;This seems mostly sensible. However, unless you want to transfer data as fast as possible you may want to use a TIMER to trigger the START task and not a short between END and START.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using external SPI ADC on nRF5340</title><link>https://devzone.nordicsemi.com/thread/301515?ContentTypeID=1</link><pubDate>Tue, 23 Mar 2021 15:55:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d393a65c-9b6e-43c5-8e6b-da1b18aca3c1</guid><dc:creator>sssergsss</dc:creator><description>&lt;p&gt;Hi Einar,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The 1Msps is required for the application unfortunately.&amp;nbsp; What we would like to do is to collect 1K samples as easy as possible ideally without without firmware intervention. Once samples are collected then I can take as much time as possible to process.&amp;nbsp; I need my sample rate to be very precise.&amp;nbsp; &amp;nbsp;Let me know if this is correct.&lt;/p&gt;
&lt;p&gt;1. Using Easy DMA list I set the pointer and size of the buffer.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;2. I enable the SHORTS register, start my SPIM task with RX buffer set to two bytes.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;3. On End event data will be written automatically and the Easy DMA list feature will update the pointer.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;4. The SHORTS will then restart the SPIM task?&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I probably have this wrong but getting closer.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using external SPI ADC on nRF5340</title><link>https://devzone.nordicsemi.com/thread/301480?ContentTypeID=1</link><pubDate>Tue, 23 Mar 2021 14:34:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c0dc3d3b-f222-47ff-ad6e-850b7dd8bf6e</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;1 Msps seems like much, especially if you need to also process the data at some point. Will every 16 bit sample be a separate SPI transaction? If so, you may want to look into the Easy DMA list feature (see SPIM chapter in product specification). If not and you just stream data, then you can set the DMA buffer to a sensible size and get a interrupt once the buffer is filled and you process the data, while another buffer is being filled.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The SPIM peripheral on the nRF53 supports controlling the CS line in HW. Alternatively you could also control it from a TIMER or using PPI and GPIOTE, depending on what fits your requirements.&lt;/p&gt;
&lt;p&gt;You may also want to look into the nrfx_spim driver API:&amp;nbsp;&lt;a href="https://github.com/NordicSemiconductor/nrfx/blob/master/drivers/include/nrfx_spim.h"&gt;https://github.com/NordicSemiconductor/nrfx/blob/master/drivers/include/nrfx_spim.h&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>