|
stm32f107+SD |
|
|
|
 |
Ответов
|
Feb 1 2016, 11:52
|
Гуру
     
Группа: Свой
Сообщений: 2 724
Регистрация: 14-05-07
Из: Ярославль, Россия
Пользователь №: 27 702

|
Цитата(Jenya7 @ Feb 1 2016, 11:43)  Пытаюсь понять некоторые моменты. С SD можно общаться по SPI или SDIO. Но я не понимаю оба модуля разделяют те же пины? я не нашел в даташит пины для SDIO. Видимо, нет в STM32F107 модуля SDIO. Цитата(Jenya7 @ Feb 1 2016, 11:43)  еще такой вопрос - какая максимальная частота для общения с SD? я читал 400 килогерц. А где читал? В документации английским-по-белому CODE --------------------------------------------------------------------------------- Clock frequency Identification Mode (the low freq. is required for Fod max 400kHz MultiMediaCard compatibility). --------------------------------------------------------------------------------- Clock frequency Data Transfer Mode Fpp max 25MHz ---------------------------------------------------------------------------------
|
|
|
|
|
Feb 1 2016, 12:24
|
Профессионал
    
Группа: Участник
Сообщений: 1 778
Регистрация: 29-03-12
Пользователь №: 71 075

|
Цитата(adnega @ Feb 1 2016, 17:52)  Видимо, нет в STM32F107 модуля SDIO. А где читал? В документации английским-по-белому CODE --------------------------------------------------------------------------------- Clock frequency Identification Mode (the low freq. is required for Fod max 400kHz MultiMediaCard compatibility). --------------------------------------------------------------------------------- Clock frequency Data Transfer Mode Fpp max 25MHz ---------------------------------------------------------------------------------
Модуль SDIO есть. но даже если нет - это отдельные пины? не знаю для чего нужен первый режим Clock frequency Identification Mode но если он есть мы ограничены на 400 кило?
|
|
|
|
|
Feb 1 2016, 13:45
|
Гуру
     
Группа: Свой
Сообщений: 2 724
Регистрация: 14-05-07
Из: Ярославль, Россия
Пользователь №: 27 702

|
Цитата(Jenya7 @ Feb 1 2016, 15:24)  Модуль SDIO есть. Откуда такая уверенность? Даташит, утверждает, что нет SDIO в STM32F107. Цитата(Jenya7 @ Feb 1 2016, 15:24)  но даже если нет - это отдельные пины? "Нет ножек - нет варенья". Например, в STM32F407 модуль SDIO есть, и для него в DS есть описание выводов. Цитата(Jenya7 @ Feb 1 2016, 15:24)  не знаю для чего нужен первый режим Clock frequency Identification Mode но если он есть мы ограничены на 400 кило? Карта после сброса начинает работать в этом режиме. После завершения инициализации можно повышать частоту. Я понял, что это нужно для совместимости с картами MMC.
Эскизы прикрепленных изображений
|
|
|
|
|
Feb 1 2016, 14:45
|
Гуру
     
Группа: Свой
Сообщений: 2 724
Регистрация: 14-05-07
Из: Ярославль, Россия
Пользователь №: 27 702

|
Цитата(Jenya7 @ Feb 1 2016, 17:04)  да. похоже в конективити лайн нет SDIO. странно. я не видел в примерах чтобы после инициализации повышали частоту. Попробуйте конкретнее утверждать, а то сплошные "где-то читал" видел в "каких-то примерах". Вот описание из стандартной библиотеки файл stm32_eval_sdio_sd.c CODE * A - SD Card Initialization and configuration * ============================================ * - To initialize the SD Card, use the SD_Init() function. It * Initializes the SD Card and put it into StandBy State (Ready * for data transfer). This function provide the following operations: * * 1 - Apply the SD Card initialization process at 400KHz and check * the SD Card type (Standard Capacity or High Capacity). You * can change or adapt this frequency by adjusting the * "SDIO_INIT_CLK_DIV" define inside the stm32xx_eval.h file. * The SD Card frequency (SDIO_CK) is computed as follows: * * +---------------------------------------------+ * | SDIO_CK = SDIOCLK / (SDIO_INIT_CLK_DIV + 2) | * +---------------------------------------------+ * * In initialization mode and according to the SD Card standard, * make sure that the SDIO_CK frequency don't exceed 400KHz. * * 2 - Get the SD CID and CSD data. All these information are * managed by the SDCardInfo structure. This structure provide * also ready computed SD Card capacity and Block size. * * 3 - Configure the SD Card Data transfer frequency. By Default, * the card transfer frequency is set to 24MHz. You can change * or adapt this frequency by adjusting the "SDIO_TRANSFER_CLK_DIV" * define inside the stm32xx_eval.h file. * The SD Card frequency (SDIO_CK) is computed as follows: * * +---------------------------------------------+ * | SDIO_CK = SDIOCLK / (SDIO_INIT_CLK_DIV + 2) | * +---------------------------------------------+ * * In transfer mode and according to the SD Card standard, * make sure that the SDIO_CK frequency don't exceed 25MHz * and 50MHz in High-speed mode switch. * To be able to use a frequency higher than 24MHz, you should * use the SDIO peripheral in bypass mode. Refer to the * corresponding reference manual for more details.
|
|
|
|
|
Feb 1 2016, 15:59
|
Профессионал
    
