January 16th 2023

SD card reading and writing module can operate on SD card

SD card reading/writing module means reading and writing SD card / TF card with single chip microcomputer. SD card is a low-voltage flash memory product with two standard operation modules, MMC and SPI, respectively. For the MMC operation mode, the reading and writing speed is fast, and has many control signal lines, so the operation is complicated. For the SPI operation module, the speed is slow, and has fewer lines, so the operation is relatively simple.

DSM-SDF-100

Content

1 Overview 2 Technical Background 3 Technical Specifications 4 operation functions 5 pin definitions 6 operation commands 7 Application Areas 8 Development Kits

1.Overview

SD card reading/writing module

The SD card reading and writing module has a built-in file system and can directly read and write files. It can be used in single-chip microcomputer to realize mass capacity storage solution. With module, single-chip microcomputer can directly perform standard file system operations such as directory traversal, directory creation, directory deletion, file creation, file deletion, file modification, and card formatting, without knowing the internal storage structure of the SD card and the implementation details of the file system.

Especially, since SD cards has become more popular in our lives.with the popularity of SD cards in life, it has become a trend for embedded systems to integrate the functions of reading and writing SD cards into the system.

2.Technical Background

With the development of technology, it has become a common requirement for devices to use SD cards as storage devices. Due to limitation in resources, normally, traditional single-chip microcomputers cannot provide file system, thus cannot read and write files in the SD card. Using this module, the single-chip microcomputer but can directly operate files in the SD card without using file system, so it can launch stable products in the shortest time, avoid research and development risks to the greatest extent, and save research and development costs.

3.Technical Specifications

1. Support standard FAT file system, the SD card operated by the module can be directly inserted into the computer to read and write.

2. The module has a built-in Micro SD card slot, users can also expand other memory card slots by themselves. It can support various types of SD and MMC cards.

3. The module communicates with the single-chip microcomputer as a SPI slave, and the maximum speed of the SPI bus can reach 4M bps. The speed of which it reads SD card files can be up to 128K bytes/sec, and the speed of which it writes SD card files can be up to 64K bytes/sec.

4. The module supports SD card with a capacity of 2G Bytes. If the SD card capacity exceeds 2G, the card will be used as a 2G card.

5. its size is 50mm*20mm, the 2.54mm pitch universal pin header makes it easy to integrate.

4.Operation Function

1. check the total capacity and remaining space of the SD card, check other card management operations like SD card formatting.

2. Directory management operations such as create a directory, delete a directory, enter a directory, and return to the root directory.

3. File management operations such as create files, delete files, open files, and close files.

4. File reading and writing operations such as read files, write files, clear files, and modify the current position of files.

5. Other maintenance operations such as detect whether the SD card exists, notify the current time, query the module firmware version number.

These functions are sufficient for reading and writing files in the SD card, and the requirements for the single-chip microcomputer that perform these operations are not high, and all ram byte that exceeds 32K bytes can use this module to complete the reading and writing of the SD card.

5.Pin Definition

Pin number

Pin name

direction

Function description

1

RST#

input

Module reset

2

SD_DO

output

Data output of external memory card

3

SD_DET

input

Data input of external memory card

4

SD_CLK

output

Clock signal of external memory card

5

SD_DI

input

Data input of external memory card

6

SD_CS

output

Chip select signal of external memory card

7

V33

input

3.3V power

8

BZ

output

Module busy indication

9

SCS

input

Chip select signal of SPI interface

10

RXD

input

Data input of debug serial port

11

SCK

input

Clock signal of SPI interface

12

TXD

output

Data output of debug serial port

13

SDI

input

Data input of SPI interface

14

INT#

Output

Data ready indication

15

SDO

output

Data output of SPI interface

16

NC

 

Reserve

17

WAKE_UP

input

Wake

18

NC

 

Reserve

19

GND

input

Power ground

20

STA

output

Low power indication

6.Operation command

Order

Name

Explanation

CHECK_EXIST

Detect module and SD card

Test whether the communication with the SD card module is normal, and whether SD card has been inserted into the SD card module.

GET_DISK_SIZE

Check SD card capacity

Acquire information about SD card capacity and free space.

DISK_FORMAT

Format SD card

Format the SD card

GET_DIR_FIRST

Query the first directory item

Get the first directory entry in the current directory

GET_DIR_NEXT

Query next directory item

Get the next target item in the current directory

MAKE_DIR

Create directory

Create a subdirectory in the current directory

REMOVE_DIR

Delete directory

Delete a subdirectory in the current directory

ENTER_DIR

Enter directory

Enter a subdirectory in the current directory

BACK_TO_ROOT

Back to root

Go back to the root from current directory

MAKE_FILE

Create file

Create a file in the current directory

REMOVE_FILE

Delete File

Delete a file in the current directory

FILE_OPEN

Open File

Open a file in the current directory

FILE_CLOSE

Close file

Close an open file

FILE_GET_LEN

Query file length

Query the length of an open file

FILE_READ

Read file content

Read the contents of an open file (continuously read)

FILE_CLEAR

Empty file contents

Empty the contents of an open file

FILE_APPEND

Append file content

Append to the end of an open file

RENAME_DIR

Change the name of directory

Change the name of a subdirectory under the current directory

NOTICE_CUR_TIME

Update time

Update the current real time of the module

FILE_SEEK

File location

Move the current reading position of an open file

ENTER_SLEEP

Enter sleep mode

Let the module go into the power consumption state

7.Application field

· Desktop instruments, portable instruments, and electronic medical instruments (sphygmomanometer, blood glucose meter, blood lipid meter, cardiomotor, etc.)

· Sports equipment (treadmills, swing machines, etc.)

· Car dash camera

· Electronic system parameter setting (equipment for temperature control, travel control, etc.)

· CNC automation equipment (program access setting)

· Data collection

8.Development Kit

DSM-100 SD card reading and writing

DSM-100 SD card reading and writing module 51 single-chip microcomputer development boar

The development board is implemented by STC89C52, a typical microcontroller in the 8051 series, and shows how to implement large-capacity data storage on a low-profile microcontroller.

Connect the development board to the computer with a USB cable, and the computer will recognize the development board as a serial device. (If it cannot be recognized, you need to install driver)

Use the serial port debugging tool (such as HyperTerminal) on the computer, set the serial port parameters to “9600bit/s baud rate, 8 data bits, no parity, 1 stop bit”, and then you can enter the command place of the development board.

At the command place, type “help” to get help. Enter other commands to query firmware version number, query card capacity, format card, create directory, delete directory, traverse directory, create file, delete file, read file, write file, and other operations.

Provide the source code development package required for secondary development, and users can use it in their own products with a little porting.

Leave a comment

0
Back to Top
Product has been added to your cart