Computer help. Overview of MMC and SD memory cards, as well as a Pretec card reader What is an sd mmc connector

MultiMediaCard, officially abbreviated MMC, is a memory card standard used for solid-state storage. Introduced in 1997 by SanDisk and Siemens AG, GCIs are based on a low pin count serial interface surface contact using a single block memory substrate stack node, and are therefore much smaller than previous systems based on high pin-count parallel interfaces. using traditional surface-mount assemblies such as CompactFlash. Both products were originally introduced using SanDisk NOR based flash technology. MMC about postage stamp size: 24mm×32mm×1.4mm. MMC originally used a 1-bit serial interface but newer versions of the specification allow 4 or 8 bits to be transmitted at a time. MMC can be used in many devices that can use Secure Digital (SD) cards.

Typically, the MMC functions as a storage medium for a portable device, in a form that can be easily removed for access to a computer. For example, a digital camera will use MMC to store image files. Through an MMC reader (usually a small box that connects via USB or some other serial connection, although some may be found integrated into the computer itself), the user can transfer pictures taken with the digital camera to his or her computer . Modern computers Like laptops and desktops, often have SD slots that can optionally read MMC if the operating system drivers can.

KMMs are available in sizes up to 512GB. They are used in almost all environments in which memory cards are used, like cell phones, digital audio players, digital cameras, and PDAs. Since the introduction of SD cards, several companies have been building MMC slots into their devices (with the exception of some mobile devices, such as the Nokia 9300, a communicator in 2004, where the smaller size of the MMC is an advantage), but a slightly thinner, pin-compatible MMC can be used practically any device that can use an SD card if the software/firmware on the device is capable.

While some companies are building MMC slots into the device as of 2018 (SD cards are more common), embedded MMC (EMMC) is still widely used in consumer electronics as the primary means of integrated storage in portable devices. It provides a low-cost flash memory system with an integrated controller that can reside inside an Android or Windows phone or in low-cost PCs and can appear on the host as a boot device, instead of a more expensive form of solid-state storage, such as a traditional solid state drive.

open standard

The best of the four types of MMC cards (clockwise from left to right): MMC, RS-MMC, MMCplus, MMCmobile, metal expander

Below are four cards.

This technology is a standard available to any company wishing to develop products based on it. There are no royalties charged for devices that accept MMC. Membership in the MMC Association must be purchased in order to produce the cards themselves.

As of July 2009, specification version 4.4 (dated March 2009) can be requested from the MMCA, and upon registration by the MMCA, can be downloaded free of charge. Older versions of the standard, as well as some additional enhancements to the standard, such as MiCard and SecureMMC, must be purchased separately.

A very detailed version is available online which contains the necessary information to write an MMC driver.

As of September 23, 2008, the MMCA group has already turned over all the specifications of the JEDEC organization including embedded MMC (electronic MMC) and miCARD assets. JEDEC is a standards organization for the solid state industry.

As of February 2015, the latest version of the 5.1 specification can be requested from JEDEC, and upon registration by JEDEC, can be downloaded free of charge. Older versions of the standard, as well as some additional enhancements to the standard, such as MiCard and SecureMMC, must be purchased separately.

Options

RS-MMC

In 2004 reduced size MultiMediaCard (RS-MMC) was introduced as a smaller form factor MMC, about half the size: 24 mm × 18 mm × 1.4 mm. RS-MMC uses a simple mechanical adapter to extend the card so it can be used in any MMC (or SD) slot. RS-MMS are currently available in sizes up to 2 GB.

The modern continuation of RS-MMC is commonly known as minidrive (MD-MMC). A minidrive is usually a microSD card adapter in an RS-MMC form factor. This allows the user to take advantage of the wider range of modern MMCA available to exceed the historic 2 GB limit of older chip technology.

Version 4.x of the full-sized and reduced-sized cards can be sold as MMC Plus and MMCmobile respectively.

