<?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>Further improve of SD-card performance</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/75916/further-improve-of-sd-card-performance</link><description>Hi everybody, 
 i&amp;#39;ve got an issue i want to discuss here. I&amp;#39;m building a webserver using the nRF9160DK with ethernet-shield from PHYTEC and an SD-card which holds the frontend with a size of over 3MB. So far i got everything up and running using the nrf</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 09 Jul 2021 12:25:31 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/75916/further-improve-of-sd-card-performance" /><item><title>RE: Further improve of SD-card performance</title><link>https://devzone.nordicsemi.com/thread/319371?ContentTypeID=1</link><pubDate>Fri, 09 Jul 2021 12:25:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d8d5ab1b-825d-4af1-b03b-7c0785571e54</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;I asked internally and got the following reply:&lt;/p&gt;
&lt;p&gt;&amp;quot;SPI frequency issue after SD card initialisation is fixed in NCS 1.6 / Zephyr-2.6 by &lt;a title="https://github.com/zephyrproject-rtos/zephyr/pull/33684" href="https://github.com/zephyrproject-rtos/zephyr/pull/33684" rel="noopener noreferrer" target="_blank"&gt;https://github.com/zephyrproject-rtos/zephyr/pull/33684&lt;/a&gt;. FATFS is a block filesystem designed for block devices, like SD card, so I can not follow the problem with that. SDMMC controller driver over SPI is kind of software controller and performance depends direct on SPI controller and CPU perfomance.&amp;quot;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Further improve of SD-card performance</title><link>https://devzone.nordicsemi.com/thread/319356?ContentTypeID=1</link><pubDate>Fri, 09 Jul 2021 11:57:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0d6a5e10-2503-4a0a-b2a9-0be02e71d19e</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;Sorry for the delay on this, a huge part of the support team is on vacation and you may expect delays.&lt;/p&gt;
&lt;p&gt;I do not have too much knowledge about this topic. Since it&amp;#39;s related to Zephyr, could you ask in any of these places&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.5.1/zephyr/guides/getting-help.html#asking-for-help"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.5.1/zephyr/guides/getting-help.html#asking-for-help&lt;/a&gt;?&lt;/p&gt;
&lt;p&gt;If you find a solution, could you share it here? So other people can benefit?&lt;/p&gt;
&lt;p&gt;If you don&amp;#39;t get any answers, please get back to me.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Further improve of SD-card performance</title><link>https://devzone.nordicsemi.com/thread/318140?ContentTypeID=1</link><pubDate>Thu, 01 Jul 2021 10:01:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bbde2cee-722a-4ada-b3fc-c26b2a633b80</guid><dc:creator>flge</dc:creator><description>&lt;p&gt;Hi Simon,&lt;/p&gt;
&lt;p&gt;the &lt;em&gt;nrf_gpio_cfg()&lt;/em&gt; function worked very well. I was able to increase the waveform performance dramatically. I&amp;#39;ve done this with all the pins controlled by the nRF9160. Following the results of the spi-clk pin for example before and after the configuration.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/waveform.jpg" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;About the SD-protocol. I rerun the zephyr sample for SDHC access (fat_fs in subsys) with the same results in my post above. I&amp;#39;ve included the thread-analyzer to have an overview about the running threads. Afterwards i increased the main-thread priority, where i&amp;#39;m reading a testfile from the SDHC, always with the same result. It seems that in the driver for the SDHC, the data gets readed in batches (&lt;em&gt;sdhc_spi_rx_block()&lt;/em&gt;), so this approach goes nowhere. Is there something in planning to improve the SD-driver? Otherwise i have to try this myself.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Further improve of SD-card performance</title><link>https://devzone.nordicsemi.com/thread/316330?ContentTypeID=1</link><pubDate>Mon, 21 Jun 2021 15:47:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e4ca4f25-3f7b-4835-8976-f9a8e0411c68</guid><dc:creator>flge</dc:creator><description>&lt;p&gt;Thank you very much for the answer. I will try out your tips and give a feedback when i&amp;#39;m done.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Further improve of SD-card performance</title><link>https://devzone.nordicsemi.com/thread/315103?ContentTypeID=1</link><pubDate>Mon, 14 Jun 2021 11:45:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:408491b0-0299-4d26-bd86-4a3ab69b7942</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;I&amp;#39;m sorry for the late reply.&lt;/p&gt;
[quote user="flge"]Since i&amp;#39;m using the highest possible clock-frequency on the nRF9160, i tried to find out how to configure this option, but i wasn&amp;#39;t able to find out how. Can you give me a hint on this one?[/quote]
&lt;p&gt;Check out this answer for how to do this:&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/64647/spi-not-operating-correctly-at-high-speeds/264121#264121"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/64647/spi-not-operating-correctly-at-high-speeds/264121#264121&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You can use the Nordic nrf functions (&lt;code&gt;&lt;span&gt;#include&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&amp;lt;hal/nrf_gpio.h&amp;gt;&lt;/span&gt;&lt;/code&gt;) directly and set it&amp;nbsp;using&amp;nbsp;&lt;code&gt;nrf_gpio_cfg()&lt;/code&gt;&amp;nbsp;like in the link above.&lt;/p&gt;
&lt;p&gt;You can also achieve this using the Zephyr layer, just make sure the following gets triggered:&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v2.4.99-ncs2/drivers/gpio/gpio_nrfx.c#L155"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/v2.4.99-ncs2/drivers/gpio/gpio_nrfx.c#L155&lt;/a&gt;. I think you can do that by running&amp;nbsp;gpio_config() (&lt;code&gt;&lt;span&gt;#include&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;/code&gt;&lt;span&gt;&lt;code&gt;&amp;lt;drivers/gpio.h&amp;gt;&lt;/code&gt;)&lt;/span&gt;&amp;nbsp;with &lt;code&gt;flags =&amp;nbsp;&lt;span&gt;GPIO_DS_ALT_LOW&lt;/span&gt;&lt;span&gt; | &lt;/span&gt;&lt;span&gt;GPIO_DS_ALT_HIGH.&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&lt;span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&lt;span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;
[quote user="flge"]To ensure the reading sequence isn&amp;#39;t blocked by network-threads, i tested the reading-command also with the networking and webserver disabled, both the same. From the timing perspective there seems to be quiet some potential to save time.[/quote]
&lt;p&gt;&amp;nbsp;Have you gotten any progress on this?&lt;/p&gt;
&lt;p&gt;Maybe a solution would be&amp;nbsp;to increase the priority of the thread responsible for the SPI transfer?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Further improve of SD-card performance</title><link>https://devzone.nordicsemi.com/thread/313787?ContentTypeID=1</link><pubDate>Sun, 06 Jun 2021 14:23:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f0add4a0-5b4c-42b0-98db-d6f1aefcafdf</guid><dc:creator>flge</dc:creator><description>&lt;p&gt;Hey Simon, thanks for your reply.&lt;/p&gt;
&lt;p&gt;I hooked up up my scope to measure the SPI-lines. This raised question about SPI-pin configuration. As you can see in the image below, the clock frequency is about 8MHz.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/tek00040.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;The datasheet of the nRF9160 states, that the pins need to be configured as &amp;quot;High Drive&amp;quot; at high bit rates (footnote 10).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img height="387" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/spi_5F00_spec.jpg" width="447" alt=" " /&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Since i&amp;#39;m using the highest possible clock-frequency on the nRF9160, i tried to find out how to configure this option, but i wasn&amp;#39;t able to find out how. Can you give me a hint on this one? On the other side the data-line looks well. I think it is possible that this is due to other input-capacitance on this line (SCK --&amp;gt; P0.19 / MISO --&amp;gt; P0.18) of the nRF9160DK Rev. 1.0.0.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;When reading a file in chunks of 1024 bytes, we can see the reading-command followed by two blocks of 512 byte data.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x135/__key/communityserver-discussions-components-files/4/VB8012_2D00_30B6A2F_5F00_2021_2D00_06_2D00_04_5F00_16_2D00_00_2D00_33.png" /&gt;&lt;/p&gt;
&lt;p&gt;Each of these blocks contain eight 64-bytes subs.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/VB8012_2D00_30B6A2F_5F00_2021_2D00_06_2D00_04_5F00_15_2D00_03_2D00_11.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Each of these subs contain eight 64-bit bitfields.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/VB8012_2D00_30B6A2F_5F00_2021_2D00_06_2D00_04_5F00_15_2D00_03_2D00_28.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Each bitfiled contains 64-bit data.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/VB8012_2D00_30B6A2F_5F00_2021_2D00_06_2D00_04_5F00_15_2D00_06_2D00_21.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;To ensure the reading sequence isn&amp;#39;t blocked by network-threads, i tested the reading-command also with the networking and webserver disabled, both the same. From the timing perspective there seems to be quiet some potential to save time.&lt;/p&gt;
&lt;p&gt;Thanks for any help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Further improve of SD-card performance</title><link>https://devzone.nordicsemi.com/thread/313430?ContentTypeID=1</link><pubDate>Thu, 03 Jun 2021 13:04:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:030e3a2f-8e15-453f-bf7f-696b002b8d55</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;Are you able to attach a logic analyzer to the lines to see what&amp;#39;s actually going on and what the speed is.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>