The computer does not see the sd, minisd, microsd memory card. Everything you need to know about SD memory cards so you don't screw up when buying Connect sd

(4 ratings)

If your device does not have enough internal memory, Can use SD card as internal storage for your android phone. This feature, called Adoptable Storage, allows the Android OS to format an external storage medium as persistent internal storage. The information on the installed SD-card is encrypted and cannot be further used on another device.

An SD Card is a very convenient option for storing photos, songs, and videos. Even if you have a large amount of internal storage on your Android smartphone, you can always need a large chunk of storage to store long videos taken with your phone's high-definition camera.

It's important to know

There is one drawback, the SD chip may lag behind when recording high-definition video.

Android by default installs applications in the internal memory and only occasionally uploads data to the SD card. Thus, you are deprived of installing any additional applications if there is a shortage of volume on your phone. internal storage, for example, in the case of budget devices on Android One.

What is storage storage?

Storage storage is the main memory of your smartphone, but if necessary, it can be expanded using an SD card.

This on Android it's called Adoptable Storage. This will allow you to use a removable microSD card installed on your Android phone as the main storage. Thus, you can easily solve the problem of how to make the SD card the main memory on Android and overcome the lack of space if the phone has a small internal volume.

Features of using the card as the main storage

There are a number of some important features that should be considered in this procedure.

Will be useful

When using a drive, be it an SD flash drive or a USB drive, it is important to remember what format this device is in and whether the Android operating system supports it, and there are four types of main file formats: FAT32 or exFAT, ext4 or f2fs.

How to change phone memory to android memory card? The question is not entirely correct, it is impossible to completely replace, you can only "increase" additional volume, as it were.

Using your SD-card as the main storage can be a great solution for music lovers and TV series lovers on the way to work or on a long trip. But, as is often the case, memory expansion always rests on the cost of the required device, because they differ both in speed and volume, as well as in the adaptable function of storing information. Here are some nuances that can be considered from different angles - both in a negative direction and in a positive one:

  • SD cards are slow. This is the painful reality of today's tiny memory chips. While they can store tons of data, they are slower than phone storage and have a limited number of read-write cycles.
  • It's important to know

    Using SD cards as permanent storage will require more frequent read/write operations, which will degrade its performance over time, and in the worst case, may lead to complete data loss. It will be especially disappointing if there are important documents or expensive photos or unique videos.

    Before swapping your phone's memory for a memory card, your Android will perform a performance test on the SD card to make sure it's fast enough to meet the specifications for use as a main storage.

  • Irrevocable integration into the operating system. Using the Adoptable Storage feature, the Android operating system encrypts the external SD card used as internal storage, so it is tied to a specific device, without the possibility of further use on another smartphone. The key used to encrypt the data on the SD card is stored in the main memory of the Android device. Thus, it is not possible to dismantle the received storage on another phone due to its encrypted nature of the data (you can remove the card, but it will not be detected on the other phone).
  • However, you can remove the external removable storage from your device and return it back to simple flash drive mode. The device will remember which are on this card in order to restore the settings when the received device is connected later. So you can also use another storage device.

    It's important to know

    Always make sure that you do not remove the default SD card during the unmount procedure, otherwise the media may be damaged.

  • Not all programs can be installed. In practice, Android can install almost all applications on the internal storage. However, this also depends on the consent of the application developer. He has the right to enable or disable the support of the accepted storage in the application by adding the appropriate attributes to the code of the downloaded program.
  • How to use SD card as internal storage on Android?

    How to replace internal phone memory with external sd card on android? Configuring your SD card to work as internal storage on Android is actually a fairly simple process. There is nothing complicated about this and you will see for yourself further.

    note

    Please note that your SD card will be formatted during the process. Do not forget to back up your data by temporarily transferring it to the main unit of the phone, desktop computer, laptop or other smart device.

    It is possible that the Adoptable Storage function is not supported by your device, even if the smartphone is running Android 6.0 or higher (this happens, it all depends on the model and brand of the smartphone). The device manufacturer may have disabled this feature. However, there are ways to use command line, which allow you to force the use of a flash drive for data storage.

    The basic formatting steps are listed below.

    • Place the SD card on the Android phone and wait for it to be detected or displayed in .
    • Now open Settings.
    • Scroll down and go to the "Storage" section.
    • Touch the name of your SD card.
    • Touch the three vertical dots in the upper right corner of the screen.
    • Click Storage Settings.
    • Select the format "as an internal option".
    • On the next screen, you have one last chance to decide for yourself if you want to change your mind.

What to do if the phone does not see the memory card? Since I often get asked this and similar questions, I answered them all at once in this article. It will be useful for owners of cameras, Samsung, Lenovo phones, laptops - in general, all those devices that support a memory card and refuse to read data on the card.

First, some technical details describing the problem. Let's say, as a result of some manipulations, a mobile device (phone, tablet, smartphone) has ceased to identify a memory card (sd card) even through a card reader. All data is written to the internal memory of the phone, bypassing the actual memory card. This is inconvenient as the sd card is not being used while the mobile device's memory is rapidly filling up. Productivity decreases accordingly.

So, the problem is described in detail, let's move on to diagnosing a phone, smartphone, tablet. Consider the most common reasons why phones do not see a memory card (flash drive) and how to fix this defect on your own using a card reader.

The phone does not see the sd card due to an incorrect file system format or a corrupted file table

Cause of the problem. 1) The file table on the sd card was damaged, the markup fell off. 2) You formatted the memory card yourself, as a result of which the phone stopped seeing the flash drive. 3) The file system of the sd card is unknown (used in another operating system)

How to fix. 1. Find out the size of your flash drive. If the microSD capacity is more than 32 Gb, most likely it is formatted in exFAT. Not all versions of Android support this file system. If you are not using Mac OS, format your memory card to NTFS or FAT.

How to do it, I show in the video:

2. A quick way to fix the problem is to restart the phone in recovery mode and in the Android service menu select the Wipe cache partition option. This command will clean the contents of the sd card and format the media in the FAT32 file system - it is best suited for storing files on the phone.

Note. We would not advise inexperienced users to perform this procedure: if you mistakenly format the wrong partition, you will lose all data on the phone, including files in the internal memory.

3. A safer (and more convenient) method to format an SD card is through a computer. You will need a card reader and SD Formatter software. It will help you format your flash drive properly.

4. You can try low-level formatting - however, not all manufacturers offer their own software for this (check the memory card website).

The memory card of the phone (tablet) is out of order

Cause of the problem. As a result of mechanical / thermal damage incompatible with life, the phone stopped seeing the memory card or the sd card stopped working. As an option, the phone stopped detecting the flash drive, on other devices the card is also unreadable.

What to do. Alas, nothing can be done with a damaged sd card. All you have to do is purchase a new SD card that is compatible in size and specifications with your smartphone or tablet. The most unpleasant moment is that all the data that was stored on the memory card of an Android or iOS phone disappears completely. You can no longer restore them - neither by connecting a phone with a USB flash drive, nor through a card reader.

If the flash drive still has a warranty and it looks like new (no visible damage), try returning it to the store. If you're lucky, you'll get a brand new replacement card.

Check for bad blocks (bad sectors) via HDDScan

The HDDScan utility (ignore the name) allows you to check memory cards, flash drives for bad sectors and read errors.

