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.

FAT32 Support for SD Card

In the examples included with the 5505 CSL, there is a collection of File System system support software.

Is there and updated version available anywhere else?  Im trying to use this to read / write to a FAT32 SD Card, and while the basics are working, the library seems somewhat incomplete.

 

Thanks,

-Jason

  • Hi,

    What version of CSL are you using? The latest version is 2.01. This version supports FAT32 SD card. The below is the link to download it.

    http://software-dl.ti.com/dsps/dsps_public_sw/dsps_swops_houston/C55X/CSL-c55x-lowpower-versions.htm

    Regards,

    Hyun

  • I have 2.0.1, and I am trying to compile the source code in "..\c55xx_csl\ccs_v4.0_examples\drv\atafs\src" to a library file... however, the source code seems out of date.

    For example, atafunc.c cannot compile because it is missing a closing parenthesis in the return statement.

     

    Thanks,

    -jason

  • Hi,

    I checked it again. This version is working fine if you use as it provided using an included project file. atafunc.c is not used in the project file to generate ata library.

    Are you tring to build your own libary to include all c files in the source directory?

    Regards,

    Hyun

  • Ahh, OK.  Yes, I was using the code only.

    A few other quick questions:

    1. Is BIOS support required for building this project?

    2. Im seeing a number of "function declared implicitely" warnings for "toupper()" which is normally in string.h.  Shouldn't this be in the #includes?

    3. I also see the "function declared implicitely" warnings in atalong_setname.c for get_time() and get_date().  Are they neccesary, or can I just comment out those lines?  My project will not have realtime clock support.

     

    Thanks,

    -Jason

  • Hi,

     

    1. Is BIOS support required for building this project?

    --> If the project includes .tcf file then it's BIOS project.

    2. Im seeing a number of "function declared implicitely" warnings for "toupper()" which is normally in string.h.  Shouldn't this be in the #includes?

    --> it cleared most of warnings to add  #include <string.h>. 

    3. I also see the "function declared implicitely" warnings in atalong_setname.c for get_time() and get_date().  Are they neccesary, or can I just comment out those lines?  My project will not have realtime clock support.

    --> it'll take a time to answer this question.

     Regards,

    Hyun

  • Thanks, Hyun. I am able to build & run the sample code for FAT in CSL successfully. My question is how can I open an existing file on SD, somewhat like fopen() in C. I couldn't find it in ATAFS library.

    Thanks again.

    Joe

  • Hi Joe,

    That's good that you can run the FAT example code.

    The current CSL does not include fopen() type function for SD card in the ATAFS library. The example code only creates a new file in SD card. We are working on an example code that opens the existing file. When it's available, I'll let you know.

    Regards,

    Hyun

  • Hi Joe,

    File open and a few more functions are available. Please try it.

    Regards,

    Hyun

    ata_ext_func.zip
  • Hi Hyun,

    Thank you for the quickest response I've got. ^^ I did try the ATA_fopen() but failed. The ATA_fopen() return success but the "Size" field is always zero. I tried to set the Size field right manually then ATA_readLittleEndian() returned success but the output buffer is all zero which is not correct.

    Could you please have it checked again?

    Thanks a lot!

    Joe

  • Hi Joe,

     

    I attached updated version and application example code. This has been verified.

     

    Regards,

    Hyun

    ata.zip
  • Hi Hyun,

    The code works great. I am able to read the existing file from FAT32 now. Thank you a million!

    I have another question about the ATAFS example. The out file's size is 530K in debug mode & 517K in release mode. AFAIK, the total memory in 5505 is 320K. How can the out file fit the 5505 memory then? Is there anyway that I reduce the code space because my project is still growing.

    Thank you very much!

    Joe

  • Hi Joe,

     

    The out file size does not mean the real size of code. The actual code size will be known when you convert to binary file to load to flash. Or you can look up the MAP file which shows the exact memory usage of your code. If the code does not fit in the internal memory, it won't run. The code size reduction involves a few areas which are compile option, use assembly and your coding skills.

     

    Regards,

    Hyun

  • Thanks a lot, Hyun. It solved my problem about the code size. However, I encountered another problem with the ATAFS when I tried to use ATAFS + LCD DMA together (CSL_LCD_262ColorMode_Example). I think you are the only one who can help me out.

    I am using DMA for the LCDC & POLLING MODE for MMC. After initializing the MMC by calling "configSdCard(CSL_MMCSD_OPMODE_POLLED);", the LCDC DMA will never complete (cnt_lcd = 0). I realized that DMA engine was working correctly (EOF0 in LCDSR was on when buffer was transferred) but the interrupt routine lcd_isr() was not called somehow. All the corresponding bits are set (DONE_INT_EN in LCDLIDDC)

    Could you please tell me what might be the problem? Thanks for your help. I really appreciate it!

    Joe

  • Hi Joe,

    Thanks Joe but I'm not the only one to help you. There are many people out there to help each other.

    You are going to deep dive to C5515 DSP :-).  At this point I'm not sure that I understand your problem. The quickest way is sending  your  code to me .

    You can send me to hyunkim@ti.com if you don't want to post it here. In the mean time, my initial thought is the promble will be in using DMA channel settings.

    There are total of 16 channels DMA and should be used  correctly.

    Regards,

    Hyun

  • Hi Hyun,

    I tried to initialize the MMC first then the LCDC afterward then everything worked well. I am not sure what's exactly the problem is but it's solved for now. ^^

    I have some other problem when booting from SD. I created a new thread to make it clear. It would be great if you could have a look & help me out.

    http://e2e.ti.com/support/dsp/tms320c5000_power-efficient_dsps/f/109/p/53730/190630.aspx#190630

    Thank you a lot!

    Joe

  • I solved this problem. The problem is my using PIN GP[7] as GPIO to control the LCD so it conflicts with the MMC1. I removed the MMC1 port initialization (in MMC_Init) & it worked!

    Thanks,

    Joe

  • Hi Joe,

     

    Good work.

    Regards,

    Hyun

  • Hi Joe,

     

    I looked your e-mail where you mentioned that the example of FAT32 (CSL_MMCSD_SdCardFSExample_Out) worked correctly, so, I would like to ask for help/hints because I am having problems with this example. When you used this example did you need make changes? what changes? How did you use the DSP_BIOS to test this example? What SD card did you use (standard or HC)? Please, could you give me these information?

    The problem is that when the program run, the console presents the follow messages, however the end of test does not happen because the program stay at function MMC_read()of file csl_mmcdc.c more specifically at “while” located at line 3851 where hMmcsd->mmcRegs->MMCST0 are always zero, so, the program stay there infinitely.

     

    MMCSD-ATAFS TESTS!

    MMCSD-ATAFS POLL MODE TEST!

    SD Card detected

    SD card is High Capacity Card

    Memory Access will use Block Addressing

    SD card initialization Successful

     

    I am using SDHC (high capacity) so the read are made in block according the explanation of the function MMC_read()but I do not know how alter this characteristic in the program. I put a breakpoint after the program enters in function MMC_read (first if), at this point, the cardAddr is zero.

    My kit is C5515 ezdsp, so I changed the parameter CSL_MMCSD1_INST in the function MMC_open() according recommendation of Texas. My CSL is the 2.01.00.00.

    Please, could you help me?

    Regards,

    Andrea

  • Hi Andrea,

    I tested the sample code using C5505 & SDHC card. I think I got stuck at that instruction too but I couldn't remember how to get around it. It's been for a while & I was testing many functions of the 5505. One things you should keep in mind when debugging the MMCSD module is the MMCST0 register will be reset to 0 after being read (even by your debugger)

    TI just uploaded a new version of CSL which has some bug fixes in MMCSD module. I think you would like to check it out to see if it works.

    HTH

    Joe

  • Hi Joe, thank you for attention.

    I download the new CSL but the identical problem occurred.

    I spend this week debugging the code but I cannot find the reason of MMCST0 is always zero. I debugged the software step by step using “Step Into” of Debug to understanding what is happing but without success.

     

    Unfortunately I have a small time to implement software that record sound acquired by Codec in a SD card. So, I am ashamed but could you send to me the sources code that works? Sorry but my time is expiring.

     

    Many thanks,

     

    Andrea

  • Hi Andrea,

    C5515 eZdsp is using MMCSD1 instead of MMCSD0. Our new CSL handle this issue with compiler option. To make the example run successfully, you will need to change the csl_general.h as follows:

    comment out #define

     

    C5515_EVM (line 159)

    Then rebuild the project.

    Best regards,

    Ming

  • Hi Andrea,

    I just took the disk_read & disk_write & initialization code in the newest CSL & it worked with my 5505 custom board. I didn't try it with the evaluation board so I'm not really sure.  If your code doesn't work with the evaluation board, you might want to upload your code here. There are many TI employers in this forum & they will help.

    HTH,

    Joe