Hi RenesasRulz members,
I have modified the SDMMC_HAL_FRWK_FX_MG_AP example to use SDHI1 and the following pin configuration on a PK-S5D9 with QSPI disconnected and a uSD connector added:
Pin Group Selection: Mixed
Operation Mode: SD_MMC 4-Bit
I formatted a 4GB uSD card on my PC as FAT32, and also created a short Readme.txt file using the PC.
I am able to open, read, and close the existing file, but if I try to create a directory or create a new file, fx_directory_create or fx_file_create return 35d, or 0x23, which is FX_WRITE_PROTECT (0x23) Underlying media is write protected according to the FileX manual.
As far as I know, there is no write protect pin on the uSD card. Is there something that I may have configured incorrectly that might be causing an inability to write to the uSD card?
Thanks in advance for any help. I am going to try adding the FileX/ThreadX source to see if I can find out more about why writes are failing. I have also attached a zip file with my exported project, hoping that someone can take a look.
You should wire the WP line to ground, not write protected I believe. You may be able to do it in the configurator with an internal resistor. I did a SD card project a while back and we did use the WP…
The SD/MMC driver incorreclty always reads the state of the WP bit in the SDHI peripheral when the card type is set to SD Card :-
r_sdmmc_write_protect_get() is called in the function R_SDMMC_Open().