SD card has two optional communication protocols: SD mode and SPI mode. In order to simplify the circuit and program, SPI mode is selected. ZC09's SD is connected to STM32 through SPI1. Because STM32 has an integrated SPI controller, SPI timing can be achieved with simple configuration.
1. Configure SPI1 controller
1. First, you need to turn on the clock of SPI1 and the clock of the GPIO port where the SPI1 signal line is located. Since the SPI1 signal line is on GPIOA, use the following code to turn on the required clock. It should be noted that it is best to turn on SPI1 and GPIOA together, because I have tried to turn on the SPI1 clock first, and then turn on the GPIOA clock after a few lines of code, which caused the SD card operation to fail.
2. Configure pins 5, 6, and 7 of GPIOA as multiplexed push-pull outputs, 50MHz.
3. The enable pin of the SD card is directly connected to pin 15 of GPIOB of STM32, so I also want to configure this pin.
4. The next step is to configure the SPI1 controller. According to the SD card data sheet, configure the registers of the SPI1 controller.
5. After configuration, you can start the SPI1 controller.
2. Write other SPI drivers
1. Since the operation of SD card after power-on is in low speed mode, the operation of SD card after power-on must be less than 400kHz, so we need to write an interface that can set the SPI speed.
2. SPI read and write driver
Previous article:STM32 IAP program upgrade
Next article:STM32 SD card test, using Cubemax configuration
Recommended ReadingLatest update time:2024-11-22 20:03
- Popular Resources
- Popular amplifiers
- usb_host_device_code
- 100 Examples of Microcontroller C Language Applications (with CD-ROM, 3rd Edition) (Wang Huiliang, Wang Dongfeng, Dong Guanqiang)
- Transplantation of real-time operating system RT-ThreadSmart on STM32MP1
- Design of switching power supply with adjustable output voltage based on STM32
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- 2024 China Automotive Charging and Battery Swapping Ecosystem Conference held in Taiyuan
- State-owned enterprises team up to invest in solid-state battery giant
- The evolution of electronic and electrical architecture is accelerating
- The first! National Automotive Chip Quality Inspection Center established
- BYD releases self-developed automotive chip using 4nm process, with a running score of up to 1.15 million
- GEODNET launches GEO-PULSE, a car GPS navigation device
- Should Chinese car companies develop their own high-computing chips?
- Infineon and Siemens combine embedded automotive software platform with microcontrollers to provide the necessary functions for next-generation SDVs
- Continental launches invisible biometric sensor display to monitor passengers' vital signs
- Another technical solution for power-type plug-in hybrid: A brief discussion on Volvo T8 plug-in hybrid technology
- A company's power supply interview questions, let's see how many you know? ?
- Choosing Film or Electrolytic Capacitors for Power Conversion Circuits
- MSP430F249 digital tube display
- bq30z50/55 senc file export configuration process
- [Repost] Rules that PCB design engineers must know
- Infineon BFP540FESD internal diagram
- 【DFRobot Motor Driver】+ Trial Review
- [Mill MYB-YT507 development board trial experience] Replace Ubuntu 18 firmware
- Volume adjustment network using TDA4290
- [Fourth Batch of Shortlist] GigaDevice GD32L233 Review Activity