SDCard-Interface-STM32
SDCard-Interface-STM32 copied to clipboard
Interfacing a microcontroller with an SD card for analyzing data from the car's sensors and CAN bus.
SDCard-Interface-STM32
An interface between the STM32 NUCLEO F446RE and a micro-SD card for storing data from sensors of the race car's dashboard. A Data Logger for UTD's Dallas Formula Racing.
Objective:
- [x] Implement SDIO communications
- [x] Interface the micro-SD card with the MCU for storage capabilities.
- [x] Provide LED light indication for card detection
- [x] Condense the program to a callable function
- [x] Store the output as a CSV file
- [ ] Improve modularity for a swappable interface
- [ ] Build a report generator with Excel and/or MatLab, or use DFR's DataAnalyzer
Technologies:
- General Purpose I/O (GPIO)
- 4-bit SDIO communication protocol
- File Handling Library by Controllers Tech (Modified)
- HAL drivers & FAT FS
Hardware and Equipment:
- STM32 Nucleo-FE446RE Micro-Controller Unit (MCU) - Equipped with the ARM Cortex M4 processor
- Adafruit's Micro-SD Card Breakout for SD SPI or SDIO*
![Adafruit's Micro-SD Card Breakout](https://cdn-learn.adafruit.com/guides/images/000/003/056/medium640/4682-04.jpg)
Pinout
- PC8 ---> DAT0
- PC9 ---> DAT1
- PC10 --> DAT2
- PC11 --> DAT3
- PC12 --> CLK
- PD2 ---> CMD
- PB6 ---> CD (Card Detection)
Expected Input
CAN Bus
- RPM
- TPS (Throttle Position Sensor)
- Fuel Open Time
- Ignition Angle
- Barometer
- Map (Manifold Absolute Pressure)
- Radiator Air Temp
- Radiator Coolant Temp
- AFR (Air Fuel Ratio)
- Oil Pressure
- Mass Air Flow Sensor
- Wheel Speed
- Battery Voltage
GPS
- Second, minute, hour, day, month, year
- Speed
- Latitude
- Longitude
- Ellipsoidal Height
- Sea Level Height
Analog-to-Digital Converter (ADC)
- Damper Sensing
- Steer Sensing
- Brake Sensing
Accelerometer & Gyroscope
- X, Y, & Z
- Roll
- Pitch
- Yaw
Note
In order to enable the GPS-based file naming, set the macro _USE_LFN
to 2. This enables the Long File Naming Convention, and must be done everytime you make changes to the .ioc file and allow code generation. _USE_LFN
can be found in FATFS > Target > ffconf.h