To diagnose the problem, it is enough to run the sd card through two types of tests - Read and Write tests. After spending 5 minutes of your time, you will get a conclusion: are there any bad sectors that prevent correct operation, which is why the phone does not read the USB flash drive.

  • If the flash drive was purchased recently, we change it under warranty (local or global).
  • If there is no guarantee or it has ended, we overwrite the bad sectors with zeros. This can be done through the DMDE program. This procedure will allow you to shift non-working sectors, as a result of which the flash drive will be correctly detected both on the computer and on devices where it was actively used.

Formatting with modern digital cameras

A number of Canon and Nikon camera models, according to user reviews, give a positive result - they format at a low level.

How to fix Sd card through camera:

  1. Insert the sd card into the device,
  2. In the camera menu, find the format command,
  3. Try writing files to a formatted card.

Contact technical support (for Transcend flash drives, etc.)

Their technical support specialists can advise free of charge methods for recovering problematic flash drives. In fact, who, no matter how they are, is best versed in the sd card device? In addition, technical support may offer you proprietary programs designed for low-level formatting (sometimes they are difficult to find on the manufacturer's website).

Give the memory card to specialists for recovery

This option is suitable if you are ready to pay for the work of specialists. This procedure is expensive, but the plus is obvious: you can extract data from a faulty device (though, if the memory chips were not damaged).

The memory card is incompatible with the mobile device

Cause. 1) The mobile device does not support new memory cards. 2) The memory card is too large or uses an unknown technical specification. Therefore, the phone refuses to read the data and does not recognize the flash drive as a storage device.

What to do. Carefully study the documentation for the phone and buy an SD card that will not contradict system requirements.

Wrong data transfer mode in Android

Symptom. You connect a phone with a flash drive via a usb cable, selecting the Mass Storage option, as a result, it does not appear on the computer.

How to fix. Instead of "Mass Storage", select the "MEDIA TRANSFER" option when connecting your phone to a PC. Explorer should display the contents of the memory card.

The contact of the usb flash drive has come off or the tracks in the socket have been erased

Symptom. As a result of misalignment or incorrect connection, the memory card is not connected to the mobile device, and, consequently, the phone does not see its contents.

How to fix. Remove the sd card from the phone, insert it back in such a way that the contacts of the sd card are correctly connected to the socket.

If the contacts of the sd flash drive are completely worn out, you can buy them for a couple of dollars and replace them yourself (of course, if you have the appropriate skills / minimal experience in repairing and replacing spare parts).

It is possible that the contacts (that is, the tracks on the board) on the phone have been erased, and for natural reasons, he does not see the flash drive at all. A common reason is the natural wear and tear of the phone. In this case, we recommend that you return the device for repair or replace the mobile device.

Software error, as a result of which the phone stopped seeing the memory card

Description of the problem. A certain Android program refuses to recognize the memory card. Other applications read the sd memory card and write data to the flash drive as if nothing had happened.

Solution. Android does not see the memory card, because in the application settings, the internal memory of the smartphone / tablet is specified as the save source. Go to the settings of the application with which there are problems (for example, Android Gallery or Camera) and specify the sd card as a successor - that is, the place where the files should be saved.

Instructions on how to check the sd card for errors (video):

Answers to questions from readers

After updating the phoneHTC desire 620 g dual sim) microsd is not detected, the flash card is constantly lost. It happens like this: for example, I listen to music, and then it stops playing and the phone writes: "the file could not be opened." In this case, the names of the tracks can be read. What could be the reason?

Answer . Check the audio file format. The player may not be able to read the files of the selected format. So the problem is not necessarily the problem of reading the memory card. If the file format is correct, check the memory card for errors, format it.

I inserted an sd drive into my phone (Samsung galaxy j3 2016), transferred all photos and videos to a USB flash drive, and all photos and videos in the phone gallery were deleted. The files are on sd, but all new photos are saved to the device's memory. I need it to be saved to a memory card and displayed in the gallery.

Answer. If the phone does not see the sd card, try changing the path to the successor in the application settings. It would also not hurt to check if your phone and Android system recognizes the actual memory card. Just in case, turn off your mobile device, remove the sd card and put it back. Turn on the device and check if the files are saved to the USB flash drive of the Samsung phone.

1. The phone does not see the SD memory card (flash drive). SMS came, I opened it - and suddenly I stopped seeing it. Rebooted - still does not see. The laptop sees, the other phone sees. And most importantly, the phone sees another memory card. The brand of the smartphone is Lenovo 650. Please help! Thanks in advance!!

2. Does not read the memory card. I have Windows Phone Dual Sim 535. For a while I had a memory card read, but later the phone stopped seeing it. If you rearrange it to other devices, it is read, but not in mine, but if you insert other memory cards into my phone, then everything is in order. Why does my phone not see the memory card on my mobile device?

3. I cleaned the phone's memory (fly), after that it stopped reading the sd card. The computer reads, but the sd card is not detected on the phone. And he does not see a single flash drive, I tried another card. (Probably, I deleted something superfluous). Tell me how to fix the situation and why the phone does not read the memory card.

4. Prestigio telephone. The phone stopped seeing the memory card. I just sat playing on the phone. Then I put it on for about 15-20 minutes. And when he took it, the notification "" came. I went into the settings - memory, where the external drive is. And there, instead of lines, how much memory is in total, what is the memory card on the phone, there were only two lines.

  1. Connect SD card
  2. Clear SD card

I tried to press the first one and when I pressed it, the notification "Connecting an SD card" appeared for a second on top (where the notifications are). And below this heading: "Checking for errors." And then a second later, instead of it appeared: "You can safely remove the SD card." Tried rebooting, turning it off and on, pulling out and inserting the SD card. Same on the other device. Why can't he see the flash drive?

5. Mobile devices do not see (do not read) the memory card. The memory card is new, recently purchased. At first there were no problems, but later the phone (philips s308) periodically did not read the map. The laptop saw it without problems. Soon the phone did not read the card at all, and other devices followed it. The card does not contradict the system requirements. What could be the reason?What to do with it?

6. I have a tabletDIGMA Optimastopped seeing the flash drive after I cleared it in the settingssdcard, restart, turned on, took out and inserted the USB flash drive back, nothing helped, inserted it into another phone, it seems to have noticed, but does not perceive it. What should I do?

Answer. In the event that the phone has stopped detecting a memory card, you need to check this sd card on a computer via a card reader (the device is connected to a PC via a USB cable and is inexpensive). In your case, the laptop has a built-in card reader. In order for a phone or tablet to read a card or usb flash drive, you need to properly format it using WIndows tools or using special. software. We strongly advise you to use the free SD Formatter program to format flash drives, this is a method we have tested and often works. We hope that after formatting your phone will see the flash memory and be able to write files to it as before. If the card reader still does not see the memory card, all that remains is to buy a new sd card.

I have a smartphoneSamsung Galaxy Gio S-5660. About six months ago I repaired the charging socket and since then until yesterday I did not turn it on. It had a SIM card and a memory card. When I turned it on, it turned out that the smartphone does not see the memory card. Before that, she had no problems. On the memory card and contacts, books, a bunch of photos. Why does the tablet not see the flash drive and how can I revive it?

I wore the device for repair, I thought that the memory card slot was not working. it turned out to work: new map sees immediately.

Answer . On thesdcard, the legs or contacts may be damaged (pins). If you do not notice any damage upon inspection, check the memory card for reading errors. In no case do not format it, otherwise you will not be able to recover files.

Cleared on the iPhone on Android "Phone memory-memory card" after that the sd card turned off. Below it says "Connect sd card" I click - but not what effect. Now there is no memory (the phone was dismantled, but there is no slot for a flash drive). All in all, mobile phone does not see the memory card. Tell me how to return the sd card back to a working state?

