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.

CC3200: Issue with SD card after waking up from sleep.

Part Number: CC3200

Hi,

Quick description: i can't connect (mount, open, read, write or get information) from the SD card after waking up from low power deep sleep. before entering the LPDS mode, the SD works fine and i can interact with it.

What i'm doing:

In my project, i'm collecting data and saving them in SD card, and to do that i'm:

1- Initialization:

    + mounting the SD card

    + creating/opening few files

2- Device read data from sensor it will store it by writing in file

3- Device enter low power deep sleep

4- Wake up after few minutes to repeat from step 2 (read data from sensor)

in step 4, i can't write in SD card, i even tried to mount again the SD card but i get error code 13 ("there is no valid fat volume")

all file system function (read, write, get info, etc) won't work and the device will stop there (i even have a watch dog activated but the device won't restart, it just stopped in that function and doesn't response to any interruption (click button)), if delete the LPDS functionality from the device, and replace it by just waiting for couple minutes, the device works fine. i tried to unmout the SD card before i go to LPDS and closed all files, again, i face the same issue, the device will not be able to use the SD card and it will stop (freeze) in f_stat (i'm using that function to get information from SD card about the file i'm writing into).
I think i'm missing something i should do before i go to sleep, but i can't figure it out, some i hope someone can help me with this

Thank you

Habib

  • Hi Habib,

    When you enter LPDS mode on the CC3200, you will lose the state of many of the peripherals including the SD host peripheral. Are you performing an entire re-init of the SD host peripheral when re-mounting the SD card?

    Regards,

    Michael

  • Hi,

    I'm calling this function every time the device wake up to init the SD host peripheral:

    void vSdCardCfg(void)
    {
    	MAP_PinTypeSDHost(ucPin_SD_DO, PIN_MODE_8);
    	MAP_PinTypeSDHost(ucPin_SD_CLK, PIN_MODE_8);
    	MAP_PinTypeSDHost(ucPin_SD_CMD, PIN_MODE_8);
    	MAP_PinDirModeSet(ucPin_SD_CLK,PIN_DIR_MODE_OUT);
    	MAP_PinConfigSet(ucPin_SD_DO,PIN_STRENGTH_4MA, PIN_TYPE_STD_PU);
    	MAP_PinConfigSet(ucPin_SD_CMD,PIN_STRENGTH_4MA, PIN_TYPE_STD_PU);
    	MAP_PRCMPeripheralClkEnable(PRCM_SDHOST,PRCM_RUN_MODE_CLK);
    	MAP_PRCMPeripheralReset(PRCM_SDHOST);
    	MAP_SDHostInit(SDHOST_BASE);
    	MAP_SDHostSetExpClk(SDHOST_BASE,MAP_PRCMPeripheralClockGet(PRCM_SDHOST),15000000);
    }

  • Hi Habib,

    Your init code looks correct, and running that vSdCardCfg() function at startup and after LDPS is what you should be doing, so good to see that's implemented.

    At this point, there isn't anything obvious that might be causing your LPDS + SD peripheral, so some experimentation will be needed.

    I suggest you try performing PRCMPeripheralReset(PRCM_SDHOST) after you unmount the SD card but before you enter LPDS and see if that helps.

    You can also use a logic analyzer to check the SD signals to the SD card, and see what happens on those SD signals when you enter and exit from LPDS.

    What do you observe if you perform those steps?

    Regards,

    Michael

  • Hi,

    I tested what you have suggested but not luck, i still cannot make it works after waking up.

    This is what i have tested so far:

    Before sleep (before calling this function "MAP_PRCMLPDSEnter()") , close all opened files and unmout the SD card

    After sleep (when device wake up), call the vSdCardCfg() to reinit the SD card configuration and then mount the SD card again and open files again, (at least that what i'm trying to do). but that doesn't work for me

    Can you tell me, if i do need to remount and re-open again all files each time the device wakes up or i can just let all files open before go to sleep mode and with that i don't need to open them again?

    Regards,

  • Hi,

    It's unlikely that you'll be able to simply keep all of your files open during LPDS unfortunately. This is since in LPDS the processor state and peripheral state is lost and will need to be reloaded and initialized. As this will result in unpredictable operation of the SD host peripheral, you will want to close your files before entering LPDS.

    I'm curious, if you use hibernate instead of LPDS, do you still run into these issues? You can enter hibernate with the following code:

    		MAP_PRCMHibernateIntervalSet(SLEEP_TIME);
    		MAP_PRCMHibernateWakeupSourceEnable(PRCM_HIB_SLOW_CLK_CTR);
    		MAP_PRCMHibernateEnter();
    

    Regards,

    Michael

  • Hi Michael,

    First of all ,i want to thank you for your help,

    I already have implemented the hibernate mode to turn the device off and on by click button, and the device works fine after waking up from hibernate (and i changed the code to use a timer as source of waking up) but i don't think this would help since the device will just reinitialize the firmware and reload the code and execute again from start (the device will just restart) but not like the LPDS where the device will wake up from a certain point to run the init function to reinit all the peripherals mentioned in that function.

  • Hi,

    After few testes i manage to make it work, i think the issue was the successive sleep the device is doing (i mean, the device will wake up after 1 sec from LPDS to do things (less then a 0.5 sec) and back to sleep again) this caused a problem since the device can't find the time to mount the SD card and open the file, and ofc i need to unmout and close file before go to sleep.
    Thank you for your help.

    Best regards,

    Habib