2015-11-05 06:23 AM
hello
i am working on a project using stm32f103vft6, the purpose is to save audio data froma mems microphone to a sdcard. the problem is when i want to change teh blocksize in the sdcard configuration from 512 to 2048 i have an error. it accepts only the 512 bytes block.i am using SAMSUNG 16GB Class10 and ADATA 16GB Class10 UHS1.thanks2015-11-05 07:42 AM
Why do you need to change it?
You can read/write MULTIPLE blocks, it's more efficient that way, you can easily write 32KB of data in a single operation.2015-11-05 08:20 AM
hello clive
i have a timing problem, and i have to write data in the sdcard beforebefore the dma buffer be full.i have 2 buffers that i use to write data in sdcard, the first one is fill with datawhen the dma buffer is in half part and the second is fill when the dma buffer is full.between the 2 dma interrupts(half and full) i have 74 ms. and between this 2 interruptsi lost data.how do i write an entire 32kb block in one time.thanks2015-11-05 10:16 AM
Using the ping/pong HT/TC method is a common way of dealing with audio data. The memory write could occur in the foreground.
Around here we use FatFs and just f_write large blocks, and have the abstraction in diskio.c coded properly to pass large read/write down to the SDIO/SPI layer STM32F10x_StdPeriph_Lib_V3.5.0\Utilities\STM32_EVAL\Common\stm32_eval_sdio_sd.c/**
* @brief Allows to write blocks starting from a specified address in a card.
* The Data transfer can be managed by DMA mode only.
* @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 WriteAddr: Address from where data are to be read.
* @param writebuff: pointer to the buffer that contain the data to be transferred.
* @param BlockSize: the SD card Data block size. The Block size should be 5
* @param NumberOfBlocks: number of blocks to be written.
* @retval SD_Error: SD Card Error code.
*/
SD_Error SD_WriteMultiBlocks(uint8_t *writebuff, uint32_t WriteAddr, uint16_t BlockSize, uint32_t NumberOfBlocks)
{...
2015-11-08 01:48 PM
hello clive
thanks for th informationi have tested the block size transfer, it works fine but sometimes the transfer is interrupted.i have found that in the writeblock function at the end there is a test about the sdcard state :/*!< Add some delay before checking the Card Status */ for(count = 0; count < 0xFFFF; count++) // 0xFFFF { } /*!< Wait till the card is in programming state */ errorstatus = IsCardProgramming(&cardstate); while ((errorstatus == SD_OK) && ((cardstate == SD_CARD_PROGRAMMING) || (cardstate == SD_CARD_RECEIVING))) { errorstatus = IsCardProgramming(&cardstate); }in normal mode the cardstate is SD_CARD_TRANSFER.but when the transfer is interrupted the cardstate is : SD_CARD_RECEIVINGand it happens at any time.thanks