Answer. If you don't see a working memory card on your device, it's likely that the file table contains errors. Try formatting the card using the sdformatter application. Since you are dealing with Android, the sd memory card must be formatted in Ext or Fat32.

With the help of the said application, I restored the photo on the Samsung SM-G 318H / DS. They remain in this application, I can’t transfer them to the gallery or to the SD card, how can I do this? Why does not see the memory card?

Answer. Your question is formulated very ornately, so it's hard to say why the phone does not detect a memory card. It looks like the problem is not with your phone's flash drive, but something else. You need to copy the files to the DCIM folder on the device, then they will be displayed in the Gallery again.

I moved the SIM card from the tablet back to the smartphone and all the memory from the phone disappeared. What to do and is it possible to restore photos and contacts if the smartphone does not see the flash drive.

Answer. In your case, probably not everything is so sad. You may have moved the sd card (flash drive), as a result of which it moved away from the smartphone socket. Check the connection between the socket and the phone's memory card. If contacts are lost on the smartphone's flash drive, try importing contacts from the SIM card through the standard Android address book or synchronize contacts with your Google account.

Samsung Galaxy A5 2016 phone. I inserted a 2 GB Qumo sd card (new card, just bought) into the second slot (for the second SIM card and sd card). The phone does not see it, either simply through the phone's menu, or through a cable connection to a PC. What could be the reason, somehow you can "reanimate" the memory card?

Answer. Qumo memory cards don't have a very good reputation. However, 2GB cards usually don't have problems when connected to a phone.

First, connect your memory card to your computer via a card reader. If the computer does not see the memory card (the disk is not displayed in Explorer), give the card (explaining that the computer does not see the sd card) to the seller and return the money.

If the sd card is not readable only on the phone, but everything is OK on the computer, try formatting the memory card by selecting FAT as the file system.

The Samsung Galaxy S5 smartphone stopped seeing USB flash drives (I saw and read it before), the smartphone is practically new. Other devices, flash drives are detected without problems. Why Android does not see the flash drive, how to fix the error?

Answer. There can be at least two reasons why the phone does not see the flash drive. Try to fix it like this:

1. Check if debugging is enabled on your phone (try enabling/disabling).
2. It is advisable to format the flash drive in exFAT, otherwise Android may not read its contents.

I dropped my phone and all the photos in the gallery in the camera folder disappeared from the memory card. Can they be restored somehow? The rest of the folders remained in their places.

Answer. Perhaps the sd card is damaged or Android does not see the sd card. Check if the sd card works if you connect it via a card reader to a PC. Another reason why the phone does not see the SD card is that the card physically shifted in the slot when it fell, so at the same time check the connection of the contacts.

As for the direct answer to the question: if the memory card is intact, you can restore the photo with any application, starting with CardRecovery and Recuva.

The problem is doubly unpleasant, because the phone was bought a month ago. I decided to transfer some audio-video files from my old phone. The new smartphone is j7, and the old one is also Samsung Galaxy Grand Neo… The data transfer went smoothly.

About a week later I looked at sd, and the map did not appear from my native "my files". I looked through the RAR program, through the xplore file explorer. There all the folders were displayed, but were empty. But it's important to add this: there were music and some video in the phone's memory. So, they were displayed, but they were not "empty", but refused to be reproduced - "playback error". On an old phone with any sd and different ages, this has never happened, so what it was, but not this. And this recorded map can be read normally on the old phone, no problem.

For me, the main thing, as you understand, is the phone, is it the reason? Such refusals in reading for a month were twice with the internal memory, and four times with the seat. Reboot - and everything is fine. But this is not the norm for the phone?

Answer. There may be several reasons for this behavior.

Perhaps the cause of the error lies in your way of copying files from internal memory to external. Try different ways and test: for example, through a card reader on a PC, through a file manager on a phone, etc. Do the described reading errors occur in all cases?

However, since you noted that there are no problems with other flash drives, then there may be a problem with the memory card. Who is the manufacturer, is the sd card compatible with your phone model? Read user reviews.

Third - update the software on the phone and remove unnecessary applications.

Fourth - format the sd card with the SD Formatter utility. Try different file system formats.

1. Last chance to find the answer to my problem. The Samsung galaxy not 5 (china) phone uses only its internal memory, and the flash drive is not detected. What I just didn’t do ... And I put a checkmark, and inserted it into another mobile phone, formatted it this way and that - it doesn’t help.

2. On the phoneSamsung Galaxy A3 memory card not workingmicrosd16 GB. For almost half a year she was in the phone, all the photos from the camera were automatically saved on it. The memory card has not been removed since the time it was put into the slot once. I have been using the phone for almost a year. Previously, there was another card, with a volume of 8 GB.

R.SI moved the card to another phone - he does not see it either. And the computer doesn't recognize it either. What to do? On the flash drive are all children's photos and videos taken in six months.

Answer. If the smartphone or tablet does not see the flash drive, the problem may be in the application that does not save files to the right place. Check in the settings where the files are saved - to an sd card, flash drive or to the internal memory of a tablet / smartphone. For example, in the Android Gallery settings, you can change the storage location for photos.

Re-read the article. If all else fails, then perhaps the phone does not see the card micro memory sd because it is out of order.

The phone does not recognize the memory card. Transferred everything to internal memory. When the card is disconnected, all files are read, but not when connected. Now, when you turn off the SD card, the internal memory is also turned off and there is nowhere to save information. Tell me what can be done if the memory card is not readable (if possible).

Answer. Until this time, the memory card worked? Your phone may not support this card model.

If the sd card worked before, you may need to format your card - and it will be writable again.

The question is formulated incorrectly: you write that when the memory card is turned off, the files are read, while you say below that the internal memory is turned off. So where are the files being read from then?

1. The phone worked with a memory card. With a congratulatory video, they sent a virus that could not be removed. Delete it and it reappears. I tried to reset my phone, but it didn't work. It didn't find any updates. After some manipulations in the recovery menu, he became different, found updates, downloaded and installed them. The firmware shows its own, but with a fresher date.

After that, the sd card is not detected. Android does not see it and does not determine its memory. And other sd too. Without a card, the phone sees its memory and works fine. What to do if the phone does not see the sd card after the actions of the virus?

2. I put an sd card in the computer - everything reads well there, you can see. And in the phone there is an inscription: SAFELY REMOVING THE CARD. Why does the phone not see the memory card? What to do?

Answer. If the phone does not see the memory card, this may be due to damage to the file table on it. How this is connected with the recovery, it is not clear. Try formatting the sd card. If nothing changes for the better - change the firmware.

1. I bought a 4G micro flash drive in my phone, installed it in a computer via a card reader, wrote files and installed it in my phone (Microsoft Lumia 530). After a while, I installed it again in the card reader and connected it to the computer. Windows gave a message that the device is faulty and does not read the USB flash drive, but everything works fine through the phone. And this happens with all usb media and devices. I checked flash on many computers before installing it on the phone - everything is OK. After installation, the memory card does not work on the computer - only through the phone.

2. I ordered a flash drive forebay(flash drive universali- flash device). Yesterday I received it, inserted it into the phone - it works, it also works on the computer. Today I tried to transfer a video from my phone to a USB flash drive, copying began, I left the phone and went away. Upon returning, I found that the program was closed, and the flash drive was no longer detected on the phone, nor was its computer detected. What to do?