Version 4.x of the card is fully backwards compatible with existing readers, but requires updated hardware/ software to use their new features; even though the four-bit wide bus and high-speed modes of operation are deliberately electrically compatible with SD, the initialization protocol is different, so firmware/software updates must use these features in an SD reader.

MMCmicro

MMCmicro MMC micro size version. With dimensions of 14mm×12mm×1.1mm, even smaller and thinner than RS-MMC. Like MMCmobile, MMCmicro allows dual voltage, is backwards compatible with MMC, and can be used in full size MMC and SD slots with a mechanical adapter. MMCmicro cards have high speed and four-bit bus features of the 4.x specification, but not an eight-bit bus, due to the lack of extra pins.

She was previously known as S-card when introduced by Samsung on December 13, 2004. It was later adapted and introduced in 2005 by the MultiMediaCard Association (MMCA) as the third form factor memory card in MultiMediaCard family.

MMCmicro looks very similar to MicroSD, but the two formats are not physically compatible and have incompatible pinouts.

micard

micard is a backward compatible extension of the MMC standard with a theoretical maximum size of 2048 GB (2 TB) announced on June 2, 2007 the card consists of two detachable parts, the same as microSD cards with SD adapter. The small memory card fits directly into the USB port and also has MMC-compatible electrical contacts, which with the included electromechanical adapter fits into traditional MMC and SD card readers. To date, only one manufacturer (Pretec) has released cards in this format.

Taiwan's development, at the time of the announcement of twelve Taiwanese companies (including ADATA Technology, Asustek, BenQ, Carry Computer Eng. Co., C-One Technology, DBTEL, Power Digital Card Co. and RiCHIP), he signed a contract to manufacture new card memory. However, as of June 2011 none of the listed companies has issued any such cards, and no further announcements have been made about the format's plans.

The card was announced to be available starting in the third quarter of 2007. It was supposed to save 12 Taiwanese companies that planned to manufacture the product and related hardware up to US$40 million in license fees, which presumably would otherwise be paid to owners of competing flash memory formats. The original card was supposed to have a capacity of 8 GB, while the standard would have allowed sizes up to 2048 GB. It was claimed to have a data transfer rate of 480 Mbps (60 MB/s), with plans to increase the bandwidth over time.

SecureMMC

An additional, optional, part of the MMC 4.x specification is a DRM mechanism designed to allow MMC to compete with SD or Memory Stick in this area. Very little information is known about how SecureMMC works or how its DRM characteristics compare to its competitors.

EMMC

The EMMC (embedded MMC) architecture puts an MMC (flash memory plus controller) component in a small ball-packet grid array (BGA) IC for use in printed circuit boards as an embedded non-volatile memory system. EMMC exists in 100, 153, 169 ball packs and is based on an 8-bit parallel interface. This differs markedly from other versions of MMC as it is not a user-removable card, but rather a permanent attachment to a circuit board. In the event of an issue arising from any memory or controller, the entire PCB (Printed Circuit Board) will need to be replaced.

EMMC does not support the SPI bus protocol.

Almost all mobile phones and tablets used this form of flash for primary storage until 2016, in 2016 UFS began to take control of the market. The latest version of the EMMC standard (JESD84-B51) by JEDEC is version 5.1 released in February 2015 with the speed of competing discrete SATA-on solid state drives (400 MB/s).

other

Seagate, Hitachi and others are in the process of releasing SFF hard drives with an interface called CE-ATA. This interface is electrically and physically compatible with the MMC specification. However, the command structure has been extended to allow the host controller to issue ATA commands to control the hard drive.

Table

