Skip to content

taejin-seong/STM32F411CEU6-SDIO-plus-FatFs-Test-With-UART

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

31 Commits
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Dev environment

IDE

  • STM32CubeIDE 1.6.0
  • STM32CubeMX

Terminal Program

  • Tera Term

Development Board

  • STM32F411CEU6 (Black Pill Board)

MicroSD & SD Card module

  • Using 8GB MicroSD (MicroSD capacity is not important)
  • Using NS-SD01 SD Card module
    • ๐Ÿ“Œ Image Link
    • If the SD card module supports the SDIO interface, it can be tested.
    • In addition, in this project, SD cards are detected using CD pin.

System Configuration

Diagram



Pic

๐Ÿ“Œ




Where's the file?

Test file path

๐Ÿ“‚
apSDCardTest ํ•จ์ˆ˜์—์„œ ์ œ๊ณตํ•˜๋Š” ํ…Œ์ŠคํŠธ ์™ธ์— ๋‹ค์–‘ํ•œ ํ…Œ์ŠคํŠธ๋ฅผ ์›ํ•  ๊ฒฝ์šฐ NOTE ๋ฅผ ์ฐธ๊ณ ํ•˜์„ธ์š”.

stm32f411ceu6_fw_module โ†’ src โ†’ ap โ†’ ap.c โ†’void apSDCardTest(void){...}



NOTE

๐Ÿ“‚
STM32์—์„œ ์ œ๊ณตํ•˜๋Š” FatFs ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์˜ API๋ฅผ ์ด์šฉํ•˜๋ฉด SD Card ๋‚ด์— FAT32 ํŒŒ์ผ ์‹œ์Šคํ…œ ๊ตฌ์กฐ ๊ธฐ๋ฐ˜์˜ File ์ œ์–ด (์ƒ์„ฑ/W/R/์‚ญ์ œ/์ด๋™/๋ณ€๊ฒฝ ๋“ฑ..)๊ฐ€ ์•„์ฃผ ์‰ฝ๊ฒŒ ๊ฐ€๋Šฅํ•ด์ง‘๋‹ˆ๋‹ค. ์ด๋ฅผ ์ฐธ์กฐํ•˜์—ฌ ์ถ”๊ฐ€์ ์ธ ํ…Œ์ŠคํŠธ๋ฅผ ํ•˜์‹œ๋Š” ๊ฒƒ์„ ์ถ”์ฒœํ•ฉ๋‹ˆ๋‹ค.

stm32f411ceu6_fw_module โ†’ src โ†’ lib โ†’ FatFs โ†’ src โ†’ ff.h / ff.c


STM32Cube MX Setting

Clock Configuration

๐Ÿ“Œ




Pinout

๐Ÿ“Œ





Peripheral & Core Configuration

1. UART1

๐Ÿ“Œ
โ€ข You can change parameter settings in uart.c



2. SDIO

๐Ÿ“Œ


3. GPIO

๐Ÿ“Œ
โ€ข SD Card Protocol์—์„œ SDIO๋กœ interfaceํ•  ๋•Œ CD Pin์€ ํ•„์š”์—†์Šต๋‹ˆ๋‹ค. ์ด๋Š” ๋‹จ์ง€ SD Card ๋ชจ๋“ˆ์—์„œ ์ง€์›ํ•ด์ฃผ๋Š” Pin์ž…๋‹ˆ๋‹ค. SD ์นด๋“œ๊ฐ€ ๊ฝ‚ํžˆ๋ฉด(Detected), CD Pin์€ High โ†’ Low๋กœ ๋™์ž‘ํ•ฉ๋‹ˆ๋‹ค.



4. DMA

๐Ÿ“Œ
โ€ข USART1 DMA Request Setting
ย ย ย ย ย -ย [USART1_RX]ย :ย ย Mode โ†’ Circular
ย ย ย ย ย -ย [USART1_TX]ย :ย ย Mode โ†’ Normal (All Default)

โ€ข SDIO DMA Request Setting
ย ย ย ย ย -ย [SDIO_RX]ย :ย ย All Default
ย ย ย ย ย -ย [SDIO_TX]ย :ย ย All Default




5. NVIC

๐Ÿ“Œ



Middleware

1. FATFS

๐Ÿ“Œ
โ€ข ์ง์ ‘ FATFS ํŒŒ์ผ ์‹œ์Šคํ…œ์„ ํฌํŒ…ํ•˜์˜€์Šต๋‹ˆ๋‹ค.

Testing

1. Sd Card Detection and Information print

๐Ÿ“Œ



2. a

๐Ÿ“Œ



3. b

๐Ÿ“Œ

โ€ข SD Card root directory current state




4. c

๐Ÿ“Œ

โ€ข SD Card root directory current state




5. d

๐Ÿ“Œ



โ€ข SD Card root directory current state




โ€ข Test C again




โ€ข HelloWorld.csv



6. e

๐Ÿ“Œ



โ€ข SD Card root directory current state




Note

When you build a project, you must exclude folders in the following paths from the build and debug entries:

  • stm32f411ceu6_fw_module โ†’ src โ†’ lib โ†’ Core

How to exclude

๐Ÿ“Œ
โ€ข Click Core folder and proceed with the following steps.

ใ€€ใ€€ใ€€


โ€ข The results are as follows.






Refer to

https://github.com/chcbaram/stm32f411

About

STM32F411CEU6 (black pill dev board) , Perform SDIO+FATFS32 test through Uart.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published