3. I bought a 32 GB flash drive in my phone from Aliexpress. It worked fine, then the photos that were saved to it were cut off halfway or instead of them gray screen was. In the end, it stopped being detected by the phone. The computer seems to detect it, but does not tear it off. Writes something like "insert disk". I tried a lot of things that were written on the Internet, a lot of programs. Some do not see the flash drive, some see it, but still cannot format it.Tell me how to make her feel.

Answer. Format the flash drive via phone or Recovery (we wrote about this at the beginning of the publication. If it doesn’t help, go to Windows Disk Management and check if the flash drive is mounted when connected to a PC, if the volume is displayed in the list. If necessary, you can create a new partition on the flash drive and format in FAT or extFAT using specialized programs.

I turn on the music on the phone, he writes: there are no music files. Phone nokia RM-1035 and mirex micro sd (HC) class 4, everything worked yesterday. Probably, the memory card is not readable! How do you know if it's working or not?

Answer. Check if others see mobile applications the contents of the memory card, you can install another player for this. Connect the microsd card to a computer or laptop through a card reader. If the flash drive is not available in both cases, try the other methods described in the article.

The Samsung Galaxy A3 2015 phone does not read the flash drive. I formatted it in all possible formats, but it did not help. Connected to a PC - everything works fine. Why does the phone not see the flash drive? Maybe something in the settings of the phone needs to be changed?

Answer. Go to Settings - Memory. Check the "SD memory card" section. Install a file manager and see if the files on the memory card are displayed on it.

In addition to standard formatting, you can try low-level formatting - however, not all manufacturers offer their own software for this (check the memory card website).

Another reason why the phone does not see the sd card may be the lack of contact between the memory card and the phone. Check if your device reads other flash drives. If not, take your phone in for repair.

Doogee x5 phone. The phone did not see the memory card, but it was there. Accidentally transferred data to external memory. For some reason, the transfer was made, but the map was still invisible. Pictures, videos, music, safely disappeared somewhere. How to get them back and why the phone does not see the memory card? Is it possible to restore all this somehow? Tried Android Recovery - to no avail.

Answer. If the phone does not see the sd card, then how did you transfer the files to it? Perhaps you just copied them to another place.

Try to connect the memory card through the card reader to the computer and scan it with the CardRecovery program. As for Android Data Recovery, this program is less functional.

After disabling the sd card to work in aparted and performing manipulations in it, the prestigio phone does not turn on the sd card again. By the way, the laptop does not see the memory card either. Actions in recovery did not help. What to do if the phone does not see the memory card?

Answer. Perhaps the operating system and the laptop see the sd card, but the markup has fallen off. You need to create a volume on unallocated space. Start - Run - diskmgmt.msc. Find the unallocated area and use the context menu to create a new volume on the sd card, assign a letter, apply formatting. The sd card disk after these manipulations should be determined as before.

I connected the camera as in the instructions (via the USB port), but the camera reads as a Portable Device, but it needs a Removable Disk. The camera does not see the memory card in connection mode or what is the problem? How can I change the display? Camera Nikon Coolpix S9400.

Answer. Your camera supports SD, SDHC and SDXC memory cards. The computer does not see the memory card as a drive. You need to remove the card from the camera and connect it to the PC via a card reader. If you have a card reader built into your laptop, it will be even easier to connect the card. After that, you will see the removable disk in the list.

mico sd 32G in android tablet. I will twist in the connector - everything is ok, but after a while the conductor does not see it and through the settings menu, the SD card memory does not turn on. if you pulled out and inserted a memory card, it appears. I cleaned the contacts, wiped them with a rectifier, but still Android does not see the sd card where the dog is buried?

Answer. Try testing another sd card with your phone. If the situation repeats itself and the smartphone does not see the flash drive (the memory card disappears from time to time) - most likely, the matter is in the contacts of the phone.

If another memory card works without errors, we advise you to format the problematic card in FAT32 or exFAT - in case the phone does not see the micro SD flash drive due to errors in the file table.

The phone (Samsung Galaxy S5) does not read the memory card. I inserted three cards, and does not read any of them, although they are correctly displayed on other devices. In this case, the inscription "Connect SD-card", the font of which was previously gray, becomes white and available for pressing, but if you press it, nothing happens. All photos and pictures in the gallery (located in the phone's memory) are not displayed. And applications that are not in the internal memory, but in the phone's memory, do not open. Tell me what to do?

Answer. There may be a failure at the level of the Android operating system or installed applications. Try to manually resolve the conflict by deleting any unnecessary apps from your phone. Update the OS version to the latest through Android settings.

If the phone still does not see the memory card, check the phone contacts: are there any visually noticeable damage on them?

Do you write "on other devices" while referring to the computer? If yes, it is likely that the file system of the flash drive is NTFS, but you need to format it in FAT or exFat.

When I insert an sd card into the phone, the device does not detect it. Whatever I tried: even inserted into other phones, still does not see and does not read its contents.

Answer. There is too little information about the memory card (it is practically non-existent) to give specific advice. First, check if your phone supports sd cards of the size that is on your card (see the documentation for your smartphone or tablet). If you have just bought a memory card, you can exchange it under warranty for another one - a smaller one.

If you have previously used this memory card and it is no longer detected on this and other mobile devices, it is most likely out of order.

1. I cleaned the sit card on the computer. Deleted everything from her. Now the new smartphone teXet X-plus TM-5577. I inserted a sit card, he sees it, but nothing is downloading on the sit card and I can’t transfer anything to it. Tell me what to do?

2. The phone started to turn on by itself periodically (Lenovo A 526). Then I went out of the house and plugged in the headphones and noticed that not a single track was playing. Later, when I took out the phone, I found that the flash drive was not readable and the saved music was not playing. I tried to reboot the phone - it does not help, I put it in the card reader - it sees a memory card, I put it in my friend's phone - too. And I don't want to. And the most important thing that knocks me out of my thoughts is a notification after turning on the phone with the phrase "Dismantle the MicroSD before deleting so as not to lose data.

Answer. You need to reconnect the memory card to the computer (as you did before), format the sd card in the standard way (for example, through Explorer) or using sdformatter. The file system is FAT32. Most likely, it is due to incorrect formatting that the phone cannot write data to the memory card.

After a sudden shutdown, the tablet (android 5.1) stopped recognizing the memory cards in the card reader normally. Writes either error checking is in progress, or reading is in progress, which lasts indefinitely. At the same time, half of the programs stop responding, everything slows down wildly, and it becomes impossible to turn off the tablet (only when it is discharged to 0 and cut down). Sometimes (very rarely) after connecting, he sees it, but with the slightest manipulation of the card (even viewing a photo), he immediately loses it and starts re-reading it again, and already with the ends. Tested on 3 flash drives, both clean and not, with different formatting and a bunch of dances with tambourines (all according to recommendations on the forums). The system was reset. Nothing helped. He refuses to see a card for 8 gigs at all, although if you connect it through an adapter to a usb connector, everything works fine (like other flash drives). What is the problem, in the card reader or in the system?

Answer. It is best to connect the problematic memory card to a laptop or, alternatively, through a usb adapter, as you mentioned. Next, the sd card needs to be formatted.

Most likely it's the card reader. Many cheap card readers stop reading memory cards correctly after a short time and give copy errors or read information slowly.

The system (Android) is unlikely to be related to the problem, since you have already tested several memory cards. Perhaps it's a specific application that slows down the system, but this can only be calculated by resetting the phone to factory settings.

Phone Lenovo vibe shot, android 6. costs sony sd card 32gb in the option as an extension of the main memory (ext4). The phone stopped seeing the file system - writes SdCard0 01/01/1970, 00 kb. Windows 7 sees two sections - 16Mb and 30Gb, serviceable, free 100% each.

How can I return everything to its place with the restoration of the old files? well, or at least how to pull out photos and a folder of vatsap?

Answer. R.saver or AOMEI Partition Assistant Standard Edition are suitable for recovering a deleted partition on an sd card. If the file table on the partition contains errors, you can try to fix them using the chkdsk utility under Windows. If it doesn't help, try scanning the sd card (unreadable partitions) with the Recuva utility. Until you overwrite the information on the flash drive or format it, the chances of getting the files back remain high.

Samsung A3 2017 Samsung memory card 64 gb. Created folders from the computer: photos, ringnotes, music, videos, movies, etc. The phone sees only audio, pictures, documents, videos. Other folders do not see on the memory card. What needs to be done?

Answer. Install any file manager for your phone (for example, Total Commander or ES Explorer). Create folders directly through these programs and copy everything you need there. The files should be readable on the memory card without problems. It is also possible that those folders that are not readable from the sd card are hidden or corrupted. So it will not be superfluous to format the card in order to avoid further errors.

Lenovo A2010 phone does not see sd memory card. tried to reboot, writes "Only one sd card is available, it is impossible to perform switching." Other phones do not have a card. In the computer through the card reader does not show at all. Is this really the end, so many photos and videos are gone? Maybe something can be done?

Answer. It looks like there are reading errors on the card or the markup has fallen off. Since the memory card does not open on the computer (i.e., the letter / separate drive is not displayed in the file manager), it makes sense to check if the memory card is recognized as a device at all. To do this, go to diskmgmt.msc (Start - Run) and see if unallocated space appears when you connect the sd card to the PC. If it appears, create a new file volume in this space via the context menu. If nothing happens, most likely the sd card is out of order.

Phone model sony xperia m4 aqua dual. Within two years, a microSD memory card was installed in the phone. Recently, failures began to occur: at first, in order for the memory card to work, it was enough to restart the phone. Now the phone does not see the map at all. Formatting failed. Installed a new one. The phone recognizes it (it is in the settings, the photos were sent to the card), but the applications can not be downloaded from the play store (it still shows the download option only to the phone's memory). What needs to be done in this situation with a flash drive?

Answer. Format the memory card with specialized applications - the same SDFortatter is fine. Next, check the card for errors using the chkdsk tool.

However, you clarified that changing the memory card does not help. The problem may be caused by specific applications or software conflicts within the Android OS. In this case, we advise you to update the firmware or, as an extreme option, reset the phone (perform a hard reset).

Samsung A5 2017 stopped seeing it after encryption of the SD card. Through the card reader on the computer sees, but does not open. Tried to format (SDFormatter, cmd) - does not work. Sees other flash drives. I checked for errors - it gives an error, but does not fix it.

Answer. To check the sd card, use the following options:

chkdsk (drive letter): /f/r

  • /f - fix file system read errors
  • /r - fix bad sectors on sd card

This should fix the errors and allow you to format the sd card in the standard way or through utilities like SDFormatter.

there is a Kingston DTSE3 16G usb drive, the computer does not see it, the flash drive is not readable. periodically the system gives a message that the device can work faster or the device is not recognized. Are there any recovery programs?

Answer. The flash drive supports the USB 2.0 interface. Your computer (motherboard) may have more old version ports, which causes this message to appear. Therefore, we advise you to update the hardware of your PC if you have not done this for a long time.

Recovery programs will not help you, but the correct formatting of the flash drive (in NTFS / FAT) and subsequent error checking through chkdsk will not interfere.

Tablet samsung galaxy tab 4 SM-T331 does not see the sd card. places available 0b, free 0b. and I inserted the same SD card into another device, into my phone, and sees the SD card: available 14.57 free 14.57. I insert another SD card into the tablet - again it does not see, but the phone sees.

Answer. If there are important files on the memory card, make a copy of them on your computer. After that, format the memory card and check it for errors. If everything is in order, you can use the sd card on your tablet or phone, write files to it. If the situation repeats, update the tablet firmware or perform a hard reset. However, this is already an extreme measure, we advise you to deal with reading errors first.

Made the memory card an internal storage onZTE blade A510. After resetting the settings on the phone (sdthe card was in the phone all this time) it stopped working on all devices, Android does not save to it.

Answer . You need to format and mount againmicroSDas internal storage. If the memory card is opened on a computer, transfer all the data on it to the hard drive.

I have a Samsung Galaxy S4 NEO.I bought a memory card for 16 gigs, but after 5 months of use, at one point it stopped seeing all the games that were on it. And the phone sees the video, pictures and everything else without problems. In settings> memory> memory card, the total amount is written, free space - in general, everything is as usual. Help with this problem!

Answer . The easiest way is to reinstall the games. You can do it through the app.Google play. If user data is still stored in the phone memory or onsd-map, games will work as before.If not, try to restore them through the appropriate recovery applications.

The SD card worked fine. Over time, the phone began not to see it, but after the reboot everything was restored. Now rebooting the phone has no effect. I connect it to the phone as usb everything opens and plays. I exclude erasing contacts, since the phone is a year old and rarely removed the card. Phone xiaomi redmi note 3 pro. Thank you in advance for your answer.

Phone LG LBello d-335. The size of the sd card is 8 GB. There were no problems before, but after I moved most of the applications to the sd card, the phone often began to show that it did not see it. After rebooting the phone, the problem disappears, but very often this happens. Please, help to deal with the problem.

Good afternoon! I bought a new smart, installed the game, during the installation process the android rebooted, after that the smartphone refused to read the SD card, that is, it does not see it, it seems like it is not in the slot. In another smartphone and through the card reader, the card is not visible. How to proceed?

Hello. The ZTE blade A 520 phone stopped seeing the flash drive, which before that showed everything without any problems. The cd card is displayed in the laptop through the card reader, but is not visible in the phone. I put another flash drive, it can be seen, mine is not. , but even after the repair it is not displayed on the phone, only through the card reader in the laptop. The size of the card is 32 GB. I don’t want to buy another flash drive, since this flash drive has the main files, in general, everything you need.

Bought a new memory card. 4 phones do not see it. Tried on phones: Huawei Honor, Lenovo, Meizu, Samsung, Xaomi. 16GB memory card. What to do?

Hello! Here I have such a problem: the SD flash drive (16 gigabyte) for some reason sometimes reads, and sometimes does not see the device. Can you help me why this is happening and what should I do?

the tablet does not see the SD card (16 gigs) after it goes into sleep mode, you have to open the back panel and re-insert the USB flash drive, and everything works fine, but again it does not see the SD at the next start. formatted the card.

Hello, I wanted to ask me a problem with Samsung not 8 does not see the flash card before it sees right now it says connected and disconnected. Tried on another phone, everything is fine sees and connects. What can be help please.

Hello, please help me understand. I bought a memory card in my phone, but he does not see it at all, he simply does not respond to inserting and removing it. In the settings writes a memory card is missing. Checked in another phone, everything works. My other memory card also sees. The card is 64GB, according to the characteristics it fits my phone (maximum). Somewhere they read that in such a situation you need to reset everything to the factory settings, but will this help, I don’t want to lose all the data. Please advise how to be. Thank you in advance.

good afternoon. I have almost the same thing, I don’t see the sd card, formatted it but writes that the card is protected, the phone offers to format it, I agree to look further, it says it’s damaged, I check on the laptop all the contents are left there ... it doesn’t see it on the smartphone ..

Hello, my SD card does not see the phone, I went into the settings of the memory card, it says it is forbidden, the files are not displayed. when formatting an error is written. Is there any way to save the files?

I installed a USB flash drive on ZTE as internal memory. When I had to return the phone to the factory settings, I pulled out the flash drive, and after everything I put it back in, it asks me to format it, and everything is on it. They insert it into the computer not to see it. Tell me how to get the pictures from there to the computer.

The phone does not see the sd card. It does not open on the computer and asks to format it. There are a lot of important things to do on the card. How can I restore everything not only photos but also documents?

I have an 8gb flash drive on my asus smartphone. Then I put it on the new Samsung a8 for two days, it worked fine. And then she stopped. That is, the phone does not see it. I tried to put it back on the asus. And he stopped seeing her. Bought a new one. Everything is fine. Samsung sees a flash drive but again for two days. And that's all. Disables flash drives. What could be?

At some point, I received a notification that the SD card was damaged. After that, neither mine nor other phones see it. What to do? Are files lost? How to restore them? There were a lot of photos on it..

The ability to perform operations with the card is lost. I don't physically remove the card. In the MEMORY settings menu, I just press "disconnect the SD Card" then immediately "Connect" and it is available for 15 minutes. After that, again, although the card itself is visible, the file managers write "empty", although the capacity is correctly determined occupied / free. But nothing can be read or written down. When connected to a computer, not only the map is visible, but also folders / files, but nothing can be done (read write) either. Until the next Disconnect / connect for 15 minutes. Cards of any capacity and class have been tried (new and formatted with both a computer and a device). If you constantly access the map, it does not turn off longer. It is worth leaving everything.

Good day everyone! Today we will talk about connecting an SD memory card to the STM32 microcontroller.

It would seem that the STM32F10x controllers have a lot of memory, why is there an additional one, but this impression is deceptive) For example, we need to display a couple of different images on the display - 320 * 240 format - that is, 76800 pixels, each of which corresponds to as many as 2 bytes. So we get about 150 kB per picture. And this is a lot by the standards of a microcontroller, and it is not a fact that two different pictures can be stuffed into its Flash memory. Or we need to store large amounts of information, data from some sensor, for example. Moreover, so that this data is available even after the power is turned off. This is where external memory comes in handy. And a great solution SD memory card or MMC. By the way, in this article we will conduct experiments on micro SD card.

First, a few words about the memory card itself, or rather about its pinout. The whole thing looks like this:

So what do we have here? Well, you can immediately see that she has as many as eight conclusions. The pin assignments are as follows (from left to right):


The SPI Mode column hints to us that it interacts with the microcontroller using the SPI interface. BUT! We will take a different path 😉 The thing is that STM32 have on board a ready-made peripheral module for working with memory cards, and it is called SDIO.

In general, interaction with memory cards consists in transferring certain commands to them. Some commands require an argument, some do not. Commands can be found in the official documentation for a specific card. So the built-in SDIO module makes it possible to greatly simplify the process of transmitting commands, and indeed the process of working with external memory cards. For example, here is the register SDIO_CMD- there we simply simply write down the code of the command that we want to transfer to the card. Or here is the status register SDIO_STA- there are as many as 24 flags for each sneeze, that is, for a large number of events.

By the way, STM also pleases with good documentation for the whole thing. Here, for example, detailed description initialization for an SD memory card (similarly, everything is described for other types of cards):

Well, actually, it's time to move on to a practical example. Let's dig into the Standard Peripheral Library.

In file stm32f10x_sdio.h traditionally, we find structures for all kinds of settings - that is, to select the source of the clock signal, the frequency of the SDIO controller, and adjust the number of bytes transmitted. Everything is so generously commented there that I don’t even want to repeat it separately)) Just look:

