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.

MMCSD With FatFs Problems

Other Parts Discussed in Thread: OMAP-L138, SYSBIOS, OMAPL138

Hello everybody,

I'm working on the LCDK with the Omap-l138 and I am tring to use the uSD as an external storage for the ARM9 side, without PSP (only with StarterWare).
I know that there is FatFs support for the SysBios but it's only for the DSP side. 
I found some code to make the MMCSD peripheral work and I changed it a little bit so it will work.

I added the third party FatFs  files to the project, (the project can be found here:)
2061.SD_UnitTest_FatFs.zip
and supposedly, everything should be working fine but...

Working:

  1. Independant single\multyple read and write sequences (I can read the data I wrote to the SD card without FatFs)
  2. Mounting of the FatFs
  3. File open (Only for create !!)

Problems:

  1. Every other consecutive run, MMCSD initialization fails (sometimes HW reset is needed).
  2. Existing file open fails (FR_NO_FILE) - File was created with my PC-Windows 7.
  3. File Read\Write using FatFs fails
  4. File Close (thus, cannot see the files on my PC).
Notes:
  1. uSD was formatted over the PC to Fat32 with Windows 7.
  2. I found that after creation of a file, writing to it triggers the MMCSD interrupt but without any flags.
  3. I didn't fully understand how to use the MMCSD_MMCIM_EBSYDNE and MMCSD_MMCIM_ERSPDNE flags.
  4. Timing is probably a factor but I couldn't find how to do better.
