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.

MSP430F5329 is interfaced to 4Gb SDHC card

Other Parts Discussed in Thread: MSP430F5329

HI All,

interfaced SDHC 4gb (class 4) card to msp430F5329 MCU.

My spi speed is less than 400Khzs.

1. getting response 0x01 from SD card after sending CMD0.

2. getting response 0x05 from SD card after sending CMD8, means my sd card is version1, not version 2.

3.getting response 0x01 from SD card after sending ACMD41(0x55+0x69).(if i test with 16Mhz SPI clock frequency getting response 0x00).

CLEAR_CS_SDCARD;

SD_sendcmd(GO_IDLE_STATE,0,0x95); // software reset and Ideal cmd
//Now wait for READY RESPONSE
if(mmcGetResponse(GO_IDLE_STATE)!=0x01)
return MMC_INIT_ERROR;
CLEAR_CS_SDCARD;
spiB1Tx(DUMYBYTE);
if(response==0x01)
{

CLEAR_CS_SDCARD;
spiB1Tx(DUMYBYTE);
SD_sendcmd(SEND_IF_COND ,0x1AA,0x87); // using old SD card
// if new SD card want to use CMD8,arg:0x1AA,CRC:0x87
response=mmcGetResponse(SEND_IF_COND);

do{
// CLEAR_CS_SDCARD;
spiB1Tx(DUMYBYTE);
SD_sendcmd(APP_CMD,0x0,0x65); // using old SD card
// if new SD card want to use CMD8,arg:0x1AA,CRC:0x87
response=mmcGetResponse(APP_CMD);

// SET_CS_SDCARD;
spiB1Tx(DUMYBYTE);
spiB1Tx(DUMYBYTE);
// CLEAR_CS_SDCARD;
SD_sendcmd(APP_SEND_OP_COND,0x40000000,0xFF); // ACMD41 SCH=1
response=mmcGetResponse(0x69);
// SET_CS_SDCARD;
watchdogReset();
} while(response !=0x00);

IF spi clock is 16MHZ getting responce 0x00, and CMD1 also getting response, But not getting response of CMD16 . kindly help me to solve the problem.

  • Hello Mahdu,

    I believe your issue will be related to the speed in which you are driving the SPI Clock. Please see the following app note for more information. Specifically, look at section 4.2 Calculating the Maximum SPI Communication Speed. (http://www.ti.com/lit/slaa734 )
  • HI Jace H,

    thanks for giving quick replay.

    as per MSP430F539 SPI Timing equection is fUCxCLK = 1/2tLO/HI with tLO/HI ≥ max(tVALID,MO(USCI) + tSU,SI(Slave), tSU,MI(USCI) + tVALID,SO(Slave)).

     

    AS per data sheet fucxclk = MAX(20+5ns),(55+76ns).

                                                 MAX(25,131nsec.),  1/2(131nsec.)=3.8Mhz is my spi speed of data transmission 

    my SPI initialization is 

    void initspiB1(void)
    {
    P4SEL |= BIT1+BIT2+BIT3; // P3.3,4 option select
    UCB1CTL1 |= UCSWRST; // **Put state machine in reset**
    UCB1CTL0 |= UCMST+UCSYNC+UCCKPH+UCMSB; // 3-pin, 8-bit SPI master
    UCB1CTL1 |= UCSSEL_2; // SMCLK
    UCB1BR0 = 40; // 
    UCB1BR1 =0; //
    UCB1CTL1 &= ~UCSWRST; // **Initialize USCI state machine**

    }

    my spi clock is running 400Khz. Attaching my spi clock speed image.

    my doubt is where i want to give data transmission speed in my initialization.

  • Hello Mahdhu,

    I'm confused from your initial question here. From your original post it seemed like you were running the SPICLK at two different speeds. On speed at ~400kHz that is working fine and one speed at 16MHz that is not. Is that not the case?

    If that is not the case, then I encourage you to go through the other SPI sections of the app note I pointed to to help narrow down the issue. Also, looked at your capture above, if the top point is your clock, it is quite noisey. If this is the case, then I would look into if you are potentially getting crosstalk on your board as well.
  • Hello Mahdhu,

    Did the app note pointed to above help resolve your issue? If no response soon, I'll assume you have resolved your issue and close this thread.
  • Hi Jace H,

    sorry for delay replay,
    my problem is solved, but issue is not SPI clock, after using MSP-EXP430F5529_UE_Demo_Software, my problem is solved.