typedef struct ( uint32_t SDIO_ClockEdge; /* Specifies the clock transition on which the bit capture is made. This parameter can be a value of @ref SDIO_Clock_Edge */ uint32_tSDIO_ClockBypass; /* Specifies whether the SDIO Clock divider bypass is enabled or disabled. This parameter can be a value of @ref SDIO_Clock_Bypass */ uint32_tSDIO_ClockPowerSave; /* Specifies whether SDIO Clock output is enabled or disabled when the bus is idle. This parameter can be a value of @ref SDIO_Clock_Power_Save */ uint32_tSDIO_BusWide; /* Specifies the SDIO bus width. This parameter can be a value of @ref SDIO_Bus_Wide */ uint32_t SDIO_HardwareFlowControl; /* Specifies whether the SDIO hardware flow control is enabled or disabled. This parameter can be a value of @ref SDIO_Hardware_Flow_Control */ uint8_tSDIO_ClockDiv; /* Specifies the clock frequency of the SDIO controller. This parameter can be a value between 0x00 and 0xFF. */) SDIO_InitTypeDef; typedef struct ( uint32_t SDIO_Argument; /* Specifies the SDIO command argument which is sent to a card as part of a command message. If a command contains an argument, it must be loaded into this register before writing the command to the command register */ uint32_t SDIO_CmdIndex; /* Specifies the SDIO command index. It must be lower than 0x40. */ uint32_t SDIO_Response; /* Specifies the SDIO response type. This parameter can be a value of @ref SDIO_Response_Type */ uint32_tSDIO_Wait; /* Specifies whether SDIO wait-for-interrupt request is enabled or disabled. This parameter can be a value of @ref SDIO_Wait_Interrupt_State */ uint32_t SDIO_CPSM; /* Specifies whether SDIO Command path state machine (CPSM) is enabled or disabled. This parameter can be a value of @ref SDIO_CPSM_State */) SDIO_CmdInitTypeDef; typedef struct ( uint32_t SDIO_DataTimeOut; /* Specifies the data timeout period in card bus clock periods. */ uint32_tSDIO_DataLength; /* Specifies the number of data bytes to be transferred. */ uint32_tSDIO_DataBlockSize; /* Specifies the data block size for block transfer. This parameter can be a value of @ref SDIO_Data_Block_Size */ uint32_tSDIO_TransferDir; /* Specifies the data transfer direction, whether the transfer is a read or write. This parameter can be a value of @ref SDIO_Transfer_Direction */ uint32_tSDIO_TransferMode; /* Specifies whether data transfer is in stream or block mode. This parameter can be a value of @ref SDIO_Transfer_Type */ uint32_t SDIO_DPSM; /* Specifies whether SDIO Data path state machine (DPSM) is enabled or disabled. This parameter can be a value of @ref SDIO_DPSM_State */) SDIO_DataInitTypeDef;

