<?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>Creating file on SD card results in SFN even with LFN enabled</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/127529/creating-file-on-sd-card-results-in-sfn-even-with-lfn-enabled</link><description>Hi, 
 I&amp;#39;m trying to deal with a weird issue regarding writing files to an SD card. I am restructuring my project to be more maintainable, which means moving some things over from the src directory to drivers (T2 topology). I have a couple working drivers</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 09 Apr 2026 08:41:37 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/127529/creating-file-on-sd-card-results-in-sfn-even-with-lfn-enabled" /><item><title>RE: Creating file on SD card results in SFN even with LFN enabled</title><link>https://devzone.nordicsemi.com/thread/564699?ContentTypeID=1</link><pubDate>Thu, 09 Apr 2026 08:41:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5a709d5f-7d35-45a9-9c83-29cbb3078b23</guid><dc:creator>wgeeurickx</dc:creator><description>&lt;p&gt;Hi Kenneth,&lt;/p&gt;
&lt;p&gt;Thank you for getting back to me, and sorry for my delayed response. I have been busy with some other work the past weeks.&lt;/p&gt;
&lt;p&gt;I know that I need to enable CONFIG_FS_FATFS_LFN, this was also indicate in my original post. I have narrowed down the main issue to something weird happening with how the module is operating depending on how it is included in the build.&lt;/p&gt;
&lt;p&gt;When I keep the drv_sdhc.c file inside /src and include it in the build in my CMakeLists.txt in /app, it seems to work as expected. However, when I move it to a directory in /drivers (and make sure that everything is set up so that the file is included in the build), I get the issue described above.&lt;/p&gt;
&lt;p&gt;Another issue I observed is that I store a pointer to an application callback function inside the drv_sdhc module, essentially to let the application know when the SD card is inserted. When I initialize the driver and set the pointer, everything is fine. But when I actually get the GPIO callback indicating that the SD card is inserted, I notice that the pointer variable has changed and is no longer pointing to my actual callback function, but rather 0xaa550000, which is not a valid address&lt;/p&gt;
&lt;p&gt;These things seem to be connected, as this also doesn&amp;#39;t happen when I&amp;#39;m doing it from the drv_sdhc.c file in /src . I have made other /drivers, so I&amp;#39;m pretty sure it&amp;#39;s not related to how it&amp;#39;s implemented. But I&amp;#39;m lost as to finding out what exactly is going wrong. The good thing is that I can make things work by just doing everything in /src, but I would definitely want to understand the issue.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Creating file on SD card results in SFN even with LFN enabled</title><link>https://devzone.nordicsemi.com/thread/563871?ContentTypeID=1</link><pubDate>Mon, 23 Mar 2026 12:56:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:06a2c164-0986-4fc6-a290-21147adf640e</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Searching in nRF Connect SDK I can find for instance in test_fat.h that:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#if defined(CONFIG_FS_FATFS_LFN)
#define TEST_FILE	FATFS_MNTP \
	&amp;quot;/testlongfilenamethatsmuchlongerthan8.3chars.text&amp;quot;
#else
#define TEST_FILE	FATFS_MNTP&amp;quot;/testfile.txt&amp;quot;
#endif /* CONFIG_FS_FATFS_LFN */&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I can also find in kconfig.fatfs&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;config FS_FATFS_LFN
	bool &amp;quot;Long filenames (LFN)&amp;quot;
	help
	  Without long filenames enabled, file names are limited to 8.3 format.
	  This option increases working buffer size.&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;So it looks to me that you need to enable&amp;nbsp;&lt;span&gt;CONFIG_FS_FATFS_LFN=y to support longer than 8.3 file name yes.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Kenneth&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>