Type of MMC RS-MMC MMC Plus MMCmobile SecureMMC SDIO SD miniSD microSD
SD connector compatible Yes filler Yes filler Yes Yes Yes adapter adapter
pins 7 7 13 13 7 9 9 11 8
width 24 mm 24 mm 24 mm 24 mm 24 mm 24 mm 24 mm 20 mm 11 mm
length 32 mm 18 mm 32 mm 18 mm 32 mm 32mm+ 32 mm 21.5mm 15 mm
thickness 1.4 mm 1.4 mm 1.4 mm 1.4 mm 1.4 mm 2.1 mm 2.1 mm (maximum)
1.4 mm (rare)
1.4 mm 1 mm
1-bit SPI bus mode Optional Optional Optional Optional Yes Yes Yes Yes Yes
SPI Max bus frequency 20 MHz 20 MHz 52 MHz 52 MHz 20 MHz 50 MHz 25 MHz 50 MHz 50 MHz
Mode 1-bit MMC/SD bus Yes Yes Yes Yes Yes Yes Yes Yes Yes
Mode 4-bit bus MMC / SD No No Yes Yes No Optional Yes Yes Yes
8-bit MMC bus mode No No Yes Yes No No No No No
DDR mode No No Yes Yes unknown unknown unknown unknown unknown
Max MMC / SD bus frequency 20 MHz 20 MHz 52 MHz 52 MHz 20 MHz? 50 MHz 208 MHz 208 MHz 208 MHz
Max MMC/SD transfer rate 20 Mbps 20 Mbps 832 Mbps 832 Mbps 20 Mbps? 200 Mbps 832 Mbps 832 Mbps 832 Mbps
Interrupts No No No No No Optional No No No
DRM support No No No No Yes N/A Yes Yes Yes
encrypt user No No No No Yes No No No No
Simplified specification. Yes Yes No No unknown Yes Yes No No
Membership cost JEDEC: US$4,400/year, optional SD Card Association: US$2000/year, general; US $4,500 / year, executive
Various cards memories are typical representatives of external flash drives. Today, many of the devices we use, such as cell phones, cameras, media and MP3 players, and others use memory cards as storage media.
We believe that it would not be superfluous to know the features that different types of memory cards have, each of which is designed for a specific device.

What's inside these cards...

Flash memory is a type of data storage, the main purpose of which is to increase the functionality of modern mobile devices. This allows manufacturers to lead the market and produce equipment demanded by users. A huge plus of memory cards is the absence of additional power requirements, they are content with what is already available in the device where they are used. The punishment of memory is easily filled with information and just as easily released from it. There are no mechanical moving parts in it, so it requires a minimum of power and its life is practically unlimited. Memory cards allow you to rewrite information from tens of thousands of cycles to a million.

The period of data storage on these devices is quite long and ranges from 20 to 100 years. Another plus is the low sensitivity to external influences, vibrations and shocks.

But one of the most important advantages of memory cards is their compactness. With a thickness of three millimeters or less, the card has a maximum length of only four centimeters.

Variety of varieties

In the documentation for your device, there is always a description or abbreviation for the type of memory cards that this device can use. Having decided on the type of card, select the manufacturer, focusing on the most famous and already established manufacturers. Some of them have memory cards equipped with various adapters that significantly increase functionality and allow using the memory card in other devices.

To date, there are seven main types of memory cards.
compact flash, otherwise CF, consisting of two types - CF type I and CF type II. These types of memory cards are the most common because of their features, which sharply distinguish them from other types of compact storage media. Having a high data exchange rate and providing a fairly high amount of memory, these cards have, in the aggregate, a very low price in terms of megabytes / ruble, which is very attractive both for those who produce mobile devices and for those who use them. According to all available data, this is currently the most common type of memory card.

IBM Microdrive- another type of memory card, for which it does not quite fit this definition, format Compact Flash type II due to the fact that it is practically a reduced copy of the hard drive. Having a cost much lower than other types of memory cards, but is a less reliable device due to moving parts. Another negative feature of this card is the higher power consumption. Therefore, rare manufacturers use this variety in their products, the connectors of which correspond to CF type II.


smart media- is also a representative of inexpensive and compact flash cards (only one millimeter thick). The low cost of these cards is determined primarily by the use of available components, but this, in turn, is also a disadvantage, since the use of inexpensive components can lead to abnormal cases and may cause loss of information.


