Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FatFS using SDHC is hardcoded to 1-bit mode in diskio.c #1044

Closed
JordanAceto opened this issue Jun 11, 2024 · 4 comments · Fixed by #1045
Closed

FatFS using SDHC is hardcoded to 1-bit mode in diskio.c #1044

JordanAceto opened this issue Jun 11, 2024 · 4 comments · Fixed by #1045
Assignees
Labels
enhancement New feature, request, or updating to latest version

Comments

@JordanAceto
Copy link

Hi there,

I noticed slow SD card writes when using the SDHC library. Probing the data lines with an oscilloscope revealed that only the DATA0, CLK, and CMD lines were active. The DAT1 .. DAT3 lines were permanently high during data writes.

Browsing through the code and using the debugger, I found that the data width is hardcoded with the enumeration MXC_SDHC_LIB_SINGLE_DATA in diskio.c. The relevant line for the write function is shown below. The matching read function has the same hardcoded enum. I am using FF15.

if (MXC_SDHC_Lib_Write(sector, (void *)buff, count, MXC_SDHC_LIB_SINGLE_DATA) != E_NO_ERROR) {

After manually changing the hardcoded enums to MXC_SDHC_LIB_QUAD_DATA in diskio.c, I do see all 4 data lines wiggling, and the SD card write speeds increase as expected.

Is there a reason for the SDHC to be hardcoded to 1-bit mode when using FatFS/can the ability to use all 4 data lines be added to the MSDK?

Thanks!

@EricB-ADI
Copy link
Contributor

What chip are you using? I do not know the full history, but not all of our chips support QSPI operation, for ease it was most likely set to that to not have to deal part to part variation. I will add this to my list and will update this sometime soon.

@JordanAceto
Copy link
Author

We are using MAX32666. The current code is on a FTHR board, but we will eventually move it to a custom PCB. Thanks!

@Jake-Carter
Copy link
Contributor

Thanks @JordanAceto, this is just a legacy hard-coded config. We can and should expose this as a config option to the API.

@Jake-Carter Jake-Carter self-assigned this Jun 11, 2024
@Jake-Carter Jake-Carter added the enhancement New feature, request, or updating to latest version label Jun 11, 2024
@Jake-Carter
Copy link
Contributor

Ah looks like @EricB-ADI is already on it in #1045

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature, request, or updating to latest version
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants