<?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>SD-Card writing blocks ADC</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/18493/sd-card-writing-blocks-adc</link><description>Hello, 
 I&amp;#39;m trying to write my ADC samples over spi on a sd card (Using SAADC like in the sdk 12 example with PPI and using fatfs like in the example in the sdk). 
 I open the file I want to write in only once in the beginning and close it in the end</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 13 Jan 2017 12:44:48 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/18493/sd-card-writing-blocks-adc" /><item><title>RE: SD-Card writing blocks ADC</title><link>https://devzone.nordicsemi.com/thread/71351?ContentTypeID=1</link><pubDate>Fri, 13 Jan 2017 12:44:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:20c400e2-701e-40fe-a4b1-b7acf4820045</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;If your code is restarting it may be because the code entered an error condition. Try to define DEBUG globally, go into debug mode and check where you get an error, see &lt;a href="https://devzone.nordicsemi.com/question/60125/my-device-is-freezing-and-restarting/"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SD-Card writing blocks ADC</title><link>https://devzone.nordicsemi.com/thread/71350?ContentTypeID=1</link><pubDate>Fri, 13 Jan 2017 11:05:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b74f3d20-ec42-4af1-abbf-d117cd62828d</guid><dc:creator>Lea</dc:creator><description>&lt;p&gt;I can only tell what settings I made. My init Frequency is 250kHz and my APP_SDCARD_FREQ_DATA is set to 8 MHz. But i think if this would be the problem no data should be written on your card. Have you tried using a different sd card or setting down your samplingrate?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SD-Card writing blocks ADC</title><link>https://devzone.nordicsemi.com/thread/71349?ContentTypeID=1</link><pubDate>Fri, 13 Jan 2017 10:56:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e9a9304d-8305-45be-8192-1b6343aaf867</guid><dc:creator>Ankush</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Some data is being written on SD card card but after some time code gets restarted. Is it the issue of clock frequency of SPI or sampling frequency of SAADC. &lt;code&gt;SPI0_DEFAULT_FREQUENCY&lt;/code&gt; and &lt;code&gt;APP_SDCARD_FREQ_INIT&lt;/code&gt; are set to 4 MHz. and Sampling frequency of SAADC is 1000sps. I am sampling SAADC using PPI.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SD-Card writing blocks ADC</title><link>https://devzone.nordicsemi.com/thread/71348?ContentTypeID=1</link><pubDate>Fri, 13 Jan 2017 10:52:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2742c36c-5593-41e3-81a9-97ae1b0dff51</guid><dc:creator>Ankush</dc:creator><description>&lt;p&gt;Yes, exactly I have used &lt;code&gt;SPI_DEFAULT_CONFIG_IRQ_PRIORITY&lt;/code&gt; as 3 to set priority level for SPI(SD card).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SD-Card writing blocks ADC</title><link>https://devzone.nordicsemi.com/thread/71347?ContentTypeID=1</link><pubDate>Fri, 13 Jan 2017 10:49:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8d59a1c5-88cc-4436-8e21-67e63aa3824a</guid><dc:creator>Lea</dc:creator><description>&lt;p&gt;So did you set the interrupt priority of the spi by setting the SPI_DEFAULT_CONFIG_IRQ_PRIORITY in the sdk_config.h? Because the app_sdcard.c file uses this define for setting the priority.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SD-Card writing blocks ADC</title><link>https://devzone.nordicsemi.com/thread/71346?ContentTypeID=1</link><pubDate>Fri, 13 Jan 2017 10:38:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:90786999-76af-4cd2-8dbc-614d5e4eb75e</guid><dc:creator>Ankush</dc:creator><description>&lt;p&gt;Hi Lea,&lt;/p&gt;
