6 years, 8 months ago.

MAX32630FTHR SD interface

I have tried the example SD_Demo code with six different SD cards with no luck. I have put debug statements in many places in the library to try to find the problem, but I can't get it to work. The code can see the SD card, initialize the library, see that the card is present, see that it is type CARD_SDHC, and report the capacity as 4GB (even for a larger card). The code will not open an existing file for read, nor will it open a file for write or append.

Maybe it's just me, but I suspect it's not. Anyone else able to use SD cards with their MAX32630FTHR? This board could be useful if I could use SD cards....

Regards,

- Just Gary

Question relating to:

MAX32630 Rapid Development Platform

webw

posted by Efran Samux 14 Apr 2018

3 Answers

6 years, 8 months ago.

This project works: https://os.mbed.com/users/switches/code/FTHR_USBMSD_BD/

Accepted Answer

Hi Greg, I imported the repository into the mbed online compiler but the compiler ends up with 4 errors:

Error: MbedCRC is not a template in "sd-driver/SDBlockDevice.h", Line: 230, Col: 6 Error: Identifier "POLY_7BIT_SD" is undefined in "sd-driver/SDBlockDevice.h", Line: 230, Col: 14 Error: MbedCRC is not a template in "sd-driver/SDBlockDevice.h", Line: 231, Col: 6 Error: Identifier "POLY_16BIT_CCITT" is undefined in "sd-driver/SDBlockDevice.h", Line: 231, Col: 14

Looks like some problems with the sd-driver library?

Any suggestions?

posted by Hans-Günther Nusseck 15 Apr 2018

I downloaded and tested Greg-san's project, "FTHR_USBMDS_BD." And in my environment, the project worked fine without any modification.

================
--- Mbed OS filesystem example ---
Mounting the filesystem... OK
Opening "/fs/numbers.txt"... OK
Incrementing numbers (0/10)...
Incrementing numbers (1/10)...
Incrementing numbers (2/10)...
Incrementing numbers (3/10)...
Incrementing numbers (4/10)...
Incrementing numbers (5/10)...
Incrementing numbers (6/10)...
Incrementing numbers (7/10)...
Incrementing numbers (8/10)...
Incrementing numbers (9/10)...
Incrementing numbers (10/10)... OK
Closing "/fs/numbers.txt"... OK
Opening the root directory... OK
root directory:
    numbers.txt
Closing the root directory... OK
Opening "/fs/numbers.txt"... OK
numbers:
    3
    1
    2
    3
    4
    5
    6
    7
    8
    9

Closing "/fs/numbers.txt"... OK
Starting MSD... OK
================

moto

posted by Motoo Tanaka 16 Apr 2018

Thanks moto! After updating the mbed-os library by hand (right click and then "update..."), the code compiles successfully. That's strange because I activated the checkbox "update all libraries to the latest version"....

With the latest mbed-os library, Greg's project, "FTHR_USBMDS_BD." also work on my environment.

Thanks a lot.

The thing I don't understand is, why the "official" SD-card example (https://os.mbed.com/teams/MaximIntegrated/code/FTHR_SD_Demo/) is not working at all??

posted by Hans-Günther Nusseck 17 Apr 2018

Greg -

Thanks for your input. The code works great!

Regards,

- Just Gary

posted by Just Gary 12 Jul 2018
6 years, 8 months ago.

Hi, same for me: I tried several examples without success.. Also the demo project of the online mbed compiler is not generating the promised "Hello World" myfile.txt

Any idea?

Hans-Günther

6 years, 8 months ago.

Hi Just,
I cannot answer your question perfectly because I don't have a MAX32630FTHR board.
But I have been trying several way to use the SD card during 2 to 3 week and finally success.
Please try my program as below.
/users/kenjiArai/code/SD_Card_Control_on_OS5/
At least you need to modify my program.

//  Constructor ----------------------------------------------------------------
//DigitalOut      led(LED1);      // same as D13 (equal to SPI CLK) STM Nucleo
//DigitalIn       user_sw(USER_BUTTON);
DigitalIn       user_sw(P2_3);    // For MAX32630FTHR 
Serial          pc(USBTX, USBRX, 115200);
#if (MBED_MAJOR_VERSION == 2)
SDFileSystem    sd(D11, D12, D13, D10, "fs");  // do,di,clk,cs
#elif (MBED_MAJOR_VERSION == 5)
//SDBlockDevice   sd(D11, D12, D13, D10, 8000000);
SDBlockDevice   sd(SPI0_MOSI, SPI0_MISO, SPI0_SCK, SPI0_SS, 8000000);    // For MAX32630FTHR 
FATFileSystem   fs("fs");
#endif

In the program, you can check the interface condition using FatFs monitor (you can enter the monitor by hit a key from terminal).
Please let me know again if you cannot control the SD.