Does anybody know what I'm doing wrong (with the code...)?
Thanks,
Yoel
  • Anybody out there?

  • Hi Yoel,

    we will look into it and get back to you at the earliest.

    Regards,

    Shankari.

  • Hi Yoel,

                 After looking at your code we understand you have used the mmcsd driver code from Starterware and tried to integrate the third party Fatfs code from Starterware.

    As this is a third party resource, you can customize the code with the reference of these.

    You can refer the following thread which discusses about the basics of the Fatfs integration with the mmcsd driver on C6748LCDK code.

    http://e2e.ti.com/support/embedded/bios/f/355/t/202584.aspx

    Hope this helps.

    Regards,

    Iyshwarya

    If this answers your question, please click the Verify Answer button below. If not, please reply back with more information.

  • Hi Iyshwarya,

    Believe me, I read every post about this issue many times.

    This post is using the PSP, I'm using the StarterWare.
    This post uses the DSP, I try to use the ARM.

    I already worked out most of the details as you can see in the project I posted but something is wrong and unfortunately I can't find out what.
    I don't think it's a problem with the FatFs but something with the communication with the SD because every other run I can't complete the SD initialization.

    I know you can't write an example for every peripheral but I see many unanswered posts about this exact subject so I posted my project in order to help others but it won't help us if you don't help me fix what is wrong, I've spent several month over this subject and this forum is the only support I can get. So please Help :)

    Best Rergards,
    Yoel 

  • Hello ????

    It's was kind of urgent  two month ago I would really appreciate some help other that telling me that it can work.

  •  

    Hi Yoel.

    Maor Tal tell me you need assistance. I see you get my old code for hardware..  for me that was only for prototyping and I don't use bare code now. but I'II try to help you - may be somebody else will  find that useful.

    first of all I understand you use DMA for data transfer between RAM and SD controller FIFO buffer. I recommend you use CPU transfers for debugging time - so you can pause transmission with hardware debugger on every stage. and start with lower sd clock frequency, maybe 2 or 5 Mhz, and in single wire mode. than if everything ok use DMA and hi-freg 4-wire mode to speed up data transfer. for Fat it does not matter how you write or read data to/from card.

    Every other consecutive run, MMCSD initialization fails (sometimes HW reset is needed). - what do you mean?

    best regards,

    Dmitriy.

     

     

     

     

     

     

     

     

     

     

  • Hey guys, just another user here who is seeking the same capability.  Looking to write to SD card from Arm w/ lightweight code.  Is there a more recent version of this project?  Is anyone at TI still working on a solution for this?  I would be glad to put forth some effort on this, but would like to start from the most recent progress. Thanks.

    Dave

  • Hi Dave,

    Thanks for your post.

    We do have starter ware GPIO example source for OMAPL138 LCDK for ARM core to detect the status of MMC/SD card insertion/ejection using GPIO pin configured in pinmux settings.

    You shall integrate & add the GPIO source code with thirdparty FatFs files  into your project and test the status of SD card (Read/Write) by generating an GPIO interrupt. Please find the attached gpioCardDetect.c source.

    /**
     * \file    gpioCardDetect.c
     *
     * \brief   This is a sample application file demonstrating the use of
     *          a GPIO pin to generate an interrupt whenever an MMC/SD card
     *          is inserted or ejected from the Evaluation Module(EVM).
     */
    
    /*
    * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/ 
    *
    *  Redistribution and use in source and binary forms, with or without 
    *  modification, are permitted provided that the following conditions 
    *  are met:
    *
    *    Redistributions of source code must retain the above copyright 
    *    notice, this list of conditions and the following disclaimer.
    *
    *    Redistributions in binary form must reproduce the above copyright
    *    notice, this list of conditions and the following disclaimer in the 
    *    documentation and/or other materials provided with the   
    *    distribution.
    *
    *    Neither the name of Texas Instruments Incorporated nor the names of
    *    its contributors may be used to endorse or promote products derived
    *    from this software without specific prior written permission.
    *
    *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
    *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
    *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
    *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
    *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
    *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
    *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
    *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    */
    
    #include "gpio.h"
    #include "psc.h"
    
    #include "soc_OMAPL138.h"
    #include "lcdkOMAPL138.h"
    
    /****************************************************************************/
    /*              LOCAL FUNCTION PROTOTYPES                                   */
    /****************************************************************************/
    static void Delay(volatile unsigned int delay);
    
    /****************************************************************************/
    /*              GLOBAL VARIABLES                                            */
    /****************************************************************************/
    
    /****************************************************************************/
    /*             LOCAL FUNCTION DEFINITIONS                                   */
    /****************************************************************************/
    
    int main(void)
    {
    
    
        /* The Local PSC number for GPIO is 3. GPIO belongs to PSC1 module.*/
        PSCModuleControl(SOC_PSC_1_REGS, HW_PSC_GPIO, PSC_POWERDOMAIN_ALWAYS_ON,
    		     PSC_MDCTL_NEXT_ENABLE);
    
        /* Pin Multiplexing of pin 12 of GPIO Bank 6.*/
        GPIOBank6Pin12PinMuxSetup();
    
        /* Sets the pin 109 (GP6[12]) as input.*/
        GPIODirModeSet(SOC_GPIO_0_REGS, 109, GPIO_DIR_OUTPUT);
    
        while(1)
        {
    		GPIOPinWrite(SOC_GPIO_0_REGS, 109, GPIO_PIN_LOW);
    
    		Delay(1000000);
    
    		GPIOPinWrite(SOC_GPIO_0_REGS, 109, GPIO_PIN_HIGH);
    
    		Delay(1000000);
        }
    
    
    } 
    
    /*
    ** \brief  This function checks the insertion status of the MMC/SD card
    **         in the device and prints related statements on the serial
    **         commuincation console of the external device.
    **         
    */
    
    /*
    ** \brief   This function can be called to generate a delay.
    */
    
    static void Delay(volatile unsigned int delay)
    {
        while(delay--);
    }
    
    
    /*****************************END OF FILE************************************/
    

    You shall also able to download the complete OMAP-L138 Startwe ware package from http://www.ti.com/ and please find the path below for the CCS project for GPIO starter ware example on LCDK OMAP-L138 ARM core.

    ~\OMAPL138_StarterWare_1_10_03_03\build\armv5\cgt_ccs\omapl138\lcdkOMAPL138\gpio

    Alternatively, you shall also use the MMC/SD test code on ARM core, but for OMAPL138 experimentor kit (Zoom). Please find the attached zip file for the BSL (Board support library) test code for MMC/SD, in which you have the CCS project for windows platform.

    5226.ARM eXp MMCSD Test.zip

    But, you should customize the Pinmux settings for the LCDKOMAPL138 board you have & integrate with the above BSL test code for MMC/SD on ARM core and you can try testing the MMC/SD card status.

    Thanks & regards,
    Sivaraj K
    ------------------------------------------------------------------------------------------------
    Please click the
    Verify Answer button on this post if it answers your question.
    ------------------------------------------------------------------------------------------------

     

     

     

  • Hey Sivaraj,

    I tried using the code you gave for the OmapL138 but with no luck.
    I keep getting result 13 for this line:

       rtn = sendCmd(mmcsd, MMCSD_CMD_ALL_SEND_CID, 0, 1); 

    What did you mean by customizing the PINMUX? Doesn't all the OmapL138 has the same PinMux? (PINMUX10 = 0x22222222, PINMUX11 = 0x00000022).
    I also saw that they don't configure GPIO 4[0] and 4[1] for the card detect there, maybe this could be the problem?

    I use a LogicPD SOM with OmapL138 on my custom board.
    Any thoughts?

    Cheers,
    Yoel 

  •  Hi Yoel,

    Thanks for your post.

    I mean by customizing the PINMUX is, make pinmux changes based out of your custom board LogicPD SOM with OmapL138 if applicable?

    You have to make sure, whether all the OMAPL138's has the same PinMux by checking the appropriate datasheet of both LogicPD Omapl138 & OMAPL138 experimentor kit (Zoom).

    Also, You can use GPIO starter ware example on LCDK OMAP-L138ARM core as reference and as this is a third party resource, you can customize the code with the reference of these.

    Thanks & regards,

    Sivaraj K

    ------------------------------------------------------------------------------------------------
    Please click the
    Verify Answer button on this post if it answers your question.
    ------------------------------------------------------------------------------------------------

     

  • Hi Yoel,

    I am interested in this topic, because I must do something similar.
    Have you been able to do a fully functional project?

    Thanks & regards

    Fabián

  • Hey Fabián,

    Sorry, Couldn't make it work.

    Your the fifth person who asked me for help with this topic, maybe TI will finally realize that this is something they should take care of.

    I found this post maybe you can use it with the ARM9, starterware is relatively the same on both processors.

    http://e2e.ti.com/support/embedded/starterware/f/790/t/283373.aspx

    I still use the PSP Bios code on the DSP side cause I havn't got the time to do this.

    Hope this will help you.

    Yoel.

  • Hi Yoel,

    Thanks for your help.

    The project of the link you gave me works fine on the DSP. For the moment, I'm using this code.
    In the future I might try to change the project to use it with the ARM. If I get a functional project for the ARM, I will report.

    Thanks & regards

    Fabián