Это видео недоступно.
Сожалеем об этом.

SD card using SDIO in STM32 || Uart RIng buffer || 4-Bit Mode || CubeMx

Поделиться
HTML-код
  • Опубликовано: 17 авг 2024
  • Purchase the Products shown in this video from :: controllerstec...
    ________________________________________________________________________________________
    If you get FR_DISK_ERR, increase the SDIOCLK divide factor to 4 in the SDIO setup, or change between 0-4.
    The code has been updated to work with CUBEIDE also. Latest changes made on 14-May-2020
    The latest Ring buffer code can be found at github.com/con...
    To download the code as shown in this video, click
    controllerstec...
    To download the simple and more reliable code, without the weird uart stuff goto controllerstec...
    Check out more VIDEOS on SD CARD with STM32 • STM32 SD CARD
    ________________________________________________________________________________________
    ****** SUPPORT US BY DONATING*****
    paypal.me/cont...
    ******Join the Membership******
    / @controllerstech
    Join the Discord Server / discord
    Join the Telegram Group t.me/controlle...
    Follow me on Instagram / controllerstech
    For more info, visit www.controller...

Комментарии • 100

  • @YolunSonu1
    @YolunSonu1 3 года назад +3

    Masterpiece! It will help me a lot. Many thanks to you for all of your tutorials. I will remember you when I acquire my future job.

  • @sarthak761
    @sarthak761 5 лет назад +4

    i learn a lot of things from you.
    you deserve more subs and likes..

  • @Th3_Gael
    @Th3_Gael 5 лет назад +1

    This was really helpful.
    I have an STM32F407VET6 and have struggled a lot with it in many aspects

    • @ControllersTech
      @ControllersTech  5 лет назад +1

      What aspects are u talking about? I have it but mostly I don't use it, cause i get requests mostly regarding 103. But I did used it in the past and it played out pretty well.

    • @Th3_Gael
      @Th3_Gael 5 лет назад

      @@ControllersTech Thankyou very much for the reply.
      I was having troubles with using the sd card which you've covered here and and getting a 10.1" TFT touchscreen to work via the header on the board

    • @ControllersTech
      @ControllersTech  5 лет назад +1

      Yeah I am thinking of buying that TFT. Will do that in near future and cover it in some video..

    • @Th3_Gael
      @Th3_Gael 5 лет назад

      @@ControllersTech Thankyou very much, it's probably straight forward but it's lost me altogether.

    • @christianleuga-wolfgang2536
      @christianleuga-wolfgang2536 20 дней назад

      I work with the same MCU but I facing trouble with SDIO. Any proposition. Black pill borad.
      I Programme it on Stm32 mxID 1.15.1 but the card couldn't mounted

  • @officializm4171
    @officializm4171 4 года назад +2

    Thank You. You are good at this job. Keep it up man! :D

  • @jesusmanuelllaiquiflorez3124
    @jesusmanuelllaiquiflorez3124 9 месяцев назад +1

    Hello, great video! I'm curious if you've experimented with utilizing DMA for reading and writing data on an SD card.

  • @PallavAggarwal
    @PallavAggarwal 4 года назад +1

    your tutorials are great! Thank you. One suggestion I have is, please have a list of potential issues and resolution or work around in the articles as a section. That will help in a big way.

    • @ControllersTech
      @ControllersTech  4 года назад

      Yeah will try on that

    • @PallavAggarwal
      @PallavAggarwal 4 года назад

      @@ControllersTech Thanks. Could you help me with 2 things
      1. when I leave my card inserted but idle, it stops responding after 3-4 minute of idle, if I keep sending some command every minute, it works fine. Clock continues to come, I have checked on Oscilloscope.
      2. How can I implement safe card removal and insertion again?
      I tried unmount, remove card, insert card and mount, but it doesn't work..
      I am using STM32F407VE, 4bit mode.
      Thanks in advance for any suggestions or guidance!

  • @shamssalehin2376
    @shamssalehin2376 Год назад

    Hello @ControllersTech , i think last updated of ur code has some problem,
    1. cube mx setting show 4bit wide bus, in sdio.c file it shows 1bit wide bus
    2. no hal_sd_init() function call in MX_SDIO_INIT() function, there suppose to be a function call to initialize the settings.
    3. if i dont implement hal_sd_int function nothing happens at all
    4. if i use i crashes on fs_mount function from ff.c
    please update source code. im also using same board stm32f4vet6 black board still it fails.

  • @art4259
    @art4259 Год назад +2

    Nice. The video title declared 4bits mode, the same is shown in CubeMX, but in the attached sofrware arrchive is 1Bit mode: main.c, line #263 "hsd.Init.BusWide = SDIO_BUS_WIDE_1B;". Also, no init code in the MX_SDIO_SD_Init() function. This pointed me to change the initialization section of my code generated by cubeMX: hsd.Init.BusWide = SDIO_BUS_WIDE_1B; not SDIO_BUS_WIDE_4B, then call the HAL_SD_Init(&hsd) and HAL_SD_ConfigWideBusOperation(&hsd, SDIO_BUS_WIDE_4B); It seems the 4bits mode now in action. Yet, the hsd.Init.ClockDiv = 3; Very interesting!

    • @shamssalehin2376
      @shamssalehin2376 Год назад

      i have same question like, first .ioc setting and SDIO.c data dont matched, bus wide is 1B rather 4bBthat show in website and tuts and also no hal_sd_init function call inside mx_sdio_init function. is it generator problem, now a 1.12.1 cube ide version with f4 1.27.1 does the same job, no init function call. that code wont work for me. if u can do any please share with me. i have been trying for three days.

    • @art4259
      @art4259 Год назад

      ​@@shamssalehin2376 Hi! My SD_init() function runs smoothly with this:
      hsd.Instance = SDIO;
      hsd.Init.ClockEdge = SDIO_CLOCK_EDGE_RISING;
      hsd.Init.ClockBypass = SDIO_CLOCK_BYPASS_DISABLE;
      hsd.Init.ClockPowerSave = SDIO_CLOCK_POWER_SAVE_DISABLE;
      hsd.Init.BusWide = SDIO_BUS_WIDE_1B;
      hsd.Init.HardwareFlowControl = SDIO_HARDWARE_FLOW_CONTROL_DISABLE;
      hsd.Init.ClockDiv = 0;
      if (HAL_SD_Init(&hsd) != HAL_OK)
      {
      Error_Handler();
      }
      if (HAL_SD_ConfigWideBusOperation(&hsd, SDIO_BUS_WIDE_4B) != HAL_OK)
      {
      Error_Handler();
      }

  • @m.jh-db3bn
    @m.jh-db3bn 3 месяца назад

    hi. thanks a lot.
    I used your video and files. When running with 1-bit mode, I didn't have any trouble and everything was okay. However, when using the 4-bit structure, my SD card cannot mount and I receive the error code fresult=FR_NOT_READY.

  • @zynq_training2876
    @zynq_training2876 10 месяцев назад

    Hi,
    I got an error as you mentioned, but your advice alone was not enough to solve my problem.
    "If you get FR_DISK_ERR, increase the SDIOCLK divide factor to 4 in the SDIO setup, or change between 0-4."
    We select 4-bit bus and My CubeIDE version generates SDIO_Init code and it inits bus as 4B. It seems correct, but is not!!!
    I found in internet some other working codes and compare it with mine. I relalized we must do 2 things additionally:
    1- Clock divider must be >= 4. I tested it with 3, it works not. I have 168MHz main clock.
    2- SDIO_Init BusWide must be changed as 1B configuration.
    hsd.Init.BusWide = SDIO_BUS_WIDE_1B;
    (My Version: STM32Cube FW_F4 V.1.27.1 )
    Thank you for your sharing.

  • @user-oe8sz5bs5u
    @user-oe8sz5bs5u 2 месяца назад

    I'm working with Stm32f407VET6 Black Board and it's not working for me
    fresult = f_mount(&fs, "/", 1); in mount_sd () gives me FR_NOT_READY . i hope you can help me

  • @locle5227
    @locle5227 4 года назад +2

    a little mention: anyone use oder version than R0.12a (July 10, 2016) . The FA_OPEN_APPEND flag will be not available.
    Please modify Update_File:
    f_lseek(&fil,f_size(&fil));
    fresult = f_write(&fil, data, strlen (data), &bw);

  • @christianleuga-wolfgang2536
    @christianleuga-wolfgang2536 20 дней назад

    Hello everyone
    I have some issues about SDIO and STM32 IDE : 1.15.1 I USE stm32f407vet6. Since I on the Board it doesn't work.
    1. I follow the video normally
    2 I change the clock factor
    3 i plog different SD capacity
    4 I have set pull-up resistors get error
    5 I solder external resistor still go error.
    It doesn't work. I receive on terminal error sd card no mounted.
    I change the clock divider and the board send the same errors
    Any help or proposition.

  • @eliobarrueta
    @eliobarrueta 3 года назад

    Hello, i am having some troubles, i can only read the SD card, but I can't write. I get an error
    error no (1) in closing file *d.txt*
    "A hard error occurred in the low level disk I/O layer */"

  • @abdullahserdar2168
    @abdullahserdar2168 Год назад

    This video helps me a lot, thank for that. However, I have a problem with f_mount functions it always returns "FR_NOT_READY" error. How can I fix this error? Thanks...

  • @shyluj.p5115
    @shyluj.p5115 2 года назад

    Great video , i have tried the same for the STM32F446RE controller, but problem is mount_sd(); controller is not coming out from these part. can u please help me out

  • @paulg.3067
    @paulg.3067 4 года назад

    Works so far in 4bit Mode if I set SDIOCLK divide factor to at least 5! Using STM32F407VET "black-board" with an 16GB FAT32 linux fdisk partition type "W95"

  • @mahdiehasadi3928
    @mahdiehasadi3928 2 года назад

    HI! thanks for great videos. I used simple form code of "File_Handling" for saving my data on SD-card that received with USART port., but when i use this library I lost some of data.and I have no idea How File_Handling effected my received data. could you give me some advice to solve these problem?

  • @felixr.1821
    @felixr.1821 2 года назад

    Great video, but I have a question. In my case the scan_files function for some reason does not list all the files in the root of my sd card. There are 17 .txt files, but it does not list all of them, the number of listed files varies with each "ls" command. Sometimes it shows 8, sometimes 14.. but never the correct amount. Also is there an option to list the files sorted by name ?

  • @ziyaonal4772
    @ziyaonal4772 3 года назад

    Did u use SDHC or SDXC cards in this project ?

  • @chris-tal
    @chris-tal 4 года назад

    Is it neccesary to pull up the SCK line with that R33 - 10k resistor like you show at 1:57? Almost every appnote suggests directly connecting it to the MCU SDIO host interface. I'm having issues with mounting and I suspect this can be the problem. Can't even see a 400kHz initial clock. The clock line is pulled high at all times and the SDIO clock and peripheral enabled status bits stay zero. Even changing the init divider value has no effect (stays zero too). I will try removing or raising the resistance of this pull-up resistor on Monday.

    • @ControllersTech
      @ControllersTech  4 года назад

      Actually that's the schematic of my board. It have the module mounted on it.
      You should try increasing the sdio clock divide factor. The sdio clock needs to be less than 25 MHz.

    • @chris-tal
      @chris-tal 4 года назад

      @@ControllersTech I've tried increasing it, but maybe by not enough or too much. I feed a 45-48MHz clock from the PLL to the "48MHz clocks" and 36-72 to the APB1-APB2 buses. On my F429ZI if I set up the max HCLK clock, the "48MHz clocks" is only 45, so I use 72. Is the clock divide factor dividing the "48MHz clocks" directly? I guess I'll have to dust off the reference manual for the SDIO clock setup or maybe the Definitive Guide book again by Joseph Yiu. :)

    • @ControllersTech
      @ControllersTech  4 года назад +1

      In f4, sdio clock is connected to APB2 and finally it works like sdio clock = apb2 clock/(divider+2)

    • @chris-tal
      @chris-tal 4 года назад +1

      @@ControllersTech Success! Of course the problem is more electrical in it's nature. The clock signals started to appear when I was starting to use 10cm jumper wires instead of 20cm and leaving most of the breadboard out of the signal path. (Noise was like 50-100mV PP in my case.) The SDIO interface doesn't really like noise so it doesn't really comes out of reset I think. The card's limit is still at 3MHz, but it's a good starting point, before making a PCB. Everybody having this on self-made prototyping boards for the first time should start raising it up from 1MHz (48MHz SDIO peripheral CLK/48 as divider). I have seen EMI filters specifically designed for SD interfaces on the market too. Thank you for your help!

  • @embedthreads
    @embedthreads 3 года назад

    Hey, I am trying the same setup on stm32l452re but unfortunately the board is not working... any suggestions

    • @badzonor5797
      @badzonor5797 3 года назад

      Some time ago there was a problem with the operation of the SD card in "4 bits wide bus" mode, but it works fine in 1 bit mode. I am working on fixing this issue.

    • @embedthreads
      @embedthreads 3 года назад

      @@badzonor5797 plz have a look at this link and suggest me what I m doing wrong community.st.com/s/question/0D53W00000RQ1W9SAL/i-am-working-on-stm32l452-nucleo-boardim-able-to-read-but-write-operations-are-not-working

  • @eyadomar00
    @eyadomar00 3 года назад

    how to do it directly without UART?

  • @ABABA30175
    @ABABA30175 4 года назад

    Hi Controllers Tech, I have a problem about the "huart1"
    the message said that :Symbol huart1 multiply defined (by UartRingbuffer.o and main .o)
    so I take a review these two code, main.c >>line 49 and the UartRingbuffer.c>>line 13 have the same define
    "UART_HandleTypeDef huart1" ,could you give me some advice to solve these problem?
    Thank you~

    • @ControllersTech
      @ControllersTech  4 года назад +1

      When u r defining uart_handletypedef in uartringbuffer.c, use the keyword extern in front of it.

    • @ABABA30175
      @ABABA30175 4 года назад +1

      @@ControllersTech WOW, that work it, a lot of thanks~

  • @thekeydoki
    @thekeydoki 4 года назад

    wow...thank you.!!

  • @akshaymannarkkad7805
    @akshaymannarkkad7805 3 года назад

    Bro which is the suitable stlink debugger for stm32f407vet6 Dev board

    • @ControllersTech
      @ControllersTech  3 года назад

      J link is best, but if your budget is limited, buy st link

  • @fandy4760
    @fandy4760 4 года назад

    Hi, i love your tutorial about stm32 stuff. I have stm32l4 series board, i want to access my MMC module with it, i follow your tutorial, and in uartringbuffer.h i already changed it with l4 series. but i got an error message went i want to create the file, "error no 1 in creating file *file.txt*" and then i searching what the meaning of that number, in ff.h file said "A hard error occurred in the low level disk I/O layer" do you know what that message means?
    btw i didn't use uartringbuffer, i just call "create_file("file.txt");" function

    • @ControllersTech
      @ControllersTech  4 года назад +1

      in the SDIO setup, increase the SDIOCLK divide factor and test

    • @fandy4760
      @fandy4760 4 года назад

      @@ControllersTech thank you very much for your help

  • @arturoreyes2925
    @arturoreyes2925 4 года назад

    Is there a possibility to use SPI SD card adapter for this example? Thank you in advance

    • @ControllersTech
      @ControllersTech  4 года назад

      There is already a video for sd card and spi.
      If you are talking about this particular example, than yes you can use. Just use this file handling library with that video

    • @arturoreyes2925
      @arturoreyes2925 4 года назад

      @@ControllersTech I got a SD card adapter for breadboard so Im trying to get this working as you did in the video. Im using Nucleo-F466RE board, but I have a question. When selecting HSE should I use "Bypass"? I mean, my nucleo board doesnt have crystal soldered, and Ive read that I should use StLink crystal choosing bypass option when selecting clock source. Is it right?

    • @ControllersTech
      @ControllersTech  4 года назад

      Yeah you can choose bypass or the crystal itself like i did.

    • @arturoreyes2925
      @arturoreyes2925 4 года назад

      @@ControllersTech I cant get this working. I get "Error in mounting SD card" everytime. Im a little confused about wiring bc Im using SD adapter for uSD card, so I dont know if there is something missing

  • @acocrw5808
    @acocrw5808 5 лет назад

    Great jobs 👍

  • @uldara
    @uldara 4 года назад

    Hi i have problem with code example it always show
    "SD CARD mounted successfully..."
    event no SD Card
    when i send cmd ls but nothing return

    • @ControllersTech
      @ControllersTech  4 года назад

      Is the rest of the code working ?

    • @uldara
      @uldara 4 года назад

      @@ControllersTech hi now i can use some command of this
      but it stuck when I use "ls " command .
      output like this "
      SD CARD mounted successfully...
      *dir1* has been created successfully
      *dir1/test.tx* created successfully
      Dir: SPOTLI~1
      Dir: STORE-V2
      Dir:

    • @ControllersTech
      @ControllersTech  4 года назад

      I don't understand. What's the output of ls command

    • @uldara
      @uldara 4 года назад

      @@ControllersTech
      I format SD card already but it still showed like this. but it's not a problem because I can use other commands as well
      one more this can we detect SD plug and unplug? and reinit SD card without Hardware reset?
      thank for your reply

    • @ControllersTech
      @ControllersTech  4 года назад

      There might be some directories, created automatically after formatting. It's reading those ones.
      I know about the mounting and unmounting issue. I tried using other way but the card wasn't mounting than. So i let it be..
      You can check some other tutorials and try follow the mounting command. It should be same for all the codes using fatfs

  • @Zelan666
    @Zelan666 4 года назад

    Hello! i like your videos so much (especially music :)), but i cant make 4 bit SDIO work on my STM32F746ZG nucleo board....
    But i have it working in 1 bit mode, don't know what am i doing wrong...
    DMA template is disabled, SDIO clock source is PLL48CLK and SDIO divider is 2, pull ups all SDIO pins except CLK.
    f_mount returns FS_OK, f_open - FS_OK, but f_close stucks for long time and than no file is created.
    I am using STM32CubeIDE 1.0.2
    Help me please...

    • @ControllersTech
      @ControllersTech  4 года назад +1

      Can u try to read error in the debugger. If the error is disk_error or something ?
      If u do, goto sdio settings in cubemx and at the end, you will find SDIOCLK clock dividing factor.
      Increase it and than test.

    • @ryanfeist1379
      @ryanfeist1379 4 года назад

      @@ControllersTech Increasing clock dividing factor helped resolve my Disk_error! Thank you

  • @jidnyaskamble8817
    @jidnyaskamble8817 4 года назад

    I am using STM32F446RE what changes should I do in this code ?

    • @ControllersTech
      @ControllersTech  4 года назад

      Not much. You should watch the video and follow the steps properly

    • @arturoreyes2925
      @arturoreyes2925 4 года назад

      Did you make it works with STM32F446RE?

  • @eyadomar00
    @eyadomar00 2 года назад

    How to do with bluetooth without hercules?

    • @ControllersTech
      @ControllersTech  2 года назад

      Connect to bluetooth and send those commands using some serial app 🤷

  • @locle5227
    @locle5227 4 года назад

    hi, I'm using CubeMX to make sd card application just like you, but when I mount sd card. It appears FR_DISK_ERR, although I have check the wires, It's fine. I found that many others have faced this issue which relate to CubeMX version. Do you encounter this problem and if yes, could you share how to fix ?
    I hear it work fine on CubeMX 4.21, but the later versions have started appearing issues

    • @ControllersTech
      @ControllersTech  4 года назад +1

      in the SDIO setup, increase the SDIOCLK divide factor and test

    • @locle5227
      @locle5227 4 года назад

      @@ControllersTech thank you for your reply, I set the divide factor to 6 but it the result is same.

    • @locle5227
      @locle5227 4 года назад

      ​@@ControllersTech I'm using stm32f4discovery board

    • @ControllersTech
      @ControllersTech  4 года назад +1

      I'll recheck the code and confirm if there is some issue

    • @locle5227
      @locle5227 4 года назад

      @@ControllersTech thank you very much. I'm very appreciate your help

  • @vineethmanickam9905
    @vineethmanickam9905 3 года назад

    How can I write file to sd card with STM32L073 series board

  • @strange67x
    @strange67x 3 года назад +1

    does not work at all

    • @ControllersTech
      @ControllersTech  3 года назад +1

      Hmm i guess fake video and fake comments 🤔

    • @strange67x
      @strange67x 3 года назад

      @@ControllersTech what do u mean

    • @ControllersTech
      @ControllersTech  3 года назад +2

      It's sarcasm... The video shows it's working.. there are people commented it's working...
      Anyway, You need to be more specific on what's not working. Debug your code, find the errors.. This is not some readymade product you are getting that it will either work or not.
      What MCU are u using ? what card ? what's the size? what's the SDIO prescalar ?

  • @arcoshpl
    @arcoshpl 7 месяцев назад

    Try to use this code for the STM32H7 but struggle with the UartRingbuffer as it is written for the F4...

    • @ControllersTech
      @ControllersTech  7 месяцев назад

      Don't use the ring buffer than. That is used to control the card from uart. You can simply use the rest of the code.