2014-09-01 08:11 AM
Hi,
I want to use 512 Mb MMC card with STM32F103VC.Hardware is ok . Do you have any ideas on this issue? any driver for STM.How can I read and write file in MMC card ? Regards,2014-09-01 05:42 PM
STM32F10x_StdPeriph_Lib_V3.5.0\Utilities\STM32_EVAL\Common\stm32_eval_sdio_sd.c
STM32F10x_StdPeriph_Lib_V3.5.0\Utilities\STM32_EVAL\Common\stm32_eval_spi_sd.c FatFs ?2014-09-02 01:18 PM
Thanks a lot. I'll try them.
I want to do
.values
into
a file named
test.txt
to save
.for example
,in
the test.txt file
data
will be
as follows:
Row 1:
0123456789012
Row 2:
0123456789012
Row 3:
0123456789012
.........
.........
.........
.........
Row n
:0123456789012
2014-09-02 01:33 PM
Ok, so if you understand how to work with strings, sprintf(), and STDIO you should be golden.
FRESULT res;
FIL fil;
FATFS fs32;
memset(&fs32, 0, sizeof(FATFS));
res = f_mount(0, &fs32);
#ifdef DBG
if (res != FR_OK)
printf(''res = %d f_mount
'', res);
#endif
memset(&fil, 0, sizeof(FIL));
if (f_open(&fil, ''LOG.TXT'', FA_OPEN_ALWAYS | FA_WRITE) == FR_OK)
{
UINT BytesWritten;
const char string[] = ''Another line gets added
'';
f_lseek(&fil, fil.fsize); // Seek to end
f_write(&fil, string, strlen(string), &BytesWritten);
f_close(&fil);
}
2014-09-03 03:17 PM
I tested it.
/*-----------------------------------------------------------------------*//* Initialize a Drive *//*-----------------------------------------------------------------------*/DSTATUS disk_initialize ( BYTE drv /* Physical drive number (0..) */ ){.......... for (n = 10; n; n--) xchg_spi(0xFF); /* Send 80 dummy clocks */.....
...../*-----------------------------------------------------------------------*//* Exchange a byte */static BYTE xchg_spi ( BYTE dat /* Data to send */ ){ printf(''\n\rBYTE xchg_spi_SPI1->DR: %d'',dat); SPI1->DR = dat; while (SPI1->SR & _BV(7)) ; return (BYTE)SPI1->DR;}/*-----------------------------------------------------------------------*/
it shows at Hyper terminal ;BYTE xchg_spi_SPI1->DR: 255BYTE xchg_spi_SPI1->DR: 255BYTE xchg_spi_SPI1->DR: 255BYTE xchg_spi_SPI1->DR: 255BYTE xchg_spi_SPI1->DR: 255BYTE xchg_spi_SPI1->DR: 255BYTE xchg_spi_SPI1->DR: 255BYTE xchg_spi_SPI1->DR: 255BYTE xchg_spi_SPI1->DR: 255BYTE xchg_spi_SPI1->DR: 255BYTE xchg_spi_SPI1->DR: 255BYTE xchg_spi_SPI1->DR: 255BYTE xchg_spi_SPI1->DR: 255BYTE xchg_spi_SPI1->DR: 255and restart STM32F103VCBYTE xchg_spi_SPI1->DR: 255BYTE xchg_spi_SPI1->DR: 255BYTE xchg_spi_SPI1->DR: 255BYTE xchg_spi_SPI1->DR: 255BYTE xchg_spi_SPI1->DR: 255BYTE xchg_spi_SPI1->DR: 255BYTE xchg_spi_SPI1->DR: 255BYTE xchg_spi_SPI1->DR: 255BYTE xchg_spi_SPI1->DR: 255BYTE xchg_spi_SPI1->DR: 255BYTE xchg_spi_SPI1->DR: 255BYTE xchg_spi_SPI1->DR: 255BYTE xchg_spi_SPI1->DR: 255BYTE xchg_spi_SPI1->DR: 255Do you have any suggestion ?2014-09-03 08:56 PM
Do you have any suggestion ?
Well you'd want to start with the hardware, pins/interfacing. Make sure the drivers have been suitably ported to your board. Review how the card responds to commands. Test/validate the sector read/write functionality. Integrate into FatFs.