Multimedia Card (MMC)- This is, perhaps, one of the best representatives of memory cards of this class, the main advantages of this type of memory cards are small size and low power consumption. True, all this affects the speed of information exchange. The dimensions of these cards are 24x32x1.4 mm, and the short one 24x18x1.4 mm. They are mainly used in cell phones and other devices that have a very compact size.

SecureDigital (SD)- With their dimensions, these memory cards are slightly inferior to MMC, but they are more preferable from the point of view of the speed of information exchange when working with large data sizes. This feature dictates higher prices for them.

microSD- practically in terms of its characteristics it is not inferior to SD, while having smaller dimensions. Almost all memory cards of this type come with adapters to SD /

SD and MMC backwards compatible, so MMC memory cards can be installed and used instead of SD, but alas, reverse actions are not possible. Moreover, in latest versions manufactured by manufacturers of devices (phones, players) put only an SD connector to introduce the universality of the card (it is even indicated in the documentation as an SD / MMC connector).


memory stick- made specifically and is used almost exclusively in devices manufactured by Sony. The dimensions of this memory card are 24 * 32 / 1.4 (2.1) mm. The card is very protected from outside interference, and in terms of its performance it is very similar to a memory card - SecureDigital (SD). However, its weak point is the small amount of stored information.

According to the latest statistics, at present the most common, generally accepted and used are memory cards of types compact flash and SD/MMC.

For the convenience of assessing the appearance and dimensions various types maps, let's show them clearly:


1 = MMC Plus (Multimedia Card)
2 = SD Mini (Secure Digital)
3 = SD Micro (Secure Digital)
4 = MMC Mobil (Multimedia Card)
5 = MS Pro (Memory Stick Pro)
6 = MS Pro Duo (Memory Stick Pro Duo)
7 = RS MMC (Multimedia Card)
8 = SM (Smart Media)
9 = CF (Compact Flash)
10 = SD (Secure Digital)

So what to choose?...

As a rule, this task is one of the easiest, you just need to know what type of memory cards can be used in the device you purchased. You can easily learn this from the documentation for your device or from the inscriptions on the case. The only thing you can personally do is to choose the manufacturer based on your preferences.

What volume...?

In general, the question is trivial. You can count by the number of photos, time of music or video, but as a rule, no matter what you choose, it always becomes small.

The most important thing is to decide how much you are willing to spend on it, for most, the choice is reduced several times at once. After all, with a large amount of stored information, high speed of its exchange, minimum dimensions, the price may be too high for you to be able to afford it. So just choose the largest amount you can afford.


Introduction One of the observed trends among memory cards, in addition to the self-evident increase in their performance, is their further miniaturization, in the light of which the prospects for the most popular CompactFlash media until recently seem increasingly vague. In this article, we will try to evaluate the performance of two MMC and SD memory cards from one of the largest manufacturers of Pretec Corporation. But not only they will become the object of our attention. In such a delicate matter as finding out the real speed of memory cards, devices that read information from them always pay very significant attention to the final results. Unfortunately, we have to determine the speed of reading and writing compact media indirectly, and not directly. The "superfluous" link in the chain becomes a card reader, which has its own characteristics. It is he who, in most cases, is the reason that we are unable to achieve the performance of memory cards declared by manufacturers. For this reason, we were particularly interested in the new Pretec card reader, which we decided to compare in efficiency with the SanDisk device we used earlier. In order to get a more objective picture here, we decided to re-measure the performance of the previously tested memory card A-DATA Turbo SD, which then showed not so high results that one could count on, based on the declared characteristics.

Pretec e-Disk II USB Card Reader


This time we decided to start introducing the participants with the new e-Disk II card reader. At first glance, it may seem that you are dealing with a regular USB flash drive, so this miniature drive is similar to this category of devices in terms of appearance and sizes. However, upon closer contact, it becomes clear that this is not the case. In a "streamlined" case made of translucent blue plastic, under a hinged cover, there is a compartment for installing memory cards of two categories.

