<?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 ADC and writting in SD over SPI</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/18401/sample-adc-and-writting-in-sd-over-spi</link><description>Hello, 
 I&amp;#39;m sampling the ADC using PPI like in the saadc example of the sdk12. For the ADC I use
TIMER 1. 
 And I want to write those ADC values on a SD Card over SPI. For that I&amp;#39;m using the fatfs example (SPI0 is used, I think without DMA). 
 Sampling</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 16 Dec 2016 15:07:07 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/18401/sample-adc-and-writting-in-sd-over-spi" /><item><title>RE: Sample ADC and writting in SD over SPI</title><link>https://devzone.nordicsemi.com/thread/71027?ContentTypeID=1</link><pubDate>Fri, 16 Dec 2016 15:07:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:88bab54f-0275-4cdb-8862-2653b42579e2</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;This will be answered in the other thread.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sample ADC and writting in SD over SPI</title><link>https://devzone.nordicsemi.com/thread/71026?ContentTypeID=1</link><pubDate>Fri, 16 Dec 2016 10:07:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cc205b8e-c51c-4347-b019-2029ea5dd011</guid><dc:creator>Ankush</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I was facing the same issue, as I was writing to SD card in SAADC callback interrupt.So, as Ole mentioned, now I am setting one flag and checking the same in main function.[Here] (&lt;a href="https://devzone.nordicsemi.com/question/107383/how-to-write-to-sd-card-at-high-rate/)"&gt;devzone.nordicsemi.com/.../)&lt;/a&gt; I have uploaded the code for writing to SD card.&lt;/p&gt;
&lt;p&gt;But here I am facing some issues like, The code getting restarted when it writes some kb&amp;#39;s in SD card. Also Apart from the file into which i am writing data, multiple files are being generated.&lt;/p&gt;
&lt;p&gt;Does anyone has any idea about this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sample ADC and writting in SD over SPI</title><link>https://devzone.nordicsemi.com/thread/71025?ContentTypeID=1</link><pubDate>Thu, 15 Dec 2016 12:08:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0a67eb3a-2cd9-4fae-82dd-550cf668e32e</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;Are you calling the write function inside an interrupt (like the saadc done interrupt/callback)?&lt;/p&gt;
&lt;p&gt;In that case if SAADC and SPI0 is running on the same interrupt level the application will probably be stuck. Looks like the write function does not return until it has written all its data to the SD card. Also looks like SPI driver is set up as non-blocking/interrupt driven. This means that the write function will wait for SPI interrupt(s). If you wait for an interrupt in another interrupt at the same level, the code is stuck.&lt;/p&gt;
&lt;p&gt;The solution to this is to either set a variable in the interrupt and then check the variable in main and call the function if the variable is set or to use the scheduler (check out &lt;a href="https://devzone.nordicsemi.com/tutorials/23"&gt;this&lt;/a&gt; tutorial).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>