Skip to content

PRO TIP Block youtube.com at the DNS level — Pi-hole, NextDNS or your hosts file — but allow youtube-nocookie.com and i.ytimg.com. These tutorials keep playing; the rabbit hole does not.

Learning without distractions

SD-card w. FatFS (using SDIO) – STM32 Tutorial #33

9.7K views on YouTube

In this video you will learn how to interface a SD-card with FatFS (ExFAT to be exact) using SDIO. I manage to thoroughly mess it up but figure it out at the end. I have left the mess so you can see – and avoid – the pitfalls yourself – and I actually added the solution the day after the main part was created.

It is a rather long video but it is a slightly complicated subject, so please do bear with me and like the video anyway 😉 The video was a result of a request in the comments of an earlier video.

Using the code from this project with a proper Micro-SD Breakout Board: https://www.youtube.com/watch?v=yRuedNsV-5M

Some viewers expressed doubt that 4–bit mode works. I made further tests and proof in this video: https://www.youtube.com/watch?v=L8gfZCnjct8

In next video we will repeat this but using SPI for communication with the SD-card. Watch that video here: https://www.youtube.com/watch?v=rk8rMyOc76M

Documented on the STM32World site here: https://stm32world.com/wiki/STM32_SD_card_with_FatFs
Project Files: https://github.com/STM32World/stm32fun

#STM32 #Tutorial #SDIO #sdcard #FatFS #STM32World

00:00 Intro and recap
00:40 Explaining SD cards
03:25 The basic project configuration
04:10 Enabling SDIO and FatFS in STM32CubeMX
12:10 Not working – figuring out why
13:00 SDIO working in 1-bit mode – switching to 4-bit
14:20 Overriding weak function for SD Detect pin
15:12 Mounting FatFS
17:25 Keeping track of TOTAL uptime
25:30 Implementing a dir/ls function
29:24 Writing and reading a big file (1 MB)
31:40 Figuring out what went wrong
33:23 Messing it all up and finally realising what I did wrong (or did I)
39:00 Writing the tick file
42:35 Messing up again (obviously did not have enough first time)
44:47 Follow up – the solution to the 1-bit vs. 4-bit confusion!
46:08 Switching from 1-bit to 4-bit
47:45 Not initialising SDIO separately