Under the removable cap, which, however, continues to hang on a thin metal chain, a USB connector is found. At the end of the chain there is an oval metal plastic with the name of the manufacturer and a miniature "carbine", thanks to which you can use the card reader as a regular keychain. Finishing the description of this memory card reader, we can also mention the presence of an LED indicator of the operating mode.

Among the technical characteristics not mentioned by us, it is necessary to note the support for the USB 2.0 interface. Naturally, this stylish card reader can be used not only for its intended purpose for reading SD and MMC memory cards, but also as a regular USB flash drive. To do this, you just need to leave one of the above-mentioned media in it. :)

Estimated retail price of the card reader is $11.

Pretec MMC Plus 1 GB


The memory card of the MMC Plus family that came to us did not have the inscription 266x on it, indicating the transfer speed, which would allow it to be completely identified with the media presented on the manufacturer's website. There is no mention of speed characteristics on the packaging either. In such a situation, our testing is of particular relevance and will help to establish the truth.
The estimated retail price of a 2 GB memory card is $150.

Pretec SD 133x 2 GB


The Secure Digital card family includes media from 256 MB to 4 MB. The declared transfer speed of 133x indicates the achievement of the milestone of 20 Mb / s. Memory cards are based on SLC NAND technology (65 nm).
Estimated retail price of a 2 GB memory card is $170.

Test Methodology

List of programs used for testing:

FC-Test version 1.0;
AIDA version 3.95.

During operation, the test platform of the following configuration was used:

Motherboard - Albatron PX865PE Pro;
Central processor - Intel Pentium 4 2.4 GHz;
Hard disk - IBM DTLA-307015 15 GB;
Graphics adapter - Radeon 7000 32 MB;
RAM - 256 MB;
Operating system - Microsoft Windows 2000 with Service Pack 4.

Media testing was performed using a SanDisk ImageMate 5-in-1 Reader/Writer and a Pretec e-Disk II Card Reader.

FC Test

During the test using the FC-Test program, the real performance characteristics of memory cards were found out, and, in this case, through their results and the efficiency of the card readers we are interested in. Using this utility, we reproduced situations associated with the use of three patterns that reflect the influence of sizes (1, 10, and 100 MB) and the number of files (1, 10, and 100) on media performance.






First, let's see how media behaves when using a pattern consisting of one hundred files of one megabyte.


The first diagram shows the results of measuring the speed of writing (creating) files. In the case of using the SanDisk card reader, Pretec's SD media is in first place, slightly ahead of its opponent in the person of the A-DATA card. We won't be making a direct comparison between different types of media, but note that Pretec's MMC Plus was way behind the other two testers in terms of write speed.
The use of Pretec's e-Disk II card reader brings a wonderful transformation to hitherto slow devices. All media show a sharp increase in write speed. This is especially evident on the example of the MMC Plus card, the performance of which is increased by almost six times, allowing it to rise to the very top of the diagram. The increase in speed is also very noticeable for the other two SD media. To a greater extent, this applies to the Pretec product.


The chart with the results of measuring the speed of reading one hundred files per megabyte, in the case of using a SanDisk card reader, suggests that both SD media show almost the same performance in this indicator, but the Pretec product is slightly ahead. The MMC memory card noticeably lags behind them in terms of reading speed.
Using a Pretec card reader to test media allows you to get more than a noticeable increase in performance for all three participants. This looks especially impressive with the MMC memory card. Her reading speed increased sixfold. A good "gain" was also obtained from SD media, which again demonstrated almost the same results with a slight advantage of the Pretec card. The read speed of both SD media has almost doubled.

Now let's move on to considering the situation associated with using a pattern consisting of ten files of ten megabytes.


