2008-03-17 11:04 PM
Accessing SD Mass Storage Memory on STM3210B-EVAL
2011-05-17 03:22 AM
Thanks for the info Bart. Been off-line for the last couple of days so I will check out your links. Be nice to have some ready-written code for the STM32...
James2011-05-17 03:22 AM
my $.02:
those that want to communicate to an embedded system via USB mass storage must keep in mind that most file systems (FATs, indeed) don't allow concurrent low-level access to the media. this means that the embedded system *cannot* read the files on the memory while it's mounted on the PC via USB MS. the unit must be safely stopped first, otherwise you'll see a corrupted file system due to caching issues at different levels. (but you could access the files via the host file system, using something similar to codesourcery's ''hosted'' option, but it would be too complex and fragile IMHO.)2011-05-17 03:22 AM
Hi all,
You can have a look on this thread on our STR7 Forum,http://www.st.com/mcu/forums-cat-6208-17.html
a FAT demo is already done for STR7, the port to STM32 is very easy , just you need to update the SPI routines as the ones done on STM32 Evaluation USB Mass storage example. Enjoy it 🙂 Regards, STOne-32.2011-05-17 03:22 AM
Hi,
Does anybody have port the FAT file system from the STR7? I have actually to deal with it, so it would be helpful if someone has already port everything. Thank you in advance. PS: if nobody has done it, I will do it and release it on the forum.2011-05-17 03:22 AM
The port was really simple. 8-)
You will find enclosed the files modified. You need to simply add the usb_* and stm32f10x_* lib. Enjoy... :D2011-05-17 03:22 AM
Hi joneuhaus,
Thanks for the port! Can you please post how did you handle the Timer1, in void T0OC1_IRQHandler(void) ? Thanks, Frank2011-05-17 03:22 AM
Check this :http://elm-chan.org/fsw/ff/00index_e.html
2011-05-17 03:22 AM
Thanks joneuhaus for the additional info!!
One more question: Who is calling the disk_timerproc found in mmc.c ?? Thanks, Frank2011-05-17 03:22 AM
Instead of using the Timer1, I use the systick with a 1ms time base.
Here are the 3 functions to put in main.c : /******************************************************************************* * Function Name : SysTick_Config * Description : Configure a SysTick Base time to 10 ms. * Input : None * Output : None * Return : None *******************************************************************************/ void SysTick_Config(void) { /* Configure HCLK clock as SysTick clock source */ SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK); /* SysTick interrupt each 100 Hz with HCLK equal to 72MHz */ SysTick_SetReload(720000); /* Enable the SysTick Interrupt */ SysTick_ITConfig(ENABLE); } /******************************************************************************* * Function Name : Delay * Description : Inserts a delay time. * Input : nCount: specifies the delay time length (time base 10 ms). * Output : None * Return : None *******************************************************************************/ void Delay(u32 nCount) { TimingDelay = nCount; /* Enable the SysTick Counter */ SysTick_CounterCmd(SysTick_Counter_Enable); while(TimingDelay != 0) { } /* Disable the SysTick Counter */ SysTick_CounterCmd(SysTick_Counter_Disable); /* Clear the SysTick Counter */ SysTick_CounterCmd(SysTick_Counter_Clear); } /******************************************************************************* * Function Name : Decrement_TimingDelay * Description : Decrements the TimingDelay variable. * Input : None * Output : TimingDelay * Return : None *******************************************************************************/ void Decrement_TimingDelay(void) { if (TimingDelay != 0x00) { TimingDelay--; } } The prototype of the functions Systick_Config and Delay have to be declared on top of the main.c. You need to declare a public variables in main.c : static vu32 TimingDelay = 0; You have to declare the prototype of Decrement__TimingDelay in main.h and modify the interrupt handler in stm32f10x_it : /******************************************************************************* * Function Name : SysTickHandler * Description : This function handles SysTick Handler. * Input : None * Output : None * Return : None *******************************************************************************/ void SysTickHandler(void) { /* Decrement the TimingDelay variable */ Decrement_TimingDelay(); } This is more documented in the example of the systick (available on the website). Hope it helps... :D2011-05-17 03:22 AM
According to the str711 example, the disk_timerproc function is called in the Timer1 interrupt.
So in our case, it should be called in the systick interrupt (each 10ms).