how to change USB SD-MSD SDHC to SPI mode

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how to change USB SD-MSD SDHC to SPI mode

1,373 Views
sudhakarp
Contributor V

Hi,

i am using FRDMK64 controller and KDS3.0 and KSDK1.3.0 example. i got USB SD-card mass storage device from KSDK example.straight way its working with SDHC protocol. but i want to implement with SPI pins.so how to modify code to USB SD-MSD  with  SPI mode. i saw configuration setting in example code

#if SD_CARD_APP

    #define USE_SDHC_PROTOCOL    (0)

    #define USE_SPI_PROTOCOL     (1)

#endif

i changed to SPI_PROTOCOL but its not working. i changed SD card pins connection to SPI pins also. i am sure with hardware connection.  can you give some idea..?

regards,

sudhakar p

Labels (2)
0 Kudos
3 Replies

911 Views
Carlos_Musich
NXP Employee
NXP Employee

Hi Sudhakar,

The example you are using is prepared to add SPI support but it is not implemented yet.

As you can see in disc.c there macro USE_SPI_PROTOCOL is defined but not used. You need to implement each function of the driver and you may use this macro to build SPI functions of DSHC functions.

E.g.

#if USE_SPI_PROTOCOL

void spi_detect_io_init(void)

{

//this must be defined in disc.c by user

}

#else

void sdhc_detect_io_init(void)

{

//this code is already defined in disc.c...

}

#endif

Regards,

Carlos

0 Kudos

911 Views
sudhakarp
Contributor V

hi,

     and also i modified SD_Init() function related to SPI. i attached that code also.but its not working its hanging inside

SDSPI_DRV_Init(); function

if (kStatus_SDSPI_NoError != SDSPI_DRV_GoIdle(spi, card))

    {

        return kStatus_SDSPI_Failed;

    }

please can u find problem where i am doing mistake

thanks and regards,

sudhakar p !

0 Kudos

911 Views
Carlos_Musich
NXP Employee
NXP Employee

Hi Sudhakar,

I checked your disc.c file and I did not find the SPI initialization and I saw your edits in USB_App_Class_Callback to read and write using SPI but I did not see the SPI initialization.

Regards,

Carlos

0 Kudos