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.

MSP430 sd card busy after few hours

Prodigy 60 points

Replies: 8

Views: 665

Hi All,

I am using microSd(SDHC) for data storage. I a using MSP430BT5190 MCU for communication. Initially everything works fine. For every second i have to write 2048 bytes data to the sd card. I am making data into four 512 blocks and writing to the sd card. I am not using any file systems. I am writing data  directly to the sectors also also maintaining one reserved sector for house keeping variables. For each block write or read i am providing 60ms time gap.

My problem is:

After few hours sd card is not able to write the data. CMD24 always responding with 0xFF. I will keep trying for every 60ms. After 10 attempts i will re-boot the device(Software reset). After reset sd card never initialize until i remove the battery and keep it back. 

Also i need few clarification

What is the time gap between two successive writes or read? (Using 8GB class 4 microSD)

Is there any command to Format the sd card?

some times single read block is giving the junk data. second or third attempt it will works fine. why? (using DMA)

 

Note: While sd card initialization SPI clock speed is 1mhz and after initialization i am increasing the SPI clock speed to 20mhz.

Please give me some advice..

Thanks!

8 Replies

  • Genius 4170 points

    Have you tried different SD cards,we did have quite different responses from idfferent manufacturers, so maybe that could be an issue.

    Also did you try to use a lower frequency for your SPI-clock, I would try with 1 MHz all the time, additionally did you scope your SPI clock, 20MHz could be pretty advanced for some PCB layouts, dont know in your case.

    Also you could , as a workaround, reinitialise your SDcard after each write, or after certain times.

  • In reply to seb:

    Hi Seb,

    Thanks for your reply.

    we tried transcend, sandisk and samsung. few cards are working fine and few cards are not working. Not sure where is the issue.

    We have to read ADS samples for every 4ms. So After each write re-initialization may not be possible but we can try re-initializing after few writes.

    We will try the both workarounds and get back to you.

    Regards,
    Rajesh T.
  • Guru 46710 points

    In reply to Rajesh T:

    >Not sure where is the issue.
    I agree to seb here. Main susspect is signal integrity. You shall run tests at lower SPI speeds, like 8MHz, see how it goes. How long are signal traces between msp and card? Is it possible to look at CLK+MOSI and CLK+MISO waveforms?
  • In reply to seb:

    Hi Seb,

    I tried your workaround suggestions it didn't worked giving same issue. I tried reducing the clock speed it worked fine at 1MHz and 2MHz. When i try more than 2MHz sd card started hanging after few hours. Slowing down the clock speed doesn't help me because each block writing is taking 10ms. so, i am missing two ads samples for every 500ms. Any more suggestions.

  • Genius 4170 points

    In reply to Rajesh T:

    sounds like signal integrity problem, cause the more speed your SPI has the more it looks like a triangle rather than a square wave, and so maybe your SD card simply doesnt understand it. You should watch it with a scope, look how your real signals look like, also important how long the signal lines are, stray capacitances ans impedance matters, the higher the signal speed gets, and so on.

    Could of course be something simpler :) in the analog world only testing helps.

  • Guru 46710 points

    In reply to Rajesh T:

    >When i try more than 2MHz sd card started hanging after few hours.
    You did not answer very important question about signal trace length. Also I asked to check signal using scope and show waveforms. Maybe your problems is not line capacitances capacitances but noise on signal/clock lines or VCC supply. Please show 2MHz signal waveforms
  • In reply to Ilmars:

    Hi,

    Rajesh and I are working together on this project.

    Following are the details you asked for.

    Length of the signals

    CLK = 19.01mm

    MOSI = 22.03mm

    MISO = 24.99mm

    CS =  22.21mm

    CLK-MOSI at 2MHz

    CLK-MISO - at 2MHz

    Let us know if anymore checks to be done.

    Thanks 

    Arun

  • Guru 46710 points

    In reply to Arun Kumar27:

    Trace lengths seems to be ok for 2MHz SPI, signal waveforms looks more or less ok. Thou I would like to see waveforms at frequency which is unstable.

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.