<?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>Asynchronous sd-card mounting procedure</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/84491/asynchronous-sd-card-mounting-procedure</link><description>Hello Nordic, I have a problem. I&amp;#39;m running the nRF9160DK with three sensors and an sd card reader. The three sensors and the sd-card reader are connected via SPI. Due to power requirements, I have only one sensor active, taking down values constantly</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 10 Feb 2022 07:50:43 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/84491/asynchronous-sd-card-mounting-procedure" /><item><title>RE: Asynchronous sd-card mounting procedure</title><link>https://devzone.nordicsemi.com/thread/352222?ContentTypeID=1</link><pubDate>Thu, 10 Feb 2022 07:50:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:53cc5eb6-7242-4d4b-96f8-0afe7cfea3fb</guid><dc:creator>Kazi Afroza Sultana</dc:creator><description>&lt;p&gt;Hello Niclas,&lt;/p&gt;
&lt;p&gt;Thanks for your appreciation. Good Luck.&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;/p&gt;
&lt;p&gt;Kazi Afroza Sultana&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Asynchronous sd-card mounting procedure</title><link>https://devzone.nordicsemi.com/thread/352082?ContentTypeID=1</link><pubDate>Wed, 09 Feb 2022 13:19:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:78aa2b6a-877f-43fa-bb49-444a90848916</guid><dc:creator>nWre</dc:creator><description>&lt;p&gt;The support you guys give is beyond every reasonable expectation and I thank you for such a detailed and knowledgeable response. I&amp;#39;m in a testing phase and have implemented modem functionality as well as sensor functions. As of now, all the code runs in sequence and no threading is done on my part but given your answer, I think I understand this better and will try out some things. As of now it looks like this, in pseudo:&lt;br /&gt;&lt;br /&gt;if(trigger)&lt;br /&gt;&amp;nbsp;&amp;nbsp; mountSDcard() *this part takes 100-500ms&lt;br /&gt;&amp;nbsp;&amp;nbsp; while(dataActive)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; writeToSD(data)&lt;br /&gt;&amp;nbsp; dismountSDCard()&lt;br /&gt;&lt;br /&gt;I have tested the mounttime using logging functions.&lt;br /&gt;&lt;br /&gt;I thank you for all the information given, I will read through it all, do some testing and get back to you.&lt;br /&gt;As I am sure you can tell, this is untrodden waters for me.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Asynchronous sd-card mounting procedure</title><link>https://devzone.nordicsemi.com/thread/352059?ContentTypeID=1</link><pubDate>Wed, 09 Feb 2022 12:14:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7e16e734-fe60-4f95-84c8-8842b269b9dd</guid><dc:creator>Kazi Afroza Sultana</dc:creator><description>&lt;p&gt;Hello Niclas,&lt;/p&gt;
&lt;p&gt;Since Zephyr is a multithread real time operating system, it supports multiple hardware architecture. So, this is handled automatically. When you start a new thread in Zephyr it runs parallel with others.&amp;nbsp; You actually do not need to have more than one core to perform multithreading.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&amp;#39;&amp;#39;However, in a single core application, maybe there is some sort of timer&amp;nbsp;&lt;/strong&gt;&lt;strong style="font-family:inherit;"&gt;interrupt or the like that automatically switches between threads&amp;#39;&amp;#39;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Yes, from a hardware perspective, the RTC is used to wake up the processor whenever there is a task from one of the threads waiting to be executed. This is handled automatically in Zephyr. In nRF5 SDK we have Application Timer (app_timer) library (&lt;a href="https://devzone.nordicsemi.com/guides/short-range-guides/b/software-development-kit/posts/application-timer-tutorial"&gt;nRF5 SDK Application Timer Tutorial - Software Development Kit - nRF5 SDK guides - Nordic DevZone (nordicsemi.com)&lt;/a&gt;. Using app_timer, it is easy to use Real Time Counter1(RTC1) peripheral to create multiple timer instances. The RTC uses the Low Frequency Clock (LFCLK). Most of the applications keep the LFCLK active for all times. So it reduces the power consumption.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&amp;#39;&amp;#39;The idea is to cut the power to the SD-card when it&amp;#39;s not being used, which is 99% of the time, and mount it when a trigger happens. The sensor has a buffer which overflows after around 25ms and the mounting procedure of the sd-card takes between 100-500 ms. Now, I certainly have enough RAM to save a few seconds of data while the sd-card is being mounted, if it can be done in parallel with the data reading.&amp;#39;&amp;#39;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;It seems strange that the SD card mounting makes the CPU occupied for 100-500 ms. This is also you are worrying about. Is the actual scenario of testing or some of the preliminary worries? Have you tested this? If the SD card driver is actually blocking for 100-500 ms, we would consider this as bug and that should be removed.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Apart from this, the SPI peripheral you use for the sensors are also able to run in parallel and they already have DMA implemented. So, CPU does not need to wake up when the data is written to RAM. So there is a thought- even though the SD card driver would block the CPU for 500 ms, the SPI should still be able to run and capture sensors data and write it to RAM ( in parallel with the SD card initialization). However this may also depend on how the SPI driver is implemented in zephyr.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;We still have the same concern to ask you if this is a real issue or you are in planning stage?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&amp;#39;&amp;#39;Any other idea would also be appreciated, maybe there is a way in software to reduce the current draw of the sd-card such that it stays mounted and the wake-up-time is greatly reduced.&amp;#39;&amp;#39;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Our team would assume that the&amp;nbsp; SD card has some sort of low power function, which is activated by writing some commands on it. But it is not normal to switch on and off the power to save current.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;One more thing to add that nRF9160 is a single core device which can be seen from application. It has another core that is used only for modem and can not be used by the application.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Hope it helps. Let us know is you have more queries to know and also which stage you are in.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;/p&gt;
&lt;p&gt;Kazi Afroza Sultana&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Asynchronous sd-card mounting procedure</title><link>https://devzone.nordicsemi.com/thread/351773?ContentTypeID=1</link><pubDate>Tue, 08 Feb 2022 11:54:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:26deefe3-8609-476a-87ff-420d0985db3e</guid><dc:creator>Kazi Afroza Sultana</dc:creator><description>&lt;p&gt;Hello Niclas,&lt;/p&gt;
&lt;p&gt;We have been working on your issue. Will come back to you whenever I have the answer.&lt;/p&gt;
&lt;p&gt;Best Regards&lt;/p&gt;
&lt;p&gt;Kazi Afroza Sultana&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>