Note how the SPL implements the transfer of commands to the memory card. A separate structure has been set aside for these purposes. SDIO_CmdInitTypeDef. In field SDIO_CmdIndex enter the command code in the field SDIO_Argument- command argument, also fill in the remaining fields. It remains to somehow push this data into a micro SD card 😉 And for this we have prepared a function:

SDIO_SendCommand (SDIO_CmdInitTypeDef *SDIO_CmdInitStruct)

As an argument, we pass to it just the same structure we created. There is a function for writing data - SDIO_WriteData(uint32_t Data). After calling this function, the data will be in a specially designed register - SDIO_FIFO.

This is how the work with the SDIO module in STM32F10x is carried out)

Now let's move on to practice at last. I will again work with the Mini STM32 board, as the good Chinese were puzzled by installing a micro SD memory card slot on it. Here is a diagram of connecting the card connector to the microcontroller:

To write a program, we will use a ready-made example for Keil - we will steal two files from there, in which something like a driver for working with cards is implemented - these are files sdcard.c and sdcard.h We create a new project, link these files there, and in addition, of course, the CMSIS and SPL files. Here is the finished project, in which everything has already been added - it remains only to write the code for the main () function)

The sdcard.c file implements all kinds of functions for working with a memory card, now we just have to use them 😉 Let's write the code! For example, let's write 512 bytes of test data to micro SD, and then try to read them:

