sdmmc for fatfs

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

sdmmc for fatfs

1,550 Views
CktDesigner
Contributor IV

I'm using the MIMXRT1060-EVKB with MCUXpresso and SDK Version 2.13.0(667-2023-02-18).

I'm attempting to use the sdmmc driver for the FAT filesystem.

As a test, I imported the SDK example "evkbmimxrt1060_sdcard_fatfs" and it compiles/runs properly.

I then included fatfs in my project via the "Manage SDK Components" button in MCUXpresso by selecting the FatFs middleware item.

I also assigned pins for the project via the "Pins" config tool.

The project compiles, but access to a micro-SD card via fatfs calls fails due to problems with card-detect.

In debugging, I noticed that the project setup/organization is different when using the MCUXpresso "managed" project versus the imported "demo".    This makes me wonder if the demo was created in a different environment.

But more importantly, the demo seems to have more recent files for sdmmc_config.c than those provided via the 2.13.0 version of the SDK.   In particular, the demo version has code to deal with modifications needed to pullup/pulldown data line 3 for card detection in micro-sd cards.

Wondering if the correct file versions for sdmmc card support are included in 2.13 (the latest) SDK?

Thanks!

 

 

 

0 Kudos
Reply
7 Replies

1,509 Views
CktDesigner
Contributor IV

Hi Pavel,

Thanks for the response.

I am using the EVKB version of the eval board.

My real question was the portion that said:

"But more importantly, the demo seems to have more recent files for sdmmc_config.c than those provided via the 2.13.0 version of the SDK.   In particular, the demo version has code to deal with modifications needed to pullup/pulldown data line 3 for card detection in micro-sd cards."

Most differences are in sdmmc_config.c  which is in the "board" folder in the demo (as one would expect if produced by the "Config" tools (as that is where all the files produced by the config tools are located)).   These files are in the "template/usdhc" folder when including them via the SDK components manager.

The version in the demo has functions for detecting the SD card using pin 3 of the card.   The version included through the components manager does not.    There are a number of other things in the demo version that aren't in the version included via the SDK components manager.

So the confusion arises from trying an NXP demo (that works), then when deciding to include that functionality in my project and using the SDK components manager to include the appropriate components (FatFS and sdhc),  the software that is produced doesn't look like the demo...   And doesn't work because functionality is missing.

Thanks...

0 Kudos
Reply

1,495 Views
Pavel_Hernandez
NXP TechSupport
NXP TechSupport

Hello, I will review the information that you mentioned but could you tell me what is the version of the SDK your compare? SDK 2.13 vs ...?

Best regards,
Pavel

0 Kudos
Reply

1,486 Views
CktDesigner
Contributor IV

As I said in the original post, I'm using SDK Version 2.13.0(667-2023-02-18).

I'm comparing the code that is imported with the sdcard_fatfs demo with the code that arrives in my project when I use the SDK Component manager to include sdhc and fatfs software components.

The release notes for the SDK say that code for card detection using DAT3 has been added, but I don't see it.    Also the "structure" of the project is different (in particular the position and contents of sdmmc_config.h and sdmmc_config.c.

0 Kudos
Reply

1,466 Views
Pavel_Hernandez
NXP TechSupport
NXP TechSupport

Hello, sorry for the late response, thanks for your information I understand the next, I'm following your case, I follow these steps to get the same behavior as you mentioned.

  • Open the example code from the SDK "evkbmimxrt1060_sdcard_fatfs".
  • Compare with a new project and add the middleware File System.

I review both sdmmc_config.h seems similar but on the other hand, the .c has + 165 lines of differences. Are these the differences that you are reporting?

 

Spoiler
Pavel_Hernandez_0-1679025476420.png

 

And about the card detection, there is a note about this in the .h

* Note: Please pay attention, DAT3 card detection cannot works during the card access,
* since the DAT3 will be used for data transfer, thus the functionality of card detect will be disabled. Using card
* detect pin for card detection is recommended.

Best regards,
Pavel

0 Kudos
Reply

1,462 Views
CktDesigner
Contributor IV

Hi Pavel,

Thanks for your reply.

Yes, I am referring to the additional lines in sdmmc_config.c that appear in the demo version (and the places in other code where these extra functions are actually referenced/used), but not in the version from the SDK.   Note that some of the references are indirect (called via a pointer), so a simple "search" doesn't find them!

I saw the note about card detect, but my understanding is that a detect pin is only available on "full size" sdcard sockets.   The micro-sdcard sockets (mostly) rely on using DAT3 for the card-detect functionality (and is why it is supported).   Obviously, this has to be turned off during data transfer...

The existence of this extra code in the demo and the (indirect) calls from the other code in the demo is what is confusing.    The SDK change-log also indicates that card-detect functionality (including DAT3 functionality) was put into the sdhc driver, but I didn't see it.    The dates on the headers for the two versions of sdmmc_config.h/c also seemed to indicate that the demo version was more recent than the one from the SDK.

I imagine I could copy the missing code from the demo, but I'd like to use "officially" supported code, so as new versions of the SDK are released, upgrading is easier...

Suggestions?

0 Kudos
Reply

1,446 Views
Pavel_Hernandez
NXP TechSupport
NXP TechSupport

Hello, thanks for being clear, I will do the report, but the release will not be done at the moment of the report, I recommend doing the modification in your code.

Best regards,
Pavel

0 Kudos
Reply

1,513 Views
Pavel_Hernandez
NXP TechSupport
NXP TechSupport

Hello, my name is Pavel, and I will be supporting your case, I review your information, and I recommend reviewing if your board is the EVKB, and if you want to review the information about the driver's version, please review the document of LOG in the SDK.

Pavel_Hernandez_0-1678744106562.png

Let me know if you have more questions.

Best regards,
Pavel 

0 Kudos
Reply