<?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>nrf53 USB as mass storage with SDCARD enable ok but doesn&amp;#39;t work</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/95902/nrf53-usb-as-mass-storage-with-sdcard-enable-ok-but-doesn-t-work</link><description>Hello, 
 I am here, again! I am trying to use the USB of nfr5340dk or my custom board as mass storage with SDCard. 
 I am sure the SDCard works... in the same project I can read and write files without problems, but when I enable the usb, the USB_enable</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 30 Jan 2023 13:33:59 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/95902/nrf53-usb-as-mass-storage-with-sdcard-enable-ok-but-doesn-t-work" /><item><title>RE: nrf53 USB as mass storage with SDCARD enable ok but doesn't work</title><link>https://devzone.nordicsemi.com/thread/407118?ContentTypeID=1</link><pubDate>Mon, 30 Jan 2023 13:33:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d03c7200-9cd6-4da5-8e3f-41c0d9e8e410</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Marco&lt;/p&gt;
&lt;p&gt;Any chance you could try to build the sample in nRF Connect SDK v2.2.0 instead?&lt;/p&gt;
&lt;p&gt;I just tested the mass sample in v2.2.0, and here MASS_STORAGE_STACK_SIZE should be configurable.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Alternatively, it is possible to add this configuration to the project Kconfig file, in order to make it user configurable and set a different default value.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;To do this simply copy the text from the Kconfig.msg file into the project Kconfig file, and alter the default value to fit your application:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;config MASS_STORAGE_STACK_SIZE
	int &amp;quot;Set stack size for mass storage thread&amp;quot;
	default 8192
	help
	  Stack size for mass storage disk operations thread&lt;/pre&gt;&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: nrf53 USB as mass storage with SDCARD enable ok but doesn't work</title><link>https://devzone.nordicsemi.com/thread/407065?ContentTypeID=1</link><pubDate>Mon, 30 Jan 2023 10:54:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f2470dfc-8e99-4aa2-9864-9d306f58b674</guid><dc:creator>warcomeb-am</dc:creator><description>&lt;p&gt;Hi &lt;a href="https://devzone.nordicsemi.com/members/ovrebekk"&gt;ovrebekk&lt;/a&gt;&amp;nbsp;,&lt;/p&gt;
&lt;p&gt;what do you think about this point: &amp;quot;To avoid this, I changed the value into Kconfig.msc... now the project compile, the stack overflow is disappered, but the PC doesn&amp;#39;t see the USB and the SDCard.&amp;quot;?&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t understand why I need to change the Kconfig.msg and not the prj.conf?&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Marco&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf53 USB as mass storage with SDCARD enable ok but doesn't work</title><link>https://devzone.nordicsemi.com/thread/406625?ContentTypeID=1</link><pubDate>Thu, 26 Jan 2023 11:07:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e45ca920-e106-4989-af01-5961e16b7514</guid><dc:creator>warcomeb-am</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;span&gt;Torbj&amp;oslash;rn,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I added into the prj.conf file the following line&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_MASS_STORAGE_STACK_SIZE=8192&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;But the compiler reply in this way:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;d:/Workspace/vsc_ncs_2.1.2/usb_mass_test/prj.conf:29: warning: attempt to assign the value &amp;#39; 8192&amp;#39; to the undefined symbol MASS_STORAGE_STACK_SIZE 
Parsing D:/Workspace/vsc_ncs_2.1.2/usb_mass_test/Kconfig
Loaded configuration &amp;#39;D:/SDK/ncs/v2.1.2/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp_defconfig&amp;#39;
Merged configuration &amp;#39;d:/Workspace/vsc_ncs_2.1.2/usb_mass_test/prj.conf&amp;#39;

error: Aborting due to Kconfig warnings

CMake Error at D:/SDK/ncs/v2.1.2/zephyr/cmake/modules/kconfig.cmake:293 (message):
  command failed with return code: 1
Call Stack (most recent call first):
  D:/SDK/ncs/v2.1.2/zephyr/cmake/modules/zephyr_default.cmake:121 (include)
  D:/SDK/ncs/v2.1.2/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
  D:/SDK/ncs/v2.1.2/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
  CMakeLists.txt:4 (find_package)