// Linking the required files#include "stm32f10x.h" #include "sdcard.h" /*******************************************************************/ // Arrays of input and output data and a variable to store data// about our map uint8_t writeBuffer[ 512 ] ; uint8_t readBuffer[ 512 ] ; SD_CardInfo SDCardInfo; /*******************************************************************/ int main() ( // Test data to write for (uint16_t i = 0 ; i< 512 ; i++ ) { writeBuffer[ i] = i % 256 ; readBuffer[ i] = 0 ; } // Map initialization SD_Init() ; // Get map information SD_GetCardInfo(& SDCardInfo) ; // Selecting a map and setting the operating mode SD_SelectDeselect((uint32_t ) (SDCardInfo.RCA<< 16 ) ) ; SD_SetDeviceMode(SD_POLLING_MODE) ; // And finally, writing and reading SD_WriteBlock(0x00 , writeBuffer, 512 ) ; SD_ReadBlock(0x00 , readBuffer, 512 ) ; while (1 ) ( ) ) /*******************************************************************/

Please note that the SD card supports writing in blocks of 512 bytes.

If we run the program under a debugger, we will see that the read data corresponds to the written data =) So the experiment can be considered a success. That concludes for today, see you soon!

The memory on smartphones is non-rubber, despite the vast amount of information that many of us store on them. That is why some manufacturers to this day do not refuse the possibility of expanding the built-in memory using MicroSD cards.

The current flagships support cards up to two terabytes in size, which greatly increases the internal reserves of smartphones. However, this does not solve another problem - all applications are automatically installed in the internal memory, and its amount cannot be expanded. In this regard, we decided to write an article on how to make sure that everything is saved to a memory card. It offers several ways at once for owners of different devices - ranging from budget models that have 4-8 GB built-in to flagships on the latest versions of the Android operating system.

We save applications to a memory card using standard means

In most modern smartphones, the procedure for transferring applications (games and programs) can be carried out using a few taps. Unfortunately, there is no way to activate their automatic installation on MicroSD. Therefore, we will have to be content with manual transfer. So, for this you must do the following:
  1. We go to the "Settings" menu;
  2. We find the item "Applications" there. In some sections, it may be referred to as "Application Manager";
  3. We select the application we need there. In our case - the game "CSR Racing";
  4. The information in the window is updated. Now you need to tap on the "Move to SD card" button;
  5. After a few seconds, the inscription on the button will change to “Transfer to device”, which tells us about the successful transfer of the application and the release of internal memory.
Can't find the "Move to SD card" button? This is not a reason to worry, then you just have to use a third-party transfer application.

We use Clean Master to transfer data to a memory card

As noted above, this method is analogous to the previous version of transferring to an SD card. We suggest you immediately start reviewing the instructions:

Ready! The memory on the device itself has been freed. By the way, if we compare the two methods already presented, then we advise you to choose the second one - using the Clean Master application. So you will spend much less time due to the fact that you can select several games and programs at once.

Connecting the memory card to the internal memory

In Android 6.0+, a way to expand memory using an SD card became available. True, we want to warn you right away that it works only on some devices - not all manufacturers have implemented this function in their shell. So let's get started:

It is also worth noting that not all SD cards are suitable for this kind of operation. It is important that the external memory card belongs to the 10th class and corresponds to the declared speeds of reading and writing data.

Swap Android internal memory with memory card (requires Root)

Another well-known method, most used on devices with a small amount of internal memory, is to replace the internal memory with an SD card. You should already be rooted and have the Root Explorer app installed. You must do the following:

Ready! From now on, everything that you download will automatically be installed on the SD card. As you can see, there are a fairly large number of ways to make sure that everything is saved to a memory card, you need to choose only one of them, depending on which version of the OS you have installed, what exactly you want to get and whether there is a Root on the device.

We displayed the picture on the display from the sd card, but some points were missed in it, the first - connecting the card itself, the second - only part of the library functions was considered Petit FatFs Let's take a closer look at these points.

Communication with the card is possible via one of two interfaces, SPI or SD.



I must say that the SD interface can work in one-bit and four-bit modes.

The scheme for connecting the card via SPI is standard and looks like this, unused card pins must be connected to the power supply using a 10K resistor.


But in amateur designs, pull-up resistors are often neglected, simplifying the connection diagram.

It should be noted that when connected via SPI, the card is very demanding on the supply voltage and a small drop in the supply voltage leads to the inoperability of the card, this has been verified from personal experience, there is nothing to say about the SD interface, I have not tried it yet. All this was written to for power supply, it is necessary to install capacitors. As for the inductor, it must be rated for current up to 100mA, but it is not necessary to install it.

The diagrams shown above show that the card needs 3.3 volts to work, respectively, in the data transmission lines, the voltage should not go beyond the range of 0 - 3.3 volts, and here the question arises, what if the MC is powered by 5 volts?
The answer is simple, you need to match the data lines, and this can be done using a conventional resistive divider.


The diagram shows that the MISO line does not need to be matched as data is transmitted over this line from card to MK.
In fact, few people connect the card directly to the MK, it is much more convenient to connect a card connector to the MK or buy a shield with a connector and all the necessary harness.

We figured out the connection, now let's look at how to use the library Petit FatFs, which is designed for 8-bit microcontrollers with a small memory size.

The library consists of 5 files:
integer.h- a header file that describes the main data types.

diskio.h- a header file that declares the prototypes of low-level functions for working with the disk and the status codes they return.

diskio.c- low-level functions should be implemented in this file, initially there are "stubs".

pffconf.h- configuration file.

pff.h- header file in which the prototypes of functions for interacting with the disk file system are declared.

pff.c- the file contains implementations of functions for interacting with the disk file system.

It can be seen that in order for the library to work, it is necessary to implement low-level functions. But if we are talking about AVR or PIC, for them on the site you can download an example of working with the library, which contains the file mmc, low-level functions are already implemented in it. It is also necessary to set the library configuration in the pff.h file and write the functions necessary for SPI to work.

Functions of Petit FatFs.

FRESULT pf_mount (FATFS*)- the function mounts/dismounts the disk. This function must be called before starting work with the disk, if you call the function with a null pointer, the disk is unmounted. The function can be called at any time.

Options
FATFS* fs- a pointer to an object of type FATFS, a description of this structure can be found in the pff.h file. We just need to declare a variable of this type.

Return values:
FR_OK (0)
FR_NOT_READY- the device could not be initialized
FR_DISK_ERR- an error occurred while reading from disk
FR_NO_FILESYSTEM- the drive does not have a valid FAT partition

FATFS fs;//Declare an object of type FATFS //Mount the disk if (pf_mount(&fs) == FR_OK) ( //The disk is mounted, working with it //Dismount the disk pf_mount(NULL); ) else ( //Failed to mount the disk )