In the graph of the media write speed results using the SanDisk card reader, we can see that Pretec's SD memory card is slightly ahead of A-DATA's product. The MMC carrier shows a very modest result.
In the case of using a Pretec card reader as a working device, all media again have a "second wind". The MMC memory card "transforms" the most. She has almost a sixfold increase in write speed. Pretec's SD media almost doubles its performance and is well ahead of its opponent, the A-DATA Turbo SD card.


In the next diagram, we see that reading files from media in a SanDisk card reader leads to the fact that both SD memory cards have complete equality of results. The MMC media still shows consistently slow write speeds.
The use of the new Pretec card reader for reading files once again led to a very significant increase in the performance of all three media. The SD card reading speed is equal to each other and about twice as fast as when using a SanDisk card reader. The performance of the MMC media has increased by about six times.

It's time to take a look at the performance of media, shown in the case of working with a pattern consisting of one large 100 MB file.


In the chart with the speed of writing a file to memory cards, the results obtained using a SanDisk card reader indicate that the Pretec SD media has slightly outperformed its opponent. The MMC memory card has a very slow performance.
Replacing the card reader with a Pretec device results in a noticeable increase in write speed for all media. This is especially pronounced with the MMC memory card. Its performance has increased by about six times. Among SD cards, Pretec's card reader replacement hit the hardest, with its write speed roughly doubling to outperform a similar type of media made by A-DATA.


The graph with the results obtained in the course of measuring the reading speed of devices shows that in the case of using a Sandisk card reader, there is full speed parity between SD cards and a very noticeable lag in this indicator of MMC media.
Once again, we also see the beneficial effect of the Pretec card reader on the reading speed of all three media we tested. The speed of SD memory cards has increased by about two times, and the performance of MMC media has increased by about six times.

AIDA32

The second stage of our testing is related to the measurement of media performance indicators using the AIDA32 program. During the synthetic tests, we filmed graphs of linear reading and writing, as well as access time. Corresponding diagrams were constructed based on the averages of these three parameters.

Pretec MMC Plus: SanDisk ImageMate 5-in-1



Linear Write Speed



Linear Read Speed



Average Access Time



Pretec MMC Plus: Pretec e-Disk II



Linear Write Speed



Linear Read Speed



Average Access Time



Pretec SD 133x: SanDisk ImageMate 5-in-1



Linear Write Speed



Linear Read Speed



Average Access Time



Pretec SD 133x: Pretec e-Disk II



Linear Write Speed



Linear Read Speed



Average Access Time



A-DATA Turbo SD: Pretec e-Disk II



Linear Write Speed



Linear Read Speed



Average Access Time




Let's start reviewing the results of synthetic tests with the indicators of the average linear write speed.


The diagram clearly shows that when using a SanDisk card reader, both SD cards show identical performance. The MMC media is very far behind them in terms of average linear recording speed.
Replacing the card reader with a new Pretec product results in more than a 1.5x increase in average linear write speed for both SD memory cards and about a sixfold increase for MMC media.


The graph with the results of measuring the average linear reading speed shows, in the case of using the SanDisk card reader, the results are practically equal for two SD memory cards and the MMC media is noticeably behind them.
The operation of memory cards through a Pretec card reader gives a noticeable, almost twofold, increase in the average linear reading speed of SD media, which again turned out to be almost equal in performance. The speed of the MMC card has greatly increased - in this case, more than six times.


The measured average access time for SD media using a SanDisk card reader was equal and not disappointing. It is somewhat larger for the MMC card.
It is curious that the use of the Pretec card reader in the work led to a noticeable decrease in the average access time. This is especially noticeable with the MMC card. For SD carriers, it happened to a lesser extent, but still - a trifle, but nice.

Summarizing

