简体   繁体   English

检测取出的 SD 卡 - C - ARM -

[英]Detecting removed SD-Card - C - ARM -

how it is possible to detect the removed SD-Card, and after that how it is possible to detect the inserting and do the re-mounting?如何检测取出的 SD 卡,然后如何检测插入并重新安装? I am working at STM32-F401 in C and with fatfs.我在 STM32-F401 使用 C 语言和 fatfs 工作。 Detecting incorrect mounting or removed card is relatively easy:检测不正确的安装或移除的卡相对容易:

fresult1 = f_mount(&myFATAFS, SDPath, 1)
while(FR_OK != fresult1){
     /*Watch out for sd-card and if you find one try to mount*/
     ...
}

And now?现在?

You can't do it from this level.你不能从这个层面做到这一点。 SD interface has line CD - CardDetect. SD接口有线CD-CardDetect。 You should connect it to GPIO and test it in the timer interrupt (EXTI interrupts are not good for that as debouncing is needed)您应该将其连接到 GPIO 并在计时器中断中对其进行测试(EXTI 中断对此不利,因为需要去抖动)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM