<?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>Saving saadc data into a micro SD card using fatfs example - FR_NOT_ENABLED</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/78602/saving-saadc-data-into-a-micro-sd-card-using-fatfs-example---fr_not_enabled</link><description>Hello. 
 
 I am trying to write code to read data using saadc and write the sampled data in a micro SD card using fatfs. 
 
 I started from the fatfs example and initialized and configured the saadc exactly as in saadc example except that I changed the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 20 Aug 2021 14:06:42 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/78602/saving-saadc-data-into-a-micro-sd-card-using-fatfs-example---fr_not_enabled" /><item><title>RE: Saving saadc data into a micro SD card using fatfs example - FR_NOT_ENABLED</title><link>https://devzone.nordicsemi.com/thread/325996?ContentTypeID=1</link><pubDate>Fri, 20 Aug 2021 14:06:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:40dbb1e3-30a8-4784-b0e1-6e757f799fdb</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Thiago&lt;/p&gt;
&lt;p&gt;Great to hear you found the issue, and thanks a lot for sharing your code &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I will consider the case resolved then.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Saving saadc data into a micro SD card using fatfs example - FR_NOT_ENABLED</title><link>https://devzone.nordicsemi.com/thread/325832?ContentTypeID=1</link><pubDate>Fri, 20 Aug 2021 05:54:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6541db0a-e81d-42a1-89df-13bb6ab7a76f</guid><dc:creator>Thiago</dc:creator><description>&lt;p&gt;Hello.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Sharing the code is not a problem at all. Most of the work was done by Nordic anyway. However, I was preparing to share the code and I seem to have fixed the problem. To be honest, I am not sure how I fixed it, but I suspect it was a problem with the configuration of the queue. I was trying to store the uint16_t data type coming from the ADC in the queue, but then I decided to convert the data before storing it in the queue (Convert from uint16_t to uint8_t). So, I changed the queue configuration to store uint8_t data and it worked!&lt;/p&gt;
&lt;p&gt;Still, I am sharing the code in case someone needs it. This code configures the nrf52840 to sample 120 samples from pins p.0.04 and&amp;nbsp;&lt;span&gt;p.0.05, converts the data from unit16_t to uint8_t (120 samples become 240 elements), and rearranges the samples in an array with 240 samples, being that the first 120 elements correspond to channel 1 and the last 120 elements correspond to channel 2.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;OBS: The code was written in SDK 16.0&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/fatfs_5F00_saadc.zip"&gt;devzone.nordicsemi.com/.../fatfs_5F00_saadc.zip&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;It may not have been written with the finest of the C programming skills, but it seems to be doing the job.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you for your help.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thiago.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Saving saadc data into a micro SD card using fatfs example - FR_NOT_ENABLED</title><link>https://devzone.nordicsemi.com/thread/325458?ContentTypeID=1</link><pubDate>Wed, 18 Aug 2021 10:54:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3f634a49-d7db-4eef-ae41-ff14bce6bee8</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks a lot for your detailed report.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Can you zip and attach your project so I can have a look at the code more easily?&lt;/p&gt;
&lt;p&gt;I can make the case private, in case you don&amp;#39;t want to share your code in a public case.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Saving saadc data into a micro SD card using fatfs example - FR_NOT_ENABLED</title><link>https://devzone.nordicsemi.com/thread/325260?ContentTypeID=1</link><pubDate>Tue, 17 Aug 2021 10:11:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f289fa3b-bb7d-4e2c-b2dd-af429b224aa4</guid><dc:creator>Thiago</dc:creator><description>&lt;p&gt;I tried copying the ADC data to a global array and converting it to uint8_t (in the ADC callback function). In the while loop, I get the data and save it in the file. It worked this way. Somehow the byte_queue_read function is interfering with the SD card functionality.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Saving saadc data into a micro SD card using fatfs example - FR_NOT_ENABLED</title><link>https://devzone.nordicsemi.com/thread/325218?ContentTypeID=1</link><pubDate>Tue, 17 Aug 2021 06:03:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8329b750-448f-4543-bd98-8ba8952d092a</guid><dc:creator>Thiago</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I just found that if I comment the line shown on the image the code runs without a problem, except that I only get empty spaces stored in the TXT file because the data stored in the SD card is an empty array. The function causing the problem is the one that reads data from the queue. If I uncomment that line, the data is correctly retrieved from the queue, but there is an SD card error. If I comment on that line, the SD card works but I don&amp;#39;t read the data from the queue.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/600x240/__key/communityserver-discussions-components-files/4/64850.Error.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Would you happen to know what&amp;nbsp;could be causing this trouble?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Saving saadc data into a micro SD card using fatfs example - FR_NOT_ENABLED</title><link>https://devzone.nordicsemi.com/thread/325194?ContentTypeID=1</link><pubDate>Mon, 16 Aug 2021 23:19:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ac6f75bc-9e5f-471f-b7ab-7642cbcf71c4</guid><dc:creator>Thiago</dc:creator><description>&lt;p&gt;Hello!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank you for answering.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I call it as shown in the image:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/1040x900/__key/communityserver-discussions-components-files/4/8032.Picture1.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I also added it in case f_open returns an error in the main while loop. But it returns FR_NOT_READY in the second call (also as shown on the image above).&lt;/p&gt;
&lt;p&gt;FYI, it enters the main while loop with the status FR_OK, after the call of fatfs_init(). That is, everything seems fine until the program enters the while loop.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Saving saadc data into a micro SD card using fatfs example - FR_NOT_ENABLED</title><link>https://devzone.nordicsemi.com/thread/325100?ContentTypeID=1</link><pubDate>Mon, 16 Aug 2021 11:54:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:69b67dd4-9166-4b91-8ff2-701230aeb157</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Typically this happens if you forget to mount the drive before you try to access it.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Do you make sure to call &lt;em&gt;f_mount(..)&lt;/em&gt; anywhere?&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>