&lt;p&gt;My code is getting restarted when I am doing the sampling of SAADC at 1000 sps  and writing to SD card. I am just setting the flag as soon as get SAADC interrupt. Now In sdk_config.h I have set the priority for SAADC as 7 and for SPI0 it is 3..But same thing is happening&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SD-Card writing blocks ADC</title><link>https://devzone.nordicsemi.com/thread/71345?ContentTypeID=1</link><pubDate>Fri, 13 Jan 2017 09:29:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1efb81aa-1d5b-4052-97b3-1ab9181beb87</guid><dc:creator>Lea</dc:creator><description>&lt;p&gt;Hi Ankush, is the Sending the problem or writing on SD Card while sampling the ADC? I had the same problem, my code got stuck when I tried to write my samples on SD Card. So I now set the interrupt priority of my adc to 6 and the one of my sd card to 3. Before they had the same priority or adc had a higher priority. So have you tried writing your samples on SD card without sending them and did this work?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SD-Card writing blocks ADC</title><link>https://devzone.nordicsemi.com/thread/71344?ContentTypeID=1</link><pubDate>Fri, 13 Jan 2017 07:41:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e052ff60-f56e-4651-86b4-152d41cb5938</guid><dc:creator>Ankush</dc:creator><description>&lt;p&gt;Hi Ole,&lt;/p&gt;
&lt;p&gt;I am getting similar kind of issue. I want to write to SD card the SAADC samples and at the same time streaming over BLE at 1ksps rate. I am calling both sending over BLE and writing to SD card function in main context. In ISR I am just updating the flags and checking the same in main loop.&lt;/p&gt;
&lt;p&gt;Now the issue is as soon as I enable the BLE streaming code is getting stopped. I have this question in &lt;a href="https://devzone.nordicsemi.com/question/109562/how-to-use-dma-in-nrf52-while-writing-on-sd-card-while-ble-is-also-operating/"&gt;this&lt;/a&gt; thread with my complete code, but still I am getting the same issue.&lt;/p&gt;
&lt;p&gt;Can you suggest anything about this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SD-Card writing blocks ADC</title><link>https://devzone.nordicsemi.com/thread/71343?ContentTypeID=1</link><pubDate>Wed, 11 Jan 2017 15:17:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8d3394d4-2a89-42b7-85db-049bef0acc15</guid><dc:creator>Lea</dc:creator><description>&lt;p&gt;Thanks a lot.&lt;/p&gt;
&lt;p&gt;I called the f_write() function in the ADC interrupt context so it blocked the next interrupt. I now call it from the main where I observe a Flag.
From the ADC interrupt I now only call a function that saves my ADC Values in a buffer.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SD-Card writing blocks ADC</title><link>https://devzone.nordicsemi.com/thread/71342?ContentTypeID=1</link><pubDate>Mon, 09 Jan 2017 11:55:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8ce3a602-7de6-4fc8-b13c-8e3d919aa6a9</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;Where do you call the write function (&lt;code&gt;f_write(..)&lt;/code&gt;)? You should consider calling this in main context if you are calling it in interrupt context (inside an event handler/callback).&lt;/p&gt;
&lt;p&gt;Also, the interrupt priority is higher if the value is lower (0 is the highest priority, 7 is the lowest). You should use the &lt;code&gt;APP_IRQ_PRIORITY_&lt;/code&gt; to set the priority, see app_util_platform.h.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SD-Card writing blocks ADC</title><link>https://devzone.nordicsemi.com/thread/71341?ContentTypeID=1</link><pubDate>Thu, 22 Dec 2016 11:23:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:533e48bf-3baa-4f19-9426-aa5443fe15b1</guid><dc:creator>Lea</dc:creator><description>&lt;p&gt;Thank you.
Setting the interrupt of the saadc to a higher level is a problem, because in the beginning my saadc interrupt had been higher or the same like my spi interrupt. In this case writing on the sd card didn&amp;#39;t worked at all. The code got stuck in the config.wait_func() function I mentioned above which waited for the write done event, that never occured.
So I set the interrupt priority of the saadc to 6 and of the spi to 3.&lt;/p&gt;
&lt;p&gt;I have now set a PPI channel between START Task and END Event of Saadc, but the problem remains. There is no sampling during the write process.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SD-Card writing blocks ADC</title><link>https://devzone.nordicsemi.com/thread/71340?ContentTypeID=1</link><pubDate>Wed, 21 Dec 2016 12:26:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:72714f27-1dbd-43a0-8e5e-c28ae290286f</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;The problem is probably that the start task is manually triggered in the buffer_convert function, which I guess you are calling inside the saadc callback. To get continuous saadc measurements without any interruptions you should have a PPI channel between the end event and the start task of the saadc, like shown in the figure &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/saadc.html?cp=2_2_0_36_5#saadc_easydma"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This should most likely work out of the box with the saadc driver, just set up the PPI channel. I have not tested this with the driver, but I know that it works from the peripheral point of view.&lt;/p&gt;
&lt;p&gt;Alternatively have a higher interrupt level on the saadc interrupt/callback. Configure this in nrf_drv_saadc_config_t-&amp;gt;interrupt_priority.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SD-Card writing blocks ADC</title><link>https://devzone.nordicsemi.com/thread/71339?ContentTypeID=1</link><pubDate>Tue, 20 Dec 2016 08:59:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d4c90d63-9fa8-4ee8-a57f-6e124e8904b9</guid><dc:creator>Lea</dc:creator><description>&lt;p&gt;Thank you, but I already trigger my SAADC sampling over a timer with PPI. I&amp;#39;m using TIMER1.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SD-Card writing blocks ADC</title><link>https://devzone.nordicsemi.com/thread/71338?ContentTypeID=1</link><pubDate>Mon, 19 Dec 2016 17:40:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0f8e38de-dfe3-43e7-afaa-db394e5255fa</guid><dc:creator>Wojtek</dc:creator><description>&lt;p&gt;Timer triggering SAADC sampling by PPI could be good solution.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>