Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDMMC SD Card Drivers #45

Merged
merged 16 commits into from
Jun 13, 2024
Merged

SDMMC SD Card Drivers #45

merged 16 commits into from
Jun 13, 2024

Conversation

lekangwang
Copy link
Contributor

@lekangwang lekangwang commented Apr 12, 2024

Description

What was completed, changed, or updated?

  • Added FATFS third party libraries
  • Enabled and configure SDMMC to 4-bit data mode
  • Update CMakeList.txt to compile FATFS files
  • Added low level drivers that calls HAL functions to interact with SD card via SDMMC board peripheral
  • Created 2 thread-safe high level functions to read/write to SD card, (file names are limited to 8.3 format)

Why was this done (if applicable)?

  • For logging purposes (i.e. crash report)

Testing

What manual tests were used to validate the code?

Tested on 16 and 32 GB card

  • Can write the same message 100 times to a file
    Screenshot 2024-04-11 at 10 01 12 PM

  • Reading the first line, data matches as expected
    Screenshot 2024-04-11 at 10 00 06 PM

  • Multithreaded write to same file is handled correctly
    Screenshot 2024-05-30 at 11 53 18 PM


What unit tests were used to validate the code?


Documentation

Milestone number and name: M2

Link to Asana task: https://app.asana.com/0/1203458353737758/1204645027312218/f

Link to Confluence documentation: https://uwarg-docs.atlassian.net/wiki/spaces/ZP/pages/2251620424/SDMMC+SD+Card


Reminders

  • Add reviewers to the PR

  • Mention the PR in the appropriate discord channel

Copy link
Member

@antholuo antholuo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes mostly look good, especially if tested working.

I'm curious to see how it plays with freertos task scheduling and if that might cause problems with data stalling or weird interrupt issues. Might be worth trying to schedule two threads and having one thread write to the SD card while the other one does busy work?

Boardfiles/nucleol552zeq/Core/Src/i2c.c Outdated Show resolved Hide resolved
Boardfiles/nucleol552zeq/Core/Src/sdmmc.c Outdated Show resolved Hide resolved
Boardfiles/nucleol552zeq/Core/Src/sdmmc.c Show resolved Hide resolved
@lekangwang lekangwang force-pushed the feature/driver/sdmmc-sd-card branch from 390ec93 to 323f6f8 Compare May 31, 2024 03:46
@lekangwang lekangwang force-pushed the feature/driver/sdmmc-sd-card branch from 323f6f8 to 19ff31d Compare May 31, 2024 03:54
Copy link
Contributor

@HardyYu HardyYu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow! Having DMA and thread guard implemented is really cool. Very impressive! This pr is kinda large and couldn't finish reviewing it today. I will leave my approvement here since this code was tested to be working. Good work!

Drivers/sd_card/src/bsp_driver_sd.c Show resolved Hide resolved
@lekangwang lekangwang merged commit e7f1d4d into main Jun 13, 2024
2 checks passed
@lekangwang lekangwang deleted the feature/driver/sdmmc-sd-card branch June 13, 2024 00:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants