cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L152 usb msc device with SD on SPI

Lo�c Bouilly
Associate II
Posted on September 15, 2017 at 10:34

Hi everyone,

I have a problem with USB MSC device on my stm32l152. 

I take example from 'STM32Cube_FW_L1_V1.8.0' of USB_Device - MSC_Standalone. In this example the sdcard use SDIO for connect is SD. So I have only change USB_Storage.c for use my SD card connected in SPI. 

So my change are mainly STORAGE_Read and STORAGE_Write. For the rest of Middleware nothing are change. 

But when a plug the USB to my PC (Windows 10). It recognize as 'Device USB Mass Storage' but windows say : 

- Insert Disk in lector

It not recognize my SDCARD. 

The logic analizer see the packet of transfert bulk but I thing that the Host doesn't ACK the transfert and then ask a reset. This repeat and repeat. The step are :

- SCSI_TEST_UNIT_READY

- SCSI_TEST_UNIT_READY

- SCSI_TEST_UNIT_READY

- SCSI_READ_CAPACITY10

- SCSI_READ_CAPACITY10

- SCSI_READ10

- Reset USB

So do you think it's problem with my change USB_Storage.c or something else ? 

Thanks a lot,

Lo�c

#windows10 #usb-msc-device #stm32l152 #sdcard-spi
1 ACCEPTED SOLUTION

Accepted Solutions
Lo�c Bouilly
Associate II
Posted on September 20, 2017 at 09:59

Update :

If you have the same trouble, I have change lot of things but still the same problem of ResetCallback after send the first block.

So I have take STM32Cube and make a new Project empty and the only different was :

void SystemClock_Config(void)
{
...
 RCC_OscInitStruct.HSICalibrationValue = 16;
...
}�?�?�?�?�?�?

I have put this variable HSICalibrationValue to 16 and fix my problem !

Loïc

View solution in original post

4 REPLIES 4
Lo�c Bouilly
Associate II
Posted on September 20, 2017 at 09:59

Update :

If you have the same trouble, I have change lot of things but still the same problem of ResetCallback after send the first block.

So I have take STM32Cube and make a new Project empty and the only different was :

void SystemClock_Config(void)
{
...
 RCC_OscInitStruct.HSICalibrationValue = 16;
...
}�?�?�?�?�?�?

I have put this variable HSICalibrationValue to 16 and fix my problem !

Loïc

Pierre Marbeuf
Associate
Posted on May 24, 2018 at 11:01

Salut Loic, je suis debutant dans le domaine et j'essaye de faire communiquer ma STM32L152RE avec un module pour lire la carte SD en SPI. Mais sur STM32CubeMX je n'arrive pas a configurer les ports SPI pour une carte SD, est ce que tu pourrais m'aider ?

Merci

Posted on May 24, 2018 at 11:11

Salut Pierre,

je peux probablement t'aider, ou est-tu bloqué dans la configuration des ports SPI ? Quelle libraries utilises-tu ?  

Cordialement,

Posted on May 24, 2018 at 11:25

Merci de ta reponse et de bien vouloir m'aider!

Alors en fait j'essaye de reutiliser le code d'un camarade qui programmait sur une STM32F103 sauf que je m'y perds completement je sais pas si c'est compatible entre les deux et j'ai melange pas mal de fichiers de configurations du coup j'ai des erreurs un peu partout dans mon projet pour le moment.

Du coup j'essaye de repartir sur un projet CubeMX ''neuf'' mais je n'arrive pas a configurer comme sur cet exemple la:

https://community.st.com/0D50X00009bMM7JSAW

Moi je n'ai ''que'' ces possibilites la:

0690X00000604jdQAA.jpg