There are two additional info 1. Make sure sd card module gets 5V. Try separate power supply if possible 2. When you format SD card in windows10 with FAT32, select 4096bytes for allocation unit size.
I tried this on F401CCU6,I had to change f_lseek(&fil, fil.fsize) => f_lseek(&fil, fil.fptr).At first,no file was generated.Then I saw this commet,I formatted the card to 4096 and connected 5 volts to vcc.Finally,It worked.👍👍👍👍
Sir, I follow exactly what u did but when I use Usb cable which give 5V to sd MH-SD card module with sd card adapter, however I cant find the text file in the micro sd card although my system file of sd card was FAT32 and allocation size was 4096bytes. I use STM32F103C8T6, windows 10, and ST link v-2. Please help me, I am really losing patient on this
Thank You Nizar you are the best! Your explanation is very clear and code is working [just change f_lseek function to -> f_lseek(&fil, f_size(&fil)); ], also thanks for SD reformatting info!
Great tutorial! I appreciate your generousity on giving lessons, I hope you make same tutorial using the chip l293 for both DC motor and stepper motor, again thank you so much❤
Very good tutorial I tried it with the Nucleo STM32F446RE I had to make a few minor changes but got everything working just fine. The only question I have...Where do I find the additional SD card commands like: create directory, delete directory, delete file, rename file and append to file. Are these functions available within this library somewhere???
It worked with 8MHZ in all the clocks, with the stm32f103c8t6 and stm32f411e board. What should I have to modify if I want to increase the clock frequency for example to 72 Mhz?
Hello, in this tutorial, I saw you to use SPI 1 for communicating between STM32F103 and SD card module. I want to ask you that dose it work well if I use SPI 2? If it is OK, do I have to change any things in SD library?. Thank you so much!
Actually, the library creator "Lee Ji-hoon" used with spi2. It will work The link is below github.com/eziya/STM32_SPI_SDCARD/tree/master/STM32F4_HAL_SPI_SDCARD I suggest if you want SPI2 with STM32F103C8T6, try with SPI1 first. If everything works well, change to SPI2 You need to modify fifth last line in fatfs_sd.h file extern SPI_HandleTypeDef hspi1; Thanks
I can't seem to get this to work at all with the Nucleo F446RE Board. Everything looks correct, but I can't get anything to write to the SD card... I'm using SPI2, pins PB13, 14, and 15. My CS Pin is on PB12. Everything programs, just no file on the SD card...
Hi, is it possible to store a firmware in SD card module and make it work for stm32 chip. Instead of using internal flash memory? I mean can we use external SD card as flash memory for stm32 chip?
Code works fine. However, if you use 3.3V SD card module, you may need to add extra capacitor (47uF? or more) between 3.3V and GND. Without it SD seem to draw too much current and project no longer works.
Hey bro I saw a new change for the function f_lseek(&fil,fil.size()); if someone has a problem to intance the method fil.size try to use f_size(&fil) so the function f_lseek would be f_lseek(&fil,f_size(&fil));
I am not sure whether spi sd card is capable of writing 500 times in one second. You can put the data in a array buffer and then write it to sd card every one second. If there any data loss, you can reduce the data logging rate.
I am working on stm32F103C8T6 bluepill..i had done samething in the viedo,but it does not store anything in my SD Card. I am giving 5 Volts to the Vcc.I am using 32 GB Micro Sd card,but it does not show anything.what should i do??
Hello I did the same thing you did it doesn't give any error and shows the same debug as you but when I open the SD file, it's not there Please help me fix it!
Hi, 1. Check the card works on a PC and it’s file system is FAT32 2. Make sure SD card reader VCC gets 5V (Supply 5V to Micro-controller via USB before connecting st-link) 3. Try with a different SD card if you have another. 4. Check the wiring connectins
hello sir, this code is working and executes successfully with 0 errors, but the file "write.txt"is not creating into the sd card, can you please give me the solution for this problem sir?
The library creator named eziya in github used it for STM32F4. github.com/eziya/STM32_SPI_SDCARD/tree/master/STM32F4_HAL_SPI_SDCARD I modified to work with STM32F1. You can use the original codes
Hi Bro ! I have a string , Ex : Helpme = " nguyentienthanh"; I want to save "Helpme" in SD_card Because "Helpme" always changing Can you help me write a function that saves string like above? Thanks you very much !!
Hi Thành Tiến, You can use separate files for each variables. For example Helpme = " nguyentienthanh"; you can use Helpme.txt and then save the variable without f_lseek(&fil, fil.fsize); It will overwrite in the beginning of the file. Another option is to use eeprom as I have shown in video-no-66 and video-no-67 of my RU-vid channel. Thanks
I am not familiar with GRBL I have some types of lcd or tft with stm32. links ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-9F2gTb3n_p0.html ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-l-JVnlJIPao.html ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-8hypVJ2U7OE.html
Hello, I am using STM32L432 board and I want to write and read data from the SD card, similar to this video. All the settings you did in .ioc were done by me too. The file built with 0warnings and 0 errors. The addition of the unint line in include files was done by me for the respective header files too. I am not able to see the text file on the SD card. Can you help me. Thank you for the video. Please help me. Thank you
Hi @NizarMohideen, In fatfs_sd.c GET_SECTOR_SIZE command always returns 512. So i cannot understand what is the meaning of setting MAX_SS config to 4096 in CubeMX. Maybe i dont understand something here?
Hi, 1. Check the card works on a PC and it’s file system is FAT32 2. Make sure SD card reader VCC gets 5V (Supply 5V to Micro-controller via USB before connecting st-link) 3. Try with a different SD card if you have another.
@@NizarMohideen I have tried everything earlier as well. It does not work. I used a 16 GB SD card of San disk formatted as FAT32. Gave external 5V supply. Card works perfectly fine when connected to arduino uno.
If you are using STM32F103C8T6,It should work. To check the solder joints in pins PA4,PA5 PA6 PA7 ,5V AND G, you can connect LED's on it and run a simple blink program. If solder joints are good, make sure PA7 - MOSI / PA6- MISO Make sure the library file name spellings fatfs_sd.h / fatfs_sd.c Make sure you followed all the CUBEIDE settings given below Click connectivity → Click SPI1 For Mode select Full Duplex Master Set PA4 to GPIO_Output Click Middleware → Click FATFS Tick User-defined Configuration → Set Defines For USE LFN (Use Long Filename) select Enabled with static working buffer on the BSS For Max SS (Maximum Sector Size) select 4096 After all if it still not works, you can send me the main.c - user_diskio.c - stm32f1xx_it.c (3 files) to my email nizarmohideen@hotmail.com, I can find any errors on it for you Good luck
me too, of cause using the EXACT same STM32F103C8T6 and card slot and etc. And I have checked hundreds times of pins and the cubide settings, but it alwals give me a FR_NOT_READY. When I debug into the code, it seems initialize failed, because SD_SendCmd(CMD0, 0) returned 255 instead of 1
Oh by the way. I have 4 different micro sd cards, they all returns FR_NOT_READY. Is it possible that the firmware package version has some problem? I'm using FW_F1 V1.8.0, and I don't know why stm32cubeide doesn't let choose version earlier than 1.8.0. of cause i have downloaded some old versions in package manager.
Hi Nizar while i am running this program in sdio i am getting this error can you tell me why it is coming like that [STM32F407ZGTx.cpu] halted due to debug-request, current mode: Thread xPSR: 0x01000000 pc: 0x08000900 msp: 0x20020000