cancel
Showing results for 
Search instead for 
Did you mean: 

STM3210C_eval evaluation board to read 4G SD card

robbie
Associate II
Posted on January 06, 2016 at 11:16

Target: STM32_EVAL evaluation board 

with STM32F107VC

Tools: ST-Link/V2

Does anyone know how to read 4G SD (or more) card ?!

how can I fix it?!

I used fatfs to operate SD card, when 2G SDcard plugged in the slot, it's fine.

But 

plugged more than 2G SDcard, it doesn't work.

4 REPLIES 4
Posted on January 06, 2016 at 15:17

The block addressing scheme must not use a byte offset via a 32-bit variable, and the code would need to support SDHC cards which use a slightly different command expectation.

I'm not currently working on F1 platforms, or have this board.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
robbie
Associate II
Posted on January 07, 2016 at 02:46

Thanks for your reply.

I checked my fatfs the file object structure (FIL) show 

Force 32bits alignement

 

so I think software it on the right way.

Is it the H/W limitation on this D-board?

Does any ideas to solve my problem? 

I will 

appreciate your help very much.

Thanks All. 

Posted on January 07, 2016 at 03:09

No, it's really not a FatFs issue, it's the sector read/write routines for the SDIO/SPI layer below DISKIO.C

I've posted fixed routine for the F4 using SDIO.

The F1 series has this

STM32F10x_StdPeriph_Lib_V3.5.0\Utilities\STM32_EVAL\Common\stm32_eval_sdio_sd.c

The ReadAddr here is broken because it uses a 32-bit variable that isn't going to hold an offset >4GB properly.

/**

  * @brief  Allows to read one block from a specified address in a card. The Data

  *         transfer can be managed by DMA mode or Polling mode.

  * @note   This operation should be followed by two functions to check if the

  *         DMA Controller and SD Card status.

  *          - SD_ReadWaitOperation(): this function insure that the DMA

  *            controller has finished all data transfer.

  *          - SD_GetStatus(): to check that the SD Card has finished the

  *            data transfer and it is ready for data.

  * @param  readbuff: pointer to the buffer that will contain the received data

  * @param  ReadAddr: Address from where data are to be read.

  * @param  BlockSize: the SD card Data block size. The Block size should be 512.

  * @retval SD_Error: SD Card Error code.

  */

SD_Error SD_ReadBlock(uint8_t *readbuff, uint32_t ReadAddr, uint16_t BlockSize)

{

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
robbie
Associate II
Posted on January 08, 2016 at 04:34

Thanks for your reply.

Well, I got the same

characterization 

in 

stm32f1XX series

 peripheral library

  * @brief  Reads block(s) from a specified address in an SD card, in polling mode. 

  * @param  p32Data: Pointer to the buffer that will contain the data to transmit

  * @param  ReadAddr: Address from where data is to be read  

  * @param  BlockSize: SD card data block size, that should be 512

  * @param  NumberOfBlocks: Number of SD blocks to read 

  * @retval SD status

uint8_t BSP_SD_ReadBlocks(uint32_t* p32Data, uint64_t ReadAddr, uint16_t BlockSize, uint32_t NumberOfBlocks)

{

==============================================

Do you have any suggestion to fix it that I can read/write 4G(above) SD card?!

I will 

appreciate your help very much.

Thanks