FRESULT pf_open (const char* path)- the function opens an existing file. After the file is opened, you can work with it, that is, read from it and write to it. You can work with an open file until another file is opened. The function can be called at any time.

Options
const char*path- a pointer to a string indicating the path to the file. The path must be specified completely relative to the root directory, separating the directories with a slash.

Return values:
FR_OK (0)- returned in case of successful execution of the function
FR_NO_FILE- File not found
FR_DISK_ERR- disk error
FR_NOT_ENABLED- disk has not been mounted

FATFS fs;//declaring an object of FATFS type //mounting the disk if (pf_mount(&fs) == FR_OK) ( //opening the file located in the root directory if(pf_open("hello.txt") == FR_OK) ( //doing something ) //open the file located in the folder new if(pf_open("new/hello.txt") == FR_OK) ( //do something ) //dismount the disk pf_mount(NULL); ) else ( // failed to mount disk)

FRESULT pf_read(void* buff, WORD btr, WORD* br)- the function reads the specified number of bytes from the file and saves them to the buffer. If the number of bytes read is less than specified, then the end of the file has been reached.
#define _USE_READ 1

Options:
void*buff- pointer to the buffer in which the read data is stored
WORD btr- number of bytes to be read
WORD*br- a pointer to a variable that stores the number of bytes read.

Return values:
FR_OK (0)- returned in case of successful execution of the function
FR_DISK_ERR- disk error
FR_NOT_OPENED- the file was not opened
FR_NOT_ENABLED- disk has not been mounted

FATFS fs;//declare an object of type FATFS BYTE buff;//buffer for reading a file WORD br; // counter of bytes read // mount the disk if (pf_mount(&fs) == FR_OK) ( // open the file located in the root directory if(pf_open("hello.txt") == FR_OK) ( // read 10 bytes from it pf_read(buff, 10, &br); if(br != 10) ( //if br is not equal to 10 //it means we have reached the end of the file ) ) )

FRESULT pf_write(const void* buff, WORD btw, WORD* bw)- the function allows you to write data to an open file. In order for the function to work in the pffconf.h file, you need to write
#define _USE_WRITE 1

Options:
void*buff- pointer to the buffer we want to write, zero value finalizes the write
WORD btw- the number of bytes we want to write
WORD*bw- a pointer to a variable that stores the number of bytes that could be written. By analyzing this variable, you can find out whether the end of the file has been reached.

Return values:
FR_OK (0)- returned in case of successful execution of the function
FR_DISK_ERR- disk error
FR_NOT_OPENED- the file was not opened
FR_NOT_ENABLED- disk has not been mounted

Due to the fact that the library is designed for microcontrollers with a small amount of memory, this function has a number of limitations:

  • you cannot create new files, and you can only write to existing ones
  • file size cannot be increased
  • can't update timestamp
  • a write operation can only be started/stopped at a sector boundary
  • read-only file attribute cannot prevent writing

In order to understand the penultimate point, you need to know that the memory of the card is divided into blocks (sectors) of 512 bytes and recording can only be started from the beginning of the sector. Thus, if we want to write 1000 bytes, then the first sector will be written completely, and only 488 bytes will be written to the second, and the remaining 24 bytes will be filled with zeros.

To write to an open file, do the following:

  • set the pointer to the sector boundary, if set not to the boundary, the pointer will be rounded to the lower sector boundary
  • call the write function the desired number of times
  • finalize the entry by calling the function with a null pointer

In order to give an example of the work of the recording function, it is necessary to consider one more function.

FRESULT pf_lseek(DWORD offset)- sets the read/write pointer in the open file. You can set the pointer with an absolute or relative offset; for an absolute offset, you must pass a number to the function
pf_lseek(5000);
for relative, pass the value of the pointer to the current position fs.fptr and the amount of displacement
pf_lseek(fs.fptr + 3000);
In order for the function to work in the pffconf.h file, you need to write
#define _USE_LSEEK 1

Options:
DWORD offset is the number of bytes to shift the pointer to.

Return values:
FR_OK (0)- returned in case of successful execution of the function
FR_DISK_ERR- disk error
FR_NOT_OPENED- the file was not opened

You can write data to a file in the following way.
FATFS fs;//declare an object of type FATFS BYTE buff;//buffer for reading a file WORD br; // counter of bytes read // mount the disk if (pf_mount(&fs) == FR_OK) ( // open the file located in the root directory if(pf_open("hello.txt") == FR_OK) ( // set the pointer to the first sector pf_lseek(0); //write pf_write(buff, 10, &br); //finalize the write pf_write(0, 0, &br); ) )

I also leave here a piece of really working code that uses all the functions described above.
#define F_CPU 8000000UL #define buff_size 10 #include #include #include "diskio.h" #include "pff.h" #include "spi.h" FATFS fs;//declaring an object of type FATFS BYTE read_buff;//buffer for reading the file BYTE write_buff = "hello word";/// /buffer to write to file UINT br; // counter of bytes read int main(void) ( // mount the disk if (pf_mount(&fs) == FR_OK) ( // open the file in the folder new if(pf_open("new/hello.txt") == FR_OK) ( //set write pointer pf_lseek(0); //write pf_write(write_buff, buff_size, &br); //finalize write pf_write(0, 0, &br); //set read pointer pf_lseek(0); //read that that we wrote pf_read(read_buff, buff_size, &br); if(br != buff_size) ( //if br is not equal to buff_size //it means we have reached the end of the file ) ) //mount the disk pf_mount(NULL); ) while(1) ( ) )

FRESULT pf_opendir(DIR* dp, const char * path)- the function opens an existing directory and creates a pointer to an object of type DIR, which will be used to get a list of files in the open directory.
In order for the function to work in the pffconf.h file, you need to write
#define _USE_DIR 1

Options:
DIR *dp- pointer to a variable of type DIR.

const char * path- pointer to a string that contains the path to the directory, directories are separated by a slash

Return values:
FR_OK (0)- returned in case of successful execution of the function
FR_NO_PATH- could not find path
FR_NOT_READY- Failed to initialize disk
FR_DISK_ERR- disk error
FR_NOT_ENABLED- disk has not been mounted

//declaring variables FATFS fs; DIR dir; //mount disk pf_mount(&fs); //open directory pf_opendir(&dir, "MY_FOLDER");

FRESULT pf_readdir(DIR* dp, FILINFO* fno)- function allows you to read the contents of the directory. To do this, open a directory with the pf_opendir() function and call pf_readdir(). Each time the function is called, it will return the name of the object (folder/file) located in the specified directory. When it has gone through all the objects, it will return the null string in the fno.fname array element.
In order for the function to work in the pffconf.h file, you need to write
#define _USE_DIR 1

Options:
DIR *dp- pointer to a variable of type DIR, which must be previously declared

FILINFO *fno- a pointer to a variable of type FILINFO, which must be previously declared.

Return values:
FR_OK- successful completion of the function
FR_DISK_ERR- disk error
FR_NOT_OPENED- directory not open

FATFS fs; FRESULT res; FILINFO fno; DIR dir; //mount disk pf_mount(&fs); //open directory res = pf_opendir(&dir, MY_FOLDER); //read the contents of the directory for(;;)( res = pf_readdir(&dir, &fno); //check if there were any errors while reading // and if there are still files in the specified directory if ((res != FR_OK) || ( fno.fname == 0))( break; ) //display in a convenient way fno.fname usart_sendStr(fno.name); usart_sendStr(/r); )

And finally, I'll leave the working project here



 
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