2016-01-28 12:47 PM
Guys,
I see: STM32Cube_FW_F1_V1.0.0\Projects\STM3210C_EVAL\Applications\FatFs\FatFs_uSD Could you tell me which file should I modify so I can use SPI2 on STM32F107 with this application ? Thanks2016-01-29 02:31 AM
Hi h.rick,
In the example STM32Cube_FW_F1_V1.0.0\Projects\STM3210C_EVAL\Applications\FatFs\FatFs_uSD, the SPI configuration is done in the files stm3210c_eval and stm3210c_eval_sd available under STM32Cube_FW_F1_V1.3.0\Drivers\BSP\STM3210C_EVAL.The SPI3 is used in this example as you can see it in the file stm3210c_eval.h.Hope this will help you to go ahead with your application.-Mayla-To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2016-01-29 10:09 AM
Does this support SD-HC cards? Seems not to use the right commands, and arbitrarily truncates a 64-bit byte offset into a 32-bit one. So I don't expect anything above 2GB to be viable.
In 2015-2016 it doesn't really seem fit for purpose.. The HC specs date from a decade ago. There seems to be a disconnect here between what needs to be supplied for a competitive solution and framework, and what is being delivered. As frustrated as I am with h.rick, he wouldn't be mired in these issues if the stuff just worked properly out of the box.2016-01-29 02:00 PM
Which file is for user_diskinitialize() ?
I can't find it.... It's only abstraction not a complete user_diskinitialize().... Low level one with :Stat = STA_NOINIT;
DSTATUS stat = RES_OK;
BYTE n, cmd, ty, ocr[4];
//;
if (pdrv) return STA_NOINIT; /* Supports only single drive */
power_off(); /* Turn off the socket power to reset the card */
if (stat & STA_NODISK) return stat; /* No card in the socket */;
power_on(); /* Turn on the socket power */
FCLK_SLOW();
for (n = 10; n; n--) xchg_spi(0xFF); /* 80 dummy clocks */
ty = 0;
if (send_cmd(CMD0, 0) == 1) { /* Enter Idle state */
Timer1 = 100; /* Initialization timeout of 1000 msec */
if (send_cmd(CMD8, 0x1AA) == 1) { /* SDv2? */
for (n = 0; n < 4; n++) ocr[n] = xchg_spi(0xFF); /* Get trailing return value of R7 resp */
if (ocr[2] == 0x01 && ocr[3] == 0xAA) { /* The card can work at vdd range of 2.7-3.6V */
while (Timer1 && send_cmd(ACMD41, 1UL << 30)); /* Wait for leaving idle state (ACMD41 with HCS bit) */
if (Timer1 && send_cmd(CMD58, 0) == 0) { /* Check CCS bit in the OCR */
for (n = 0; n < 4; n++) ocr[n] = xchg_spi(0xFF);
ty = (ocr[0] & 0x40) ? CT_SD2 | CT_BLOCK : CT_SD2; /* SDv2 */
}
}
} else { /* SDv1 or MMCv3 */
if (send_cmd(ACMD41, 0) <= 1) {
ty = CT_SD1; cmd = ACMD41; /* SDv1 */
} else {
ty = CT_MMC; cmd = CMD1; /* MMCv3 */
}
while (Timer1 && send_cmd(cmd, 0)); /* Wait for leaving idle state */
if (!Timer1 || send_cmd(CMD16, 512) != 0) /* Set R/W block length to 512 */
ty = 0;
}
}
CardType = ty;
deselect();
if (ty) { /* Initialization succeded */
stat &= ~STA_NOINIT; /* Clear STA_NOINIT */
FCLK_FAST();
HAL_UART_Transmit(&huart1, ''USER INITIALIZE SUCCEDED!
'', 100, 1000);
} else { /* Initialization failed */
power_off();
}
HAL_UART_Transmit(&huart1, ''USER INITIALIZE FINISHED!
'', 100, 1000);
Thanks
2016-01-29 02:25 PM
Can you tell me how it connects to :
if(FATFS_LinkDriver(&SD_Driver, SDPath) == 0) There are too many abstraction and jumping around between many disk_initialize function.... Could you please tell me the relation ? I created one with atmega128 and it's straight forward...., There are only 3 files on atmega128, sdmmc.c, diskio.h and ff.c.... and all the low level are in sdmmc.c thanks2016-01-29 02:40 PM
2016-01-29 02:47 PM
USER_initialize (0);
if (USER_initialize (0)==RES_OK) { HAL_UART_Transmit(&huart1, ''DISK INITIALIZE SUCCEEDED! main.c\r\n'', 100, 1000); }2016-01-31 01:20 AM
2016-02-01 01:29 AM
Can I bypass user_diskio.c and fatfs.c and put my init code in diskio.c ?
I don't what are those functions inside those files for, making the job more complicated... Thanks2016-02-02 05:25 AM
Please find the complete project attached, it's compiled with keil, thanks
________________ Attachments : STM32F107_SDCard_SPI2.7z : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Htgx&d=%2Fa%2F0X0000000aVo%2FdybQJF19seF4i0gRH4BYe2scz7hae.2B7j8hNB7Oac8&asPdf=false