-- Configuring incomplete, errors occurred!
FATAL ERROR: command exited with status 1: &amp;#39;d:\SDK\ncs\toolchains\v2.1.2\opt\bin\cmake.EXE&amp;#39; &amp;#39;-DWEST_PYTHON=d:\SDK\ncs\toolchains\v2.1.2\opt\bin\python.exe&amp;#39; &amp;#39;-Bd:\Workspace\vsc_ncs_2.1.2\usb_mass_test\build&amp;#39; -GNinja -DBOARD=nrf5340dk_nrf5340_cpuapp -DNCS_TOOLCHAIN_VERSION:STRING=NONE &amp;#39;-DBOARD_ROOT:STRING=d:/Workspace/vsc_ncs_2.1.2/prova_adc;d:/Workspace/vsc_ncs_2.1.2/usb_mass_test&amp;#39; -DDTC_OVERLAY_FILE:STRING=d:/Workspace/vsc_ncs_2.1.2/usb_mass_test/boards/nrf5340dk_nrf5340_cpuapp.overlay -DCONF_FILE:STRING=d:/Workspace/vsc_ncs_2.1.2/usb_mass_test/prj.conf &amp;#39;-Sd:\Workspace\vsc_ncs_2.1.2\usb_mass_test&amp;#39;
&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;why?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;To avoid this, I changed the value into Kconfig.msc... now the project compile, the stack overflow is disappered, but the PC doesn&amp;#39;t see the USB and the SDCard.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I tried to go back to the previous value of stack size, but now the stack overflow is no more present! I&amp;#39;m going crazy!&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Marco&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf53 USB as mass storage with SDCARD enable ok but doesn't work</title><link>https://devzone.nordicsemi.com/thread/406608?ContentTypeID=1</link><pubDate>Thu, 26 Jan 2023 10:07:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4d1c02cd-f5b6-4cad-8aee-25ce142118b2</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Marco&lt;/p&gt;
&lt;p&gt;I found a similar sounding &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/87392/nrf5340-cdc-sdcard-generate-stack-overflow"&gt;case&lt;/a&gt; where the issue was the size of the mass storage stack size rather than the main or idle stacks.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you try one more time, but change CONFIG_MASS_STORAGE_STACK_SIZE instead?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Try 4096 or 8129 and see if it fixes the issue.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you still can&amp;#39;t make it work I will&amp;nbsp;hook up an SD card to a DK so I can do some testing on my side.&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: nrf53 USB as mass storage with SDCARD enable ok but doesn't work</title><link>https://devzone.nordicsemi.com/thread/406403?ContentTypeID=1</link><pubDate>Wed, 25 Jan 2023 09:08:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:812cbe08-8b6b-4c7f-8e81-f39f629ea128</guid><dc:creator>warcomeb-am</dc:creator><description>&lt;p&gt;&lt;span&gt;Hi Torbj&amp;oslash;rn,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;whitout the SD card present, there isn&amp;#39;t the fault. The log is:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;*** Booting Zephyr OS build v3.1.99-ncs1-1  ***
[00:00:02.481,658] [1B][1;31m&amp;lt;err&amp;gt; sd: Card error on CMD0[1B][0m
[00:00:02.481,689] [1B][1;31m&amp;lt;err&amp;gt; usb_msc: Storage init ERROR !!!! - Aborting USB init[1B][0m
[00:00:04.485,412] [1B][1;31m&amp;lt;err&amp;gt; sd: Card error on CMD0[1B][0m
[00:00:04.485,443] [1B][1;31m&amp;lt;err&amp;gt; fs: fs mount error (-5)[1B][0m
[00:00:04.485,473] [1B][1;31m&amp;lt;err&amp;gt; main: Failed to mount filesystem[1B][0m
[00:00:04.485,595] [1B][0m&amp;lt;inf&amp;gt; main: The device is put in USB mass storage mode.&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Anyway, in attach you can find the project.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Marco&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/usb_5F00_mass_5F00_test.zip"&gt;devzone.nordicsemi.com/.../usb_5F00_mass_5F00_test.zip&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf53 USB as mass storage with SDCARD enable ok but doesn't work</title><link>https://devzone.nordicsemi.com/thread/406381?ContentTypeID=1</link><pubDate>Wed, 25 Jan 2023 07:17:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7f961568-9502-44cb-9eaa-2900b9663d9e</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Marco&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Does the error happen only if the SD card is connected, or will it happen also without an SD card in place?&lt;/p&gt;
&lt;p&gt;If it happens without the SD card present would you be able to share the project with me so I can try to reproduce the issue here?&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: nrf53 USB as mass storage with SDCARD enable ok but doesn't work</title><link>https://devzone.nordicsemi.com/thread/406276?ContentTypeID=1</link><pubDate>Tue, 24 Jan 2023 14:08:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:26ef420b-690e-4a37-8bb8-e6e149dcf32c</guid><dc:creator>warcomeb-am</dc:creator><description>&lt;p&gt;&lt;span&gt;Hi Torbj&amp;oslash;rn&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I have increased the main stack size and idle stack size to the following value:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_MAIN_STACK_SIZE=16384
CONFIG_IDLE_STACK_SIZE=4096&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;But the error is the same! nothing change!&lt;/p&gt;
&lt;p&gt;Best&lt;/p&gt;
&lt;p&gt;Marco&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf53 USB as mass storage with SDCARD enable ok but doesn't work</title><link>https://devzone.nordicsemi.com/thread/406253?ContentTypeID=1</link><pubDate>Tue, 24 Jan 2023 13:11:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:acbe96f5-c6d7-49b6-a56e-ef60926cda2a</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Marco&lt;/p&gt;
&lt;p&gt;Most likely the issue is that your main stack is too small.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you try to increase the size of your main stack and see if the program will run without crashing?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;For instance, try to set the stack size to 4096 or 8192 and see when it works (or not).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_MAIN_STACK_SIZE=4096&lt;/pre&gt;&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: nrf53 USB as mass storage with SDCARD enable ok but doesn't work</title><link>https://devzone.nordicsemi.com/thread/406066?ContentTypeID=1</link><pubDate>Mon, 23 Jan 2023 14:50:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:84700c2e-7b5e-48d3-a7ed-a5590f85d1c8</guid><dc:creator>warcomeb-am</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;span&gt;Torbj&amp;oslash;rn,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I added the two options that you suggest me, but the log is the same.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;You can find the .map file in attach!&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Marco&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/1033.zephyr.map"&gt;devzone.nordicsemi.com/.../1033.zephyr.map&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf53 USB as mass storage with SDCARD enable ok but doesn't work</title><link>https://devzone.nordicsemi.com/thread/406010?ContentTypeID=1</link><pubDate>Mon, 23 Jan 2023 11:27:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8a8215a8-2bca-40e2-b11d-6f1ec32dec1c</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Marco&lt;/p&gt;
&lt;p&gt;Could you try to build the sample again with the following debugging options set?&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_DEBUG=y
CONFIG_DEBUG_THREAD_INFO=y&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Then you should get a bit more info about where the issue happens.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Possibly you just need to increase the size of the main stack or the idle stack, which can be configured through the CONFIG_MAIN_STACK_SIZE or CONFIG_IDLE_STACK_SIZE parameters.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you test it again with the debug options set can you share the log with me, and also the zephyr.map file from your build directory?&lt;/p&gt;
&lt;p&gt;The map file will show where the various stacks are located in memory, making it easier to identify the cause of the issue.&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: nrf53 USB as mass storage with SDCARD enable ok but doesn't work</title><link>https://devzone.nordicsemi.com/thread/405891?ContentTypeID=1</link><pubDate>Fri, 20 Jan 2023 16:01:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4e762a59-0481-426f-bef2-1ffac1f9c974</guid><dc:creator>warcomeb-am</dc:creator><description>&lt;p&gt;A small update.&lt;/p&gt;
&lt;p&gt;After some tries with both dk and custom board, with DK now the PC start the enumeration but in a terminal I can read a fault message and the board reset.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;*** Booting Zephyr OS build v3.1.99-ncs1-1
Mount /SD:: 0
/SD:: bsize = 512 ; frsize = 32768 ; blocks = 238304 ; bfree = 236871
/SD: opendir: 0
  D 0 EXAMPLE
End of files
[00:00:02.259,338] &amp;lt;inf&amp;gt; sd: Detected SD card
[00:00:02.278,381] &amp;lt;inf&amp;gt; sd: Maximum SD clock is under 25MHz, using clock of 2000000Hz
[00:00:02.364,013] &amp;lt;inf&amp;gt; main: The device is put in USB mass storage mode.

[00:00:03.770,263] &amp;lt;err&amp;gt; os: ***** USAGE FAULT *****
[00:00:03.770,294] &amp;lt;err&amp;gt; os:   Stack overflow (context area not valid)
[00:00:03.770,294] &amp;lt;err&amp;gt; os: r0/a1:  0xfbd35e65  r1/a2:  0x247882c0  r2/a3:  0x0000a2d0
[00:00:03.770,294] &amp;lt;err&amp;gt; os: r3/a4:  0x61000000 r12/ip:  0x20000224 r14/lr:  0x00000009
[00:00:03.770,324] &amp;lt;err&amp;gt; os:  xpsr:  0x00000000
[00:00:03.770,324] &amp;lt;err&amp;gt; os: Faulting instruction address (r15/pc): 0x20000224
[00:00:03.770,355] &amp;lt;err&amp;gt; os: &amp;gt;&amp;gt;&amp;gt; ZEPHYR FATAL ERROR 2: Stack overflow on CPU 0
[00:00:03.770,355] &amp;lt;err&amp;gt; os: Current thread: 0x200009b0 (unknown)
[00:00:03.828,186] &amp;lt;err&amp;gt; fatal_error: Resetting system&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;It is the mass storage example and I don&amp;#39;t touch anything! I just added the SPI configuration for the sd card.&lt;/p&gt;
&lt;p&gt;Best&lt;/p&gt;
&lt;p&gt;Marco&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>