In general, the main purpose of this test was initially memory cards, but the results obtained during it make us first of all talk about the Pretec e-Disk II card reader. His work was a clear confirmation of the fact that for the fastest media to work effectively, you need an adequate reader and writer. Our assumptions that in the course of previous tests we were not always able to achieve the performance indicators declared by the manufacturers on memory cards, precisely due to the fault of the card reader, was clearly confirmed in this case. Pretec's miniature e-Disk II was head and shoulders above the equivalent SanDisk ImageMate 5-in-1 card reader. This had a particularly strong effect on the speed of reading and writing the MMC memory card, whose performance immediately increased by about six times, reaching 9-10 MB / s. To a somewhat lesser extent, this affected the SD carriers, where this growth reached approximately a twofold value in a number of situations. Thanks to this, they managed to achieve a read speed of 18 Mb / s, which is already quite close to the figures declared by the manufacturers. It can also be noted here that the Pretec SD 133x memory card looked slightly better than the A-DATA Turbo SD in terms of speed, due to its higher write speed.
Considering that manufacturers of flash memory media are constantly improving their characteristics, we can recommend all buyers of this product to pay close attention to card readers as well, since old models will obviously not be able to ensure efficient use of new memory cards. One of the first candidates for the acquisition is quite worthy of becoming Pretec e-Disk II. This compact device will not take up much space in your pocket and will help your memory cards work to the fullest use of their speed characteristics. In addition, this device is capable of performing the functions of a conventional USB flash drive, and it costs an amount of money that will not cause shock to buyers.

We would like to express our gratitude to NORMA GROUP for the provided memory cards and Pretec card reader for testing.

As can be seen from the figure, after the command frame is transmitted, it is necessary to continue reading bytes (Ncr) from the microSD until a response (R1) is received, while the CS level must be active "0".

Depending on the command index, the answer may be not only R1(see basic command set) on CMD58 answer R3(R1 and the terminating 32-bit OCR value), and some commands need more NCR time and they will respond R1b. This is the R1 response followed by the busy flag (the signal on the "DO" line is held low by the card while the internal process). The host controller must wait until the end of the process until "DO" goes high (i.e. wait for 0xFF). As well as R2 when requesting the state of the STATUS register.

R1 response contains 1 byte, its structure can be seen in the table below. The R2 response consists of two bytes, the first byte R1 and the second R2 (see R2 structure table). And the answer R3, respectively, of 5 bytes.


R1 response at 0x00 means successful completion of the command, otherwise the corresponding flag will be set.

The structure of the answer R1.


The structure of the answer R2.


Initialization in SPI mode.

After resetting and powering on, the card is set by default to the MMC (Serial Peripheral Interface) protocol mode, to switch to SPI mode, do the following:

  1. After reaching the 2.2 V supply, wait at least a millisecond, set the DI and CS lines high and give about 80 pulses to the CLK pin. After this procedure, the card will be ready to accept the native team.
  2. Send command CMD0 (soft reset). The card should respond (R1) with the pending bit (0x01) set.
  3. Send command CMD1 (to start card initialization). Wait for a 0x00 response to confirm the completion of the process initialization.

Let me remind you that the CMD0 command must contain the correct CRC field. It makes no sense to calculate, since there are no arguments in this command, therefore it is constant and has a value of 0x95. When the card enters SPI mode, the CRC function will be disabled and will not be checked. The CRC option can be re-enabled with the CMD59 command.

As a result, the CMD0 command will look like this: 0x40.0x00.0x00.0x00.0x00.0x95.

  • command index - 0x40.
  • argument is 0x00.0x00.0x00.0x00.
  • CRC-0x95.

As for 80 pulses, they can be generated by transmitting the value 0xFF via SPI10 times in a rowat set high levels on the lines DI and CS.

After being idle for more than 5 ms, the memory card enters a power-saving mode, and is only able to receive commands CMD0, CMD1 and CMD58. Therefore, the initialization process (CMD1) must be repeated almost every time when reading / writing a data block or checking the card status.

For SDC cards in case of command rejectionCMD1 is recommended to use the ACMD41 command.

The initialization process itself can take a relatively long time (depending on the size of the card) and can reach hundreds of milliseconds.

Reading and writing a block of data.

