2015-10-21 04:33 AM
Hi,
I have created a sdio and i would like to know how to merge the FATFS file system with the SDIO. I have seen some examples but i am not understanding how the they give a link between file system module and SDIO.2015-10-21 05:26 AM
You provide interface/abstraction routines in DISKIO.C
2015-10-22 03:50 AM
ok, now i can see how they integrate it the whole.
i would like to know the following two lines,SD_Error SD_ReadMultiBlocks(uint8_t *readbuff, uint64_t ReadAddr, uint16_t BlockSize, uint32_t NumberOfBlocks).SDIO_DataInitStructure.SDIO_DataBlockSize = (uint32_t) 9 << 4why its uint64_t ReadAddr, is that a 64 bit address ? whats (uint32_t) 9 << 4 means ?2015-10-22 04:36 AM
> why its uint64_t ReadAddr, is that a 64 bit address ?
Yes, otherwise we wouldn't be able to address more than 4GB of space.> whats (uint32_t) 9 << 4 means ? Go read about . In this case it's bitwise logical left shift. 9 << 4 = 9 * (2^4) = 144 = 0x90 I don't know why they did it this way instead of using the SDIO_DataBlockSize_512b definition.
2015-10-22 05:26 AM
thanks for the answer, qwer.asdf.
i have done the bitwise operation already and i know it its 144. but i wonder why its 144 insted of 512?.They say that, SDIO_DataLength = NumberOfBlocks * BlockSize;so the data block size has to be 512 not 9 << 4.does nayone know why its like that ?2015-10-22 05:53 AM
See the description of SDIO_DCTRL register in the reference manual.
...Bits 7:4 DBLOCKSIZE: Data block size
...
1001: (9 decimal) lock length = 29 = 512 bytes
...
That's why they used 9, and shifted it left by 4 bits to fit it in the bits 7:4 of the register.
2015-10-22 06:11 AM
yes, u r correct.
i would like also to know what are the parameters do i need to consider when i need to calculate the writing speed and reading speed?give me some example of calculating if u can.2015-10-22 06:17 AM
You take a free running counter, clocking at a known frequency, and measure the elapsed time in ticks of that counter over the operation you are measuring.
I'd recommend a 32-bit counter, clocking as rapidly as possible. I've posted examples using DWT_CYCCNT Measure the time with larger blocks (multiple sector read/write), measuring a single sector will just result in seeing all the command processing overhead.2015-10-23 02:47 AM
ok clive.. is it possible to post the link of your example?
2015-10-23 06:15 AM
I use Google to find my own posts.
[DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Duration%20of%20FLOAT%20operations&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=4973]https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2Fcortex_mx_stm32%2FDuration%20of%20FLOAT%20operations&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=4973 Second post, how to use DWT_CYCCNT to stop-watch execution in processor cycles. You could also use TIM2 (assuming F4) which is a 32-bit timer, just configure the time base with a maximal period, and if it's more convenient set the prescaler so TIM2->CNT ticks with milliseconds, ie Prescaler = 84 -1; // Assuming it's clocking at 84 MHz (APB1 @ 42 MHz)