Hi Sabina,
Thanks for your reply. I have figured out the reason why FATfs is not working. It is because the SD card was not initialized. I found the boolean variable "g_sd_isHostReady" was Null.

Then I tried to add function "sdcardWaitCardInsert()" and associated files, however, it causes bus_fault and hard_fault after calling function "Port_SetPinInterruptConfig()". I have attached several screenshots for the variables when this function is called, as well as the screenshot when I run the original sdcard_fatfs example.

Is it caused by the conflict with USB_HOST interrupt or what?


Before the function "PORT_SetPinInterruptConfig(BOARD_SDHC_CD_PORT_BASE, BOARD_SDHC_CD_GPIO_PIN, kPORT_InterruptEitherEdge);" is called, the value of user->cd changes to 0x128cc while the original working example's value is 0xa4e8. I tracked it back, the g_sd.usrParam.cd is the address of s_sdCardDetect, which is automatically generated.


Also, after entering "PORT_SetPinInterruptConfig()", the value of some variables are null while they are all 0 in the original example.
Any advice will be helpful, thanks in advance.