By default, in SPI mode, the exchange between the microcontroller and the card is carried out in blocks of 512 bytes, so to write even one byte, you will first have to read the entire block and change the byte to overwrite it back. The block size can be changed in the CSD register of the memory card.

In order to avoid an addressing error when executing read / write commands, it is necessary that the address be clearly indicated at the beginning of the sector. To do this, you can reset bit "0" 3 bytes of the sector address, i.e. make it even, and the low value should always be 0x00.

Reading a block of data.

The data block reading algorithm is as follows:

  • After confirming the initialization, we send the CMD17 command (response R1), with the address of the required sector.
  • We send 0xFF before receiving the start byte 0xFE .
  • We accept a data block (by default 512 bytes) and 2 bytes CRC.

The CRC value is not required, but the acceptance procedure (transmission of 0xFF from the MCU) is required.

Block reading.


Write a block of data.

The algorithm for writing a data block is as follows:

  • If the idle time of the card was more than 5 ms, send the CMD1 command (response R1).
  • After confirming the initialization, we send the CMD24 command (response R1), with the address of the required sector.
  • We send the start byte 0xFE .
  • We send a data block (by default 512 bytes) and 2 bytes CRC.
  • We get a write confirmation byte.
  • We are waiting for the end of the recording (changes in byte 0x00).

The data block can be smaller than 512 bytes when changing the block length with the CMD16 command.

The CRC value is not required, but the procedure for passing any values ​​is necessary.

You can programmatically not evaluate idle time, but immediately give an initialization command. During software implementation, I encountered an incorrect write, for some reason all bytes were written to the sector with a shift to the left. The problem was solved only by passing the start bit (0xFE) twice.

Block record.


Acknowledgment byte when writing a data block.


Write / read several blocks in a row.

With the help of commands cmd18, cmd25 you can read / write several blocks in a row or the so-called multi-block read / write. If the number of blocks has not been set, then the read / write process can be stopped by CMD12 commands when reading, as well as by passing the token " Stop Tran" when recording, respectively.

Practical use.

The practical use of memory cards is quite wide. In his latest design, he used microSD to record readings from various sensors (temperature, alarms) every hour during the day. The data is saved as follows:

  • The year is taken as the last two digits - this corresponds to the first (main) byte of the memory card sector address.
  • Month, two digits - this corresponds to the second, most significant byte of the memory card sector address.
  • Day, two digits are multiplied by 2 (to avoid collision outside the sector boundary) - this is the third, middle byte of the memory card sector address.
  • The lower, fourth byte, respectively, is always "0".

As a result, the search for data by date is simplified, it is enough just to translate the request to the address of the sector and read from the card. With this method, data can be stored for several years. True, there are drawbacks, there is quite a lot of unused space. Although, if desired, you can use for other tasks.

Who needs to throw off a code fragment in assembler for 18 peaks.

Questions can be asked at..



 
Articles on topic:
Everything you need to know about SD memory cards so you don't screw up when buying Connect sd
(4 ratings) If you don't have enough internal storage on your device, you can use the SD card as internal storage for your Android phone. This feature, called Adoptable Storage, allows the Android OS to format external media
How to turn the wheels in GTA Online and more in the GTA Online FAQ
Why doesn't gta online connect? It's simple, the server is temporarily off / inactive or not working. Go to another. How to disable online games in the browser. How to disable the launch of the Online Update Clinet application in the Connect manager? ... on skkoko I know when you mind
Ace of Spades in combination with other cards
The most common interpretations of the card are: the promise of a pleasant acquaintance, unexpected joy, previously unexperienced emotions and sensations, receiving a present, a visit to a married couple. Ace of hearts, the meaning of the card when characterizing a particular person you
How to build a relocation horoscope correctly Make a map by date of birth with decoding
The natal chart speaks of the innate qualities and abilities of its owner, the local chart speaks of local circumstances initiated by the place of action. They are equal in importance, because the life of many people passes away from their place of birth. Follow the local map