This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28379D: SD CARD Storage

Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE

Hi,

We are using 28379D control card to develop some power electronics applications. Since there is a built-in SD card slot, we plan to use it to save some parameters.

I am not familiar with the SD card working mechanism.  I tried to use the functions "disk_initialize()", "disk_read()", and "disk_write()" inside mmc_F2837x.c  to write an array onto the SD card and read it back, but it seems not working. 

Does SD CARD require that all the data must be saved in a file structure?  We only need to save some paramters onto the SD card,  and later we can fetch them.  The provided SD CARD example seems more advanced than our application.

Thanks,

Kaiyu    

  • The functions in mmc_F2837x.c are basically an abstraction layer for the FatFS. I've never tried calling them directly, so I'm not sure how well that would work. Have you tried using the FatFS calls (f_open, f_read, etc...) instead? Have you run the example in C2000Ware under \device_support\f2837xd\examples\cpu1\sd_card?

    You don't necessarily have to use a file system if your use case doesn't require it though. We don't have any examples of that in C2000Ware, but there is an old app note here that gives a demonstration of it. Given the age of the app note, we might not be able to provide much support for it if you find issues, but it could be worth checking out.

    Whitney

  • Hi Whitney,

    I tried to use FatFs calls. When I call f_open function, it will go through the following lines

    ......

    /* Search FAT partition on the drive */

    fmt = check_fs(fs, bootsect = 0); /* Check sector 0 as an SFD format */
    if (fmt == 1) { /* Not a FAT boot record, it may be patitioned */
    /* Check a partition listed in top of the partition table */
    tbl = &fs->win[MBR_Table + LD2PT(drv) * 16]; /* Partition table */
    if (tbl[4]) { /* Is the partition existing? */
    bootsect = LD_DWORD(&tbl[8]); /* Partition offset in LBA */
    fmt = check_fs(fs, bootsect); /* Check the partition */
    }
    }
    if (fmt || LD_WORD(&fs->win[BPB_BytsPerSec]) != S_SIZ) /* No valid FAT patition is found */
    return FR_NO_FILESYSTEM; 

    ......

    function check_fs()   pass value 2 to variable "fmt", and it reports "FR_NO_FILESYSTEM" error. The SD Card is formatted FAT32, and I can read it from Windows machine.

    Anything I can try to fix this issue?

       

  • I'm not sure why that wouldn't work. What kind of card are you using?

    Another thing to consider is that the version of the FatFs code you're using is very old. We've actually added a newer version of it to C2000Ware under libraries/fatfs/ which supports more features and probably has some bug fixes if you want to try to switch to it. We don't have an F2837x example that uses it though--just one for the F2838x in \driverlib\f2838x\examples\c28x\sdspi but you may be able to port it.

    Whitney

  • Hi Whitney,

    I got chance to retest the SD card with 28379D example code and your control card. It gives me the same error message "FR_NO_FILESYSTEM".

    At this point, I don't think it is the code issue. There is slim chance the SD circuit on the control evaluation card somehow gets damaged.

    (1) Do I need to make any jumper/DIP switch adjustment on the control card?

    (2) The SD card is 512MB, file system FAT(default), and allocation unit size is default allocation size. Any thing could mess up the SD card?

    Thanks,

    Kaiyu

  • There shouldn't be any jumpers or switches related to the microSD slot. It should be ready to use. I'm checking with some colleagues who have some experience with this SD card code as well to see if they have any ideas.

    I don't think the GPIOs that are used for the SD SPI are brought out to the docking station pins, but you might be able to connect those pins to the Input XBAR and then route through the Output XBAR to some GPIOs that are available on the docking station to be able to monitor if the SPI transmissions at least look correct.

    Whitney