Группа: Участник
Сообщений: 1 778
Регистрация: 29-03-12
Пользователь №: 71 075

|
Цитата(adnega @ Feb 1 2016, 20:45)  Попробуйте конкретнее утверждать, а то сплошные "где-то читал" видел в "каких-то примерах". Вот описание из стандартной библиотеки файл stm32_eval_sdio_sd.c CODE * A - SD Card Initialization and configuration * ============================================ * - To initialize the SD Card, use the SD_Init() function. It * Initializes the SD Card and put it into StandBy State (Ready * for data transfer). This function provide the following operations: * * 1 - Apply the SD Card initialization process at 400KHz and check * the SD Card type (Standard Capacity or High Capacity). You * can change or adapt this frequency by adjusting the * "SDIO_INIT_CLK_DIV" define inside the stm32xx_eval.h file. * The SD Card frequency (SDIO_CK) is computed as follows: * * +---------------------------------------------+ * | SDIO_CK = SDIOCLK / (SDIO_INIT_CLK_DIV + 2) | * +---------------------------------------------+ * * In initialization mode and according to the SD Card standard, * make sure that the SDIO_CK frequency don't exceed 400KHz. * * 2 - Get the SD CID and CSD data. All these information are * managed by the SDCardInfo structure. This structure provide * also ready computed SD Card capacity and Block size. * * 3 - Configure the SD Card Data transfer frequency. By Default, * the card transfer frequency is set to 24MHz. You can change * or adapt this frequency by adjusting the "SDIO_TRANSFER_CLK_DIV" * define inside the stm32xx_eval.h file. * The SD Card frequency (SDIO_CK) is computed as follows: * * +---------------------------------------------+ * | SDIO_CK = SDIOCLK / (SDIO_INIT_CLK_DIV + 2) | * +---------------------------------------------+ * * In transfer mode and according to the SD Card standard, * make sure that the SDIO_CK frequency don't exceed 25MHz * and 50MHz in High-speed mode switch. * To be able to use a frequency higher than 24MHz, you should * use the SDIO peripheral in bypass mode. Refer to the * corresponding reference manual for more details.
спасибо. просто я подключил библиотеку FATFS к проекту и в примере не нашел явного переключения частоты. Код int main(void) { FRESULT result; FATFS FATFS_Obj;
result = f_mount(&FATFS_Obj, "0", 1); if (result != FR_OK) { //printf("Îøèáêà ìîíòèðîâàíèÿ äèñêà %d\r\n", result); }
DIR dir; FILINFO fileInfo; int nFiles = 0;
result = f_opendir(&dir, "/"); if (result == FR_OK) { while (((result = f_readdir(&dir, &fileInfo)) == FR_OK) && fileInfo.fname[0]) { nFiles++; } } f_closedir(&dir);
FIL file; UINT nRead, nWritten;
result = f_open(&file, "readme.txt", FA_OPEN_EXISTING | FA_READ); if (result == FR_OK) { f_read(&file, &buff, 1024, &nRead); f_close(&file); }
result = f_open(&file, "write.txt", FA_CREATE_ALWAYS | FA_WRITE); if (result == FR_OK) { f_write(&file, &buff, nRead, &nWritten); f_close(&file); }
while(1) { } }
|
|
|
|
1 чел. читают эту тему (гостей: 1, скрытых пользователей: 0)
Пользователей: 0
|
|
|