I have updated the code on 1st JULY 2020. Read the Description for more info.
@emreseyyar5078
4 жыл бұрын
where can i download fatfs_sd.c and fatfs_sd.h libary ?
@ControllersTech
4 жыл бұрын
@@emreseyyar5078 go to the link in the description.. download the code, and you can find the files where i put them in the video
@alexandralopes1775
4 жыл бұрын
Thank you for the tutorial! Successfully tested on L433 Nucleo board! :) (with some small adaptations of course)
@aricrowe2887
4 жыл бұрын
Great video, thank you so much for your help! As other users have mentioned, if using an stm32f0 discovery board, make sure to set the spi data size to 8 bits. I also ran into a error where I could not build my project with a max sector size of 4096 (too large) so I changed it to 2048 and it worked fine.
@sharanrv
4 жыл бұрын
Hey! Are you using STM32F051 Board?
@golfercab7323
4 жыл бұрын
This helped a lot, thank you for the detailed walk-through!!!
@jamestroup417
4 жыл бұрын
Awesome tutorial. I can confirm that this works on clone chip CS32F103 Bluepill board using 32Gig Transcend SD card . Thank you Controllers Tech for your hard work.
@ibrahimkhadraoui7736
5 жыл бұрын
Thank you very much the best tutorials for stm32 in KZitem
@divanbessinger6899
3 жыл бұрын
Thanks for the video! I had to keep the MAXX_SS at 512 for my SDHC 16GB SanDisk to work.
@user-mn6us8xl5x
4 жыл бұрын
Thank you very much for your initiative. The only sensible code that I found after a long time of searching. But in the beginning there was a problem: the program did not always work. In the end, the whole problem was in SPI1. After connecting the microsd module to SPI2, the program always worked. I'm using stm32f4discovery (stm32f407vg microcontroller).
@user-mn6us8xl5x
4 жыл бұрын
By the way, I connected the sandisk 16gb fat32 memory card and the program worked.
@erdinckaya3731
2 жыл бұрын
@@user-mn6us8xl5x I'm using the same item.I didnt get it worked. Could you tell me what was the error ? Are you also sure that it's all about SPI1 ? Thanks in advance..
@lauchokyip
4 жыл бұрын
Great Video! Some boards set SPI to 4 bits ( hspi1.Init.DataSize = SPI_DATASIZE_8=4BIT). I changed it to ( hspi1.Init.DataSize = SPI_DATASIZE_8=8BIT). Btw I am using STM32F0Discovery Kit
@saikrishnakaruturi2958
9 ай бұрын
Hey are you able to read the file on the SD card using the STM32f0 series board?
@ShawnHymel
4 жыл бұрын
Thank you so much for posting this video! I was able to get it working with an SD card formatted with a block size (allocation unit size) of 512 bytes. How do you get it to work with other block sizes (for example, I'm trying to use a block size of 4096 bytes)? Is that possible?
@ControllersTech
4 жыл бұрын
Change the max sector size to 4096 in the fatfs setup.
@ShawnHymel
4 жыл бұрын
@@ControllersTech Thank you. I can get it to work with cards up to 8 GB, but over that, they don't work. Is there something special I need to do with >8GB cards (other than format them with FAT32 and 4kB block sizes)?
@ShawnHymel
4 жыл бұрын
I was able to get it working by upgrading to the newest version of the library: github.com/eziya/STM32_SPI_SDCARD.
@self-studyelectronicengine7294
3 жыл бұрын
Thanks for this Code please keep going and make video like this video
@normanwiedemeyer3338
2 жыл бұрын
Thank you very much, worked like a charm!
@MrEdwardhartmann
3 жыл бұрын
Nice video - I am planning a project to take sound files (.wav) from a SD card and output to I2s on a STM32F411 and I have never used Cube to program. This looks like a great starting point - thanks for all the work.
@ControllersTech
3 жыл бұрын
Better watch the wave player video. That's exactly what's done in that.
@MrEdwardhartmann
3 жыл бұрын
@@ControllersTech thanks - I will
@mukulsharma-no4uf
Жыл бұрын
Hello @ControllersTech I'm using the same MCU and same IDE as in your video, but my code gets stuck at HardFault_Handler(void) when i try to open a file. how to solve it?
@GabiMartin97
2 жыл бұрын
Working flawlessly. thanks
@fifa7150
4 жыл бұрын
Great video! It was very helpful to me I am very thankful :)
@theraja011
5 жыл бұрын
Thanks, Can you pls share any example regarding GSM communication with USART(with CTS/RTS).
@suleyman9847
Жыл бұрын
Thats a very useful video thnk you so much
@user-iy1nl6ke8r
19 күн бұрын
Anyone, please helpme. Why f_puts don't work?
@batcircuit4742
5 ай бұрын
I am getting "Hard error occurred in the low level disk I/O layer" Error while trying to get the card size, but the card size is displayed 0, what should I do?
@davidpelyva311
5 жыл бұрын
Thanks for the video. I tried to do everything according to your video, but it doesn't work. I'm working with the same SD-card module as you, but with an STM32L432KC. The first problem is that I don't have fsize parameter in FIL typedef. And the second is that it always says that the card is mounted successfully, even if there is NO CARD in the reader. What is more, I get Disk_error if I try to write or read a file on the card. Could you please help me?
@lauchokyip
4 жыл бұрын
Try writing this DSTATUS my_status = SD_disk_initialize(0); if(my_status == STA_NOINIT ){ send_uart ("error in initializing SD CARD... "); } if (my_status == STA_NODISK){ send_uart ("No medium in the drive... "); } if (my_status == STA_PROTECT){ send_uart (" Write protected... "); } This will help to know if your disk initialization fails. Remember to #include "fatfs_sd.h"
@ucNguyen-wu2xh
4 жыл бұрын
I have Same problem. Did you solve it ?
@fifa7150
4 жыл бұрын
@@ucNguyen-wu2xh I am using the STM32L4KC too. I used the same files that he used in the video, but I changed the HAL library with this #include "stm32l4xx_hal.h" in the fatfs file, and it worked.
@marc0711
3 жыл бұрын
Instead of the 'fsize' parameter you can use the 'f_tell' function.
@sureshp632
4 жыл бұрын
thank you sir can you guide how the usb interfacing
@MounikaGuntha
5 ай бұрын
Excellent sir,where i can find block diagram for this project??
@desaoaraujo
Жыл бұрын
Thanks for the video!! Worked here in my STM32L152 Disco board, with minor adjustments. I was able to create files, write and read. However, a few weird outcomes: total and free sizes result with a dot before the number (numbers seem correct); also, the current version of FIL struct in ff.h doesn't seem to have the .fsize field, so I haven't found a way to read the correct amount of bytes yet. Thanks again!
@willychen5444
3 жыл бұрын
Thanks, it's help me a lot!
@sureshp632
5 жыл бұрын
thank you sir once again.
@encryptedchannel213
2 жыл бұрын
ERROR!!! in mounting SD CARD... how get I solve this problem
@alexandertoro8723
5 жыл бұрын
Excellent tutorial.
@ganeshgaikwad2158
5 жыл бұрын
Thank you sir.. for this amazing tutorial. Can you please guide for this with Compact flash card with stm32f3..
@fifa7150
4 жыл бұрын
It's the same for other STM, I use the stm32l432kc and it works fine. For doing so, you have to change the name to the library according with your microcontroller in the fatfs file. For example: #include "stm32l4xx_hal.h" I included this in my case in yours: #include "stm32f3xx_hal.h" I think
@tomashort675
4 жыл бұрын
@@fifa7150 could you share your code for this type stm please?
@utsavsuha
Жыл бұрын
Hello, Everything working well. But i need to log 10 bytes of the data after every 5 milli seconds and this should be done for 24 hours, The SPI hangs (remains in busy and locked state)after some times and i can only write for few mins of data. Please suggest
@marcinorszulak7780
3 жыл бұрын
Hi, Is there anything else to do, except replacing libraries with old one, to avoid getting FR_NO_FILESYSTEM? Iam using F303RE board
@anhtuta2767
2 жыл бұрын
thank you so much
@El_Alawy
Жыл бұрын
hello, I followed all the steps but every time I find the sd-card empty. I tried to find what is the reason for that by making leds light at every operation of the SD_card function and found that the function enters the first if condition which mean (No SD Card found) and break.
@sureshp632
5 жыл бұрын
Thanking you sincerely regarding our tutorial. can you please guide Can TRANSCEIVER MCP 2551 WITH STM32F4
@rubens5563
5 жыл бұрын
Thank you for sharing your work. I would like to know if the fatfs library is compatible with Keil
@ControllersTech
5 жыл бұрын
Yes it should be compatible with all the IDEs
@nterminator8347
3 жыл бұрын
Hello! Thanks you for the video! My controller is F103C8. How can i get throw away trouble with an error of mounts the SD card while microcontroller initialized? I had my spi speed set to about 2.5MB. I'm was formatted my sd card to fat32 file system, block size 512. p.s. miso mosi connected cross to cross. p.p.s I'm use external +5 volt supply for sd card module. Maybe I'm doing something wrong?
@ControllersTech
3 жыл бұрын
debug and check the output of fresult.. and read the description
@nterminator8347
3 жыл бұрын
@@ControllersTech Hi. Tnx for the answer. fresult returns fr_not_ready, when 3rd argument is 1. If I use 0 its sayed its fr ok, but after when try to read or write the code its return fr disk error
@nterminator8347
3 жыл бұрын
I'm use 5 volts...
@erdinckaya3731
2 жыл бұрын
@@nterminator8347 I also need the answer of this question. I'm taking the same error and i also get fr_invalid_object error. How can i do more debugs without getting into low layer @Controllers Tech
@erdinckaya3731
2 жыл бұрын
@@ControllersTech waiting for you response below.. Thanks in advance..
@alexandrev.3332
2 жыл бұрын
I am using a SanDisk 2GB microSD. Could be this problem? I tryed to format inf FAT and FAT32 and used and nothing is write
@alexandrev.3332
2 жыл бұрын
The video is very good, i know that the problem is with me, but i can identify the error. I used your whole code download and nothing
@ubotics27
5 жыл бұрын
Very well explained! May I ask , how can you write data to the next line in the text file ? I have been trying to write Buffer data vertically in the TXT file but they all go horizontal. I will really appreciate your help .thanks
@ControllersTech
5 жыл бұрын
Use the ' ' at the end of the string. That way, next string will be written in the next line
@frasitdar1712
5 жыл бұрын
From where do i copy the library files fatfs_sd.c and .h files into the folders of project.
@ControllersTech
5 жыл бұрын
Just download the code. They are in the inc and sec folders
@alexandrev.3332
2 жыл бұрын
I tryed to invert the wires MOSI and MISO and nothing, i tryed to put external 5V to the SD card board and nothing, all the same error
@purposeoflife47
3 жыл бұрын
i m using this method and one of my sd card is working fine but other is not working. But both sd cards are working fine in laptop. I dont know what is wrong.
@dtonn
2 жыл бұрын
Valeu!
@kalaiarasi8931
7 ай бұрын
Hi..The tutorial is really awesome.Asper the instruction i have implmented the code but i am gettingg DISK_Error fom return staement of FRESULT?How to troublehoot the prooblem.kinldy explain
@taamallahmedtahe7369
2 жыл бұрын
Good morning i have a little project that i have to do but do you think that we can transfer files between two stm32 with spi ( files like .txt) thank youu
@david-kr1zw
5 жыл бұрын
Thank for going to the effort of publishing this. I’ve been wanting to get this working for a while so this video is going to be really useful. So far I’ve only “skim” watched it, and I’ve also looked at your website, but in both cases and for the life of me I can’t see where your fatfs_sd.c and fatfs_sd.h files are coming from. i.e. you say copy them into the project, buy where are you copying them from ? Apologies if it’s obvious, and thanks again.
@ControllersTech
5 жыл бұрын
Download the code. Those files are present in src folder and inc folder
@user-mn6us8xl5x
4 жыл бұрын
Hello! Tell me, please, how can I assign a file name to some buffer?
@sumeetgaikwad5702
11 ай бұрын
hello sir , i want to interface sd card in spi mode with adi sc 594 mcu , do u have any link for other mcu then stm32
@goodwill7643
3 жыл бұрын
Thank you
@AnglasMechatronics
4 жыл бұрын
Great very good information, would you recommend some books from where you are learning all that, please I would appreciate it very much.
@ControllersTech
4 жыл бұрын
Don't know man.. I generally use the sensor datasheet itself. And rest is the research..
@jotham123
3 жыл бұрын
there's a book called Mastering STM32 - very useful.
@stefanputureanu9296
4 жыл бұрын
I had made some changes, there are some variables types that are not right. I run this project at 18MBits/s with no errors. I used keil uVision. // "sprintf" needs an "unsigned long" input. Note that despite the fact that int and long are represented by the same number of bits, they are still different types.
@electronicswitches6010
3 жыл бұрын
I am trying to create the file but file is not able to get created
@klaus9503
3 жыл бұрын
Is there a way to send data with DMA ?
@windsmall9822
3 жыл бұрын
Thanks
@alonsorodriguez6042
4 жыл бұрын
Hello, I have a question. I'm using FreeRtos and Timer 1 as the source, so there is no SysTick_Handler fuction in stm32f1xx_it.c. Where would I put the FatFsCnt check in this situation?
@ControllersTech
4 жыл бұрын
Inside the timer 1 isr..
@trigonokalanto3217
8 ай бұрын
hello , first of all thanks for this tutorial. I tried this project with stm32f446re and it works pretty well. But i need to save a value every 10us at specific .txt file. For this reason i open , write and close the .txt file into an tim_irq_handler. It seems that the proccess of saving the data takes longer than expected. Do you have recommended changes in the above code to enhance performance? Thank you !
@danpommerening3490
3 жыл бұрын
Ok I built this for STM32F411CEU WEACT board. using Chan's FatFs R0.12c Everthing works good except the "file.size" reference. This has been replaced in ChaN's FatFs R0.12c version with f_size(&fil).
@themest4833
21 күн бұрын
help me, I don't find a fsize, where is it?
@ziyaonal4772
3 жыл бұрын
Can we use sdhc cards with this project?
@sarathkumar-tf4lr
4 жыл бұрын
@controllerstech am using stm32l476rg micro controller when interfacing with micro sdcard adapter am using your program to control it as per your procedure to settings in cubemx....but i get the "ERROR!!! IN mounting sd card" what mistake maybe occurred in my side...please give the solution
@ControllersTech
4 жыл бұрын
You are getting error in mount itself. There isn't much i can do here.. It Could be anything.. Check your connection Sd card is in FAT format ? Check the SPI speed, it should be around 2Mb/s Check the connection again.. there could be a loose wire.
@sarathkumar-tf4lr
4 жыл бұрын
@@ControllersTech my SD CARD is in FAT32(default) type.....how can i change into FAT type .....
@sarathkumar-tf4lr
4 жыл бұрын
@@ControllersTech when am debugging this code "fresult" return a FR_DISK_ERROR givs....what is the problem may happen...please give the solution....
@ControllersTech
4 жыл бұрын
Wait for few hrs. I am updating the code. It might work after that. Check after 4 hrs
@ControllersTech
4 жыл бұрын
Code updated... check the description
@aaronrenny7246
3 жыл бұрын
Very informative video. Can i use the same code for interfacing in Keil software.? Please help.
@ControllersTech
3 жыл бұрын
Yes
@BogdyMihy
4 жыл бұрын
Hello! Thanks for the video, it seemed to me quite clear and concise! I have a problem however. After doing the f_open command I get a FR_NOT_READY from the fresult. I have followed all the indications in the video. The only thing that I don't understand is the clock. I have an STM32WB and as I am new to this I have no clue how to set it, so I basically just let it do it's thing. Do you have any idea why I might get that error?
@ControllersTech
4 жыл бұрын
Some connection problem. Make sure the card is formatted with FAT or FAT32 Also try to reduce the SPI speed and see if it can help
@BogdyMihy
4 жыл бұрын
@@ControllersTech Hey! I've just done it and there is no change. I get the same error. (I have a 16Gb card) I want to ask you though, why do you set for your clock the two options "HSE" and "PLLCLK" together? If I do this for my microcontroller I instantly get some 0xfffff8 error or something about "Failed to execute MI command". Also when you wrote this: fresult = f_mount(&fs, "/", 1); I saw that here you put 0 and on the website there's 1. What is this for? Thanks for answering!
@ControllersTech
4 жыл бұрын
HSE is for selecting external crystal for clock PLL is phase loop clock use in all the ARM processors. If u are having problems with the clock, i would advice you to not select the HSE and leave the clock input at HSI and use HCLK as 50 or 60 MHz. This video was made long ago, and i have modifies the code after that. That's why you might see some changes. Although the process remains same. Since it seems like you don't have much knowledge about stm32, i would say first try blinking led and start low.
@blahman442
3 жыл бұрын
I face the same issue. Did you fix it?
@saurabhkulkarni356
3 жыл бұрын
hello sir, please make video on MFRC522 RFID with stm32 f4
@Eckmuhl29
Жыл бұрын
4:05 where do have those libraries? I dont get it
@ControllersTech
Жыл бұрын
Download the code and look in the src and inc folders.
@fernandopiccoli4111
Жыл бұрын
Hey, I'm saving data on .csv format, and I can't update the file using f_lseek, cause I think it doesn't recognize the filinfo.fsize. Have any tips?
@ControllersTech
Жыл бұрын
you can also get the size using the function f_size elm-chan.org/fsw/ff/doc/size.html
@alidemir8434
Жыл бұрын
i get invalid error what to do
@alexandrev.3332
2 жыл бұрын
I commented this lines and it is working now, pay attention everybody that is anyone that is starting with this example to comment this if you want to put the sd card in your pc to see the data that was written on the sd card. I used a 16GB San Disk Ultra MICRO SD HC I and now worked. I think that cards with 2GB not work because i tested with 2 of then, maybe i should make the same thing that i did when formatted the sd card. The codes of control tech work really, but if you download the already code you have to follow the comments of the video about change MAX_SS to 4096 and USE_LFN to ENABLED WITH STATIC WORKING buffer on bss . When you format the SD CARD should make with FAT 32 and choose 4096 bytes. And slow the speed of SPI to 2.25MBps and i put external 5V power. Control tech have very good videos. I don´t like when my things not work, sorry about my declaration that i did before. Thank you very much for this video. And i am sending my contribution to this site. /*************************REMOVING FILES FROM THE DIRECTORY ****************************/ /* fresult = f_unlink("/file1.txt"); if (fresult == FR_OK) send_uart("file1.txt removed successfully... "); fresult = f_unlink("/file2.txt"); if (fresult == FR_OK) send_uart("file2.txt removed successfully... "); /* Unmount SDCARD */ /* fresult = f_mount(NULL, "/", 1); if (fresult == FR_OK) send_uart ("SD CARD UNMOUNTED successfully... "); */
@bahadrguven6268
3 жыл бұрын
Does not print the value in the variable.Printing ASCI value.Can I fixed?
@ControllersTech
3 жыл бұрын
How are u Passing the variable ?
@mohdsufian2581
4 жыл бұрын
have you tried interfacing sht31 temperature and humidity sensor? and cmcu-811 VOC sensor? it would be very helpful if you post its tutorial
@ControllersTech
4 жыл бұрын
I don't have those modules.. will buy them when things will be better...
@mohdsufian2581
4 жыл бұрын
@@ControllersTech sure.... i am sharing my email adress let's have some conversation there.... may be i can help you buying those modules... or if u are from india i can send that module to ue place mail id1: msufian@enggenv.com mail id2: mohammadsufian95@gmail.com
@mohdsufian2581
4 жыл бұрын
@@ControllersTechalso I am having some other ideas for you that can help me also... looking forward to ur response, by the way, I am an R&D engineer, in a company near capital city Delhi
@boobalan789
5 жыл бұрын
Are you Tried SDIO , sd CARD INTERFACE IN stm32f103rctxx Series?
@ControllersTech
5 жыл бұрын
I have stm32f103c8 and it does not support SDIO, so not possible there. But yes, i will soon publish a video about SDIO for those controllers, which supports it
@xRevollt
4 жыл бұрын
I am having problems with the "fatfs_sd.h" file : BYTE, DSTATUS, DRESULT, DWORD etc all all marked as "unkown type". Using Keil IDE 5
@xRevollt
4 жыл бұрын
Also using the Nucleo-STM32F446RE, if that matters
@ControllersTech
4 жыл бұрын
I will take a look at it again...
@ControllersTech
4 жыл бұрын
Looks like you haven't generated the code properly or something to do with keil..
@xRevollt
4 жыл бұрын
@@ControllersTech What do you mean by not generating the code properly? I am using CubeMX version 5.5 to generate Keil projects. I added fatfs_sd.c and .h to their folder (Src and Inc respectively), and clicked "Add Existing File to group Application/User". Is there anything else to do to properly link the drivers?
@xRevollt
4 жыл бұрын
@@ControllersTech Would it be preferable for me to use SDIO, rather than SPI, as it seems my board features a 4bit bus SDIO interface, which I've heard is 4 times as fast as SPI?
@LuisReyes-zg7mq
4 жыл бұрын
Is there a way to read last 'x' number of bytes from the card?
@ControllersTech
4 жыл бұрын
Yeah.. You can take a look at the f_lseek. Basically just move the pointer to (file size - x), and than read
@paulg.3067
4 жыл бұрын
What write speed (MB/s) to card can I expect using this method?
@ControllersTech
4 жыл бұрын
Not much. Try around 2Mb/s and than go higher..
@pierrebecam9452
3 жыл бұрын
Hello thx for this tuto ! I would like to do the same but with ide arduino ... I didn't find help in the internet, do you think it's possible to interface sd card with stm32f103c8 using spi and arduino ide ?
@ControllersTech
3 жыл бұрын
Just use the arduino code. What's the issue ?
@alexandrev.3332
2 жыл бұрын
I am getting this: ERROR!!! in mounting SD CARD... ----> I had formatted with FAT and FAT32, i used 2 micro SD cards and anyone works
@alexandrev.3332
2 жыл бұрын
I put external 5V and not worked. I changed of sd card to another one of 16GB and still not working
@ControllersTech
2 жыл бұрын
One more comment from you and i will block you. I told you, ask in those groups. There is no point in spamming on KZitem
@vivekpkd
3 жыл бұрын
Can u please share this using standard peripheral library
@ControllersTech
3 жыл бұрын
Nope..
@naveenrajy2033
4 жыл бұрын
I am trying to access SD card using MikroC for the Board-STM32F446RE...I am facing a problem on Intializing the card ...The statement Fat32_init() does not seems to be working... And there is no response from the MISO line . Can you please help on this.
@ControllersTech
4 жыл бұрын
I don't know. It could be anything... Are u initialising all the peripherals by your own or using cubemx ? Also check what error are you getting. You can do this by checking the error status.
@alexandrev.3332
2 жыл бұрын
ERROR!!! in mounting SD CARD... SD CARD Total Size: 0 SD CARD Free Space: 0 File1.txt is opened and it contains the data as shown below File2.txt created and data is written SD CARD UNMOUNTED successfully...
@fabiotrevisan6712
3 жыл бұрын
Thanks! This run fine on IAR 9.10 too
@fatimahali2878
2 жыл бұрын
How to make a file with increment filename? Can i make it with same configuration like in your video?
@ControllersTech
2 жыл бұрын
File name is a string. use something like this sprintf(namebuf, "file%d",indx++); That's it. Namebuf will have the file names like file1 file2 etc.
@dzikrurrohmani7073
2 жыл бұрын
what is the difference between "fresult = f_mount(&fs, "", 0);" and "fresult = f_mount(&fs, "/", 1);" ?
@ControllersTech
2 жыл бұрын
"0" means the card can be mounted later also. We have executed the command and now it can mount anytime. "1" means mount the card immediately. "/" Is the path of the sd card, where the mount will take place.
@dzikrurrohmani7073
2 жыл бұрын
Thankyou sir..
@dzikrurrohmani7073
2 жыл бұрын
@@ControllersTech I wanna ask again, why I can't use it inside HAL_TIM_PeriodElapsedCallback function for interrupt?
@sureshp632
4 жыл бұрын
Sir how to write sensor data to file.txt I am using buf but display zeros only f_sleek(&fil,fil.fsize) but error occur help me please
@ControllersTech
4 жыл бұрын
open it as to append data f_open(&fil, name, FA_OPEN_APPEND | FA_WRITE); and than write f_write(&fil, data, strlen (data), &bw);
@jenscrivener8132
4 жыл бұрын
Is the link to the code broken or is it just me?
@souradeepdas368
4 жыл бұрын
Plzzzzzzzzzzzzz help me. I have an tf card module and want to use it with stm32f103c8t6 in arduino (using SPI). But I cant do it. Plzzzz help me.
@ControllersTech
4 жыл бұрын
If you are planning on using f103 as an Arduino, I can't help you out. Better look in the STM32duino forum..
@aishwaryasr3913
Жыл бұрын
Thank you for the video. I'm facing problem in writing to the SD card. The file gets created but not able to write. The f_write returns FR_INT_ERR. Can you please let me know what could be the issue? Note : I am able to read the data written on the card
@user-iy1nl6ke8r
19 күн бұрын
that's same with me, how did you solve that?
@jahnvibedia826
4 жыл бұрын
I am using F401RE. I am finding problem in disk initialization. 1. Even when I am not inserting the card there is no difference. It is executing f_mount successfully. 2. The program does not enter the line ENTER_FF(fs) in ff.c for volume locking.
@ControllersTech
4 жыл бұрын
1. Yes that's the bug in the code. 2. I don't know much about it. I ported the code so that it can work with HAL library. What kind of error are u getting exactly
@jahnvibedia826
4 жыл бұрын
@@ControllersTech I am not able to fetch any values in fs FATFS pointer in ff.c. I am unable to understand why this is happening. I also tried to understand and fetch information about the libraries. But none understood to an extent to solve the problem. Also how did you port the code ? Probably that can work for me too.
@ControllersTech
4 жыл бұрын
There are few things * Some users have reported that SanDisk cards are not working. * Make sure the sd card is formatted in FAT * Use the smaller size at first. I have used a 1GB card while making this video
@jahnvibedia826
4 жыл бұрын
@@ControllersTech I am using F401RE nucleo board. Is it possible that there might be a hardware problem? I read at some places that that might be an issue.
@alexandrev.3332
2 жыл бұрын
Maybe should be a problem for another people and the contribution could be very nice. I liked this video, but i need help
@alexandrev.3332
2 жыл бұрын
Your software for me not worked. I make all the things and the total size shows zero and not write or read anything. I did all of the video and not work. I am using 2GB micro sd
@paulg.3067
3 жыл бұрын
In my project (STM32G017...) f_mount did not succeed but simply hang. Upon further debug inspection it hang/loop endlessly inside a HAL_DELAY() function (fatfs_sd.c --> void SELECT(void) --> HAL_Delay(1))... I followed the answer in this thread by overwriting the HAL_Delay function: community.st.com/s/question/0D50X00009XkXJp/hal-delay-stuck-in-infinite-loopnewbie I did not understand whats the cause of the problem but this answer worked for me. Maybe this helps someone else too.
@alexandrev.3332
2 жыл бұрын
I did in Arduino and the SD CARD kit that i have work very well. I buy one like your video, but your software don´t write or read anything of SD CARD, not work. I tryed to format in PC but nothing happens, always the same bad things.
@ControllersTech
2 жыл бұрын
You posted the comment on the website right? Just because you can't get it to work, "you think the code is very wrong" ? Sort the comments to "newest first" and see how many people got it to work.
@alexandrev.3332
2 жыл бұрын
@@ControllersTech Yes, i did all the things and not write or read, but with arduino read and write. I format with fat and then i tryed with fat32, anyone works. Why in arduino works very well. I have blue pill stm32f103c8t6 and i have this board to put the card
@alexandrev.3332
2 жыл бұрын
@@ControllersTech I copy your program and nothing happens, i did a lot of times and nothing happen or 2G micro SD card, only with Arduino, this is my question. Maybe there is something very simple that i don´t know
@ControllersTech
2 жыл бұрын
I don't know why it isn't working for you. Try using external 5V supply to the module. Don't use the bluepill's 5V. Also some particular types of sd card don't work. I don't remember which one exactly, but read the comments as some people have pointed it out.
@alexandrev.3332
2 жыл бұрын
@@ControllersTech But why this sd cards works on arduino uno?
@bahadrguven6268
3 жыл бұрын
I open a text file, type something and close it, I want to open it again and add something else without losing what I wrote first. it is not working.why?
@ControllersTech
3 жыл бұрын
You have to use the append attribute.. Or do this Open the file Use lseek to point to the end of the file Write the data
@bahadrguven6268
3 жыл бұрын
@@ControllersTech Thanks a lot
@bahadrguven6268
3 жыл бұрын
@@ControllersTech what is the the append attribute ?I dont know.Can you help me ?
@ControllersTech
3 жыл бұрын
FA_APPEND
@radosawpuchalski2251
4 жыл бұрын
I have some strange problem during compiling. There are an compile error: "#error This file is not needed in current configuration. Remove from the project." in cc932.c.
@ControllersTech
4 жыл бұрын
Maybe things have changed with new version of HAL.. i have to check it again..
@radosawpuchalski2251
4 жыл бұрын
@@ControllersTech Thank you. Let me know, if you check, please. I have tried many solutions and I don't have an idea what to do.
@ControllersTech
4 жыл бұрын
Which controller do you have
@radosawpuchalski2251
4 жыл бұрын
@@ControllersTech I have checked F746ZG, but I have F410RRB and F103RB (all Nucleo boards) too. Of course I've changed header includes in every file with it.
@tjwelsh1438
5 жыл бұрын
Adding this driver to my project overflowed my RAM by like 11kB, any idea where all this extra memory allocation is coming from? I've skimmed through fastfs_sd.c and .h and can't see anything obvious.
@ControllersTech
5 жыл бұрын
Can't say really.. which controller are u using btw ? Try not using my code. See the video and write yourself. That way you always know what u r doing and the places, where things get messed up.
@tjwelsh1438
5 жыл бұрын
@@ControllersTech Good advice, in the end it had nothing to do with your drivers. Thanks for sharing your code!
@kubalec1
4 жыл бұрын
@@tjwelsh1438 could You share the solution?
@neilwrightson5660
4 жыл бұрын
The above link for the code etc just take you to a blank white page.
@sureshp632
4 жыл бұрын
Thanks sir how to write sensor reading data specially adc in txt file
@ControllersTech
4 жыл бұрын
Will upload next
@sureshp632
4 жыл бұрын
Thank you for reply
@chelseacsl3884
4 жыл бұрын
Is it working if we do not use USART? And where do you connect those USART pins to?
@ControllersTech
4 жыл бұрын
Of course it works without uart. Uart is just to check, its like verbose in linux 😀. Pins are connected to the Tx and Rx pins..
@chelseacsl3884
4 жыл бұрын
Controllers Tech we did exactly what you did and when we step into the f_open it goes directly to res != fr_ok. Do you know why? Actually I think only the f_mount works fine.
@chelseacsl3884
4 жыл бұрын
Controllers Tech Actually f_mount is not working. It doesn’t go to else statement
@ControllersTech
4 жыл бұрын
Don't use larger storage card. Make sure the file system is FAT The card shoul not be write protected Some users reported that sandisk card doesn't work
@chelseacsl3884
4 жыл бұрын
@@ControllersTech And why sandisk doesn't work?
@baronhelmut2701
3 жыл бұрын
The wiring sketch on the thumbnail is wrong.
@supersayayin2goku
3 жыл бұрын
Hi, is it possible to store a file after or out the main function??
@ControllersTech
3 жыл бұрын
Out of the main function ? Means where ? Only the main function gets executed... You can write another function outside the main but you need to call it at some point in the main function
@supersayayin2goku
3 жыл бұрын
@@ControllersTech yeap in a external function and call it in the main thats what i mean
@ControllersTech
3 жыл бұрын
Yeah u can do that..
@supersayayin2goku
3 жыл бұрын
@@ControllersTech Its, becouse when i try my program stops
@ControllersTech
3 жыл бұрын
It doesn't stop. It might be going into hardfault because of some error u are making... Need more details of this
@arvinghahremani5116
4 жыл бұрын
Thank you very much. I use stm32f103c8t6 and 2GB SD Card. but when run this code, I get successful mounting, 0 free and used space and nothing is created on my SD Card. could you help me please?
@ControllersTech
4 жыл бұрын
Are u sure mount is not giving you error ?
@arvinghahremani5116
4 жыл бұрын
@@ControllersTech I used an external 5V power source for SD Card and it worked! thanks.
@mohammadal-dossari299
4 жыл бұрын
It seems f_write can not exceed 1023 for "btw" which is the number of bytes to write. If I try to write 1024 byte, I have FR_DISCK_ERR. Can you help me, if that is the maximum length I can write Or there is another problem to be solved. Thank you
@ControllersTech
4 жыл бұрын
Try changing the data type of btw.. i don't remember what's defined in the code.. just increase it like from uint8 to uint16
@mohammadal-dossari299
4 жыл бұрын
@@ControllersTech "btw" is "UINT". I think it accepts 1024 byte
@mohammadal-dossari299
4 жыл бұрын
the problem solved. I think it is a bug in the Fatfs_sd.c In function "SD_TxDataBlock" there is NO "return TRUE" if the token =0xFD, it will be always "return False" my solution is just adding "else" for the "If" statement and return TRUE there. Also, eclipse raise a warning there ('resp' may be used uninitialized in this function) which is make sense in case of 0xFD token.
@nuhmusaozyoldas465
4 жыл бұрын
Does the memory card model matter?
@ControllersTech
4 жыл бұрын
I am going to update this code soon. So if it doesn't work for you right now, be patient. It will be done in 1 or 2 days
Пікірлер: 315