Arduino NANO i czytnik microsd - Wersja do druku +- Arduino Polska Forum (https://forum.arduinopolska.pl) +-- Dział: Korzystanie z Arduino (https://forum.arduinopolska.pl/dzial-korzystanie-z-arduino) +--- Dział: Piaskownica (https://forum.arduinopolska.pl/dzial-piaskownica) +--- Wątek: Arduino NANO i czytnik microsd (/watek-arduino-nano-i-czytnik-microsd) |
Arduino NANO i czytnik microsd - fusilis - 20-10-2022 Witam Dlaczego czytnik dziala na UNO a NANO juz nie wykrywa karty ? RE: Arduino NANO i czytnik microsd - MadMrQ - 21-10-2022 Uwaga, odpalam szklaną kulę... Brak jakichkolwiek informacji - schematów połączeń, kawałka kodu, użytych bibliotek, pełnych informacji o hardware itp. Mimo najszczerszych chęci z fusów wróżyć nie umiemy. RE: Arduino NANO i czytnik microsd - fusilis - 21-10-2022 (21-10-2022, 18:27)MadMrQ napisał(a): Uwaga, odpalam szklaną kulę.../* Polaczenie: ** MOSI - pin 11 ** MISO - pin 12 ** SCK - pin 13 ** CS - pin 4 ( 10 tez to samo) */ // include the SD library: #include <SPI.h> #include <SD.h> Sd2Card card; SdVolume volume; SdFile root; // change this to match your SD shield or module; // Default SPI on Uno and Nano: pin 10 // Arduino Ethernet shield: pin 4 // Adafruit SD shields and modules: pin 10 // Sparkfun SD shield: pin 8 // MKR Zero SD: SDCARD_SS_PIN const int chipSelect = 10; void setup() { // Open serial communications and wait for port to open: Serial.begin(9600); while (!Serial) { ; // wait for serial port to connect. Needed for native USB port only } Serial.print("\nInitializing SD card..."); // we'll use the initialization code from the utility libraries // since we're just testing if the card is working! if (!card.init(SPI_HALF_SPEED, chipSelect)) { Serial.println("initialization failed. Things to check:"); Serial.println("* is a card inserted?"); Serial.println("* is your wiring correct?"); Serial.println("* did you change the chipSelect pin to match your shield or module?"); Serial.println("Note: press reset button on the board and reopen this Serial Monitor after fixing your issue!"); while (1); } else { Serial.println("Wiring is correct and a card is present."); } // print the type of card Serial.println(); Serial.print("Card type: "); switch (card.type()) { case SD_CARD_TYPE_SD1: Serial.println("SD1"); break; case SD_CARD_TYPE_SD2: Serial.println("SD2"); break; case SD_CARD_TYPE_SDHC: Serial.println("SDHC"); break; default: Serial.println("Unknown"); } // Now we will try to open the 'volume'/'partition' - it should be FAT16 or FAT32 if (!volume.init(card)) { Serial.println("Could not find FAT16/FAT32 partition.\nMake sure you've formatted the card"); while (1); } Serial.print("Clusters: "); Serial.println(volume.clusterCount()); Serial.print("Blocks x Cluster: "); Serial.println(volume.blocksPerCluster()); Serial.print("Total Blocks: "); Serial.println(volume.blocksPerCluster() * volume.clusterCount()); Serial.println(); // print the type and size of the first FAT-type volume uint32_t volumesize; Serial.print("Volume type is: FAT"); Serial.println(volume.fatType(), DEC); volumesize = volume.blocksPerCluster(); // clusters are collections of blocks volumesize *= volume.clusterCount(); // we'll have a lot of clusters volumesize /= 2; // SD card blocks are always 512 bytes (2 blocks are 1 KB) Serial.print("Volume size (KB): "); Serial.println(volumesize); Serial.print("Volume size (MB): "); volumesize /= 1024; Serial.println(volumesize); Serial.print("Volume size (GB): "); Serial.println((float)volumesize / 1024.0); Serial.println("\nFiles found on the card (name, date and size in bytes): "); root.openRoot(volume); // list all files in the card with date and size root.ls(LS_R | LS_DATE | LS_SIZE); root.close(); } void loop(void) { } Zwraca "initialization failed" Ten sam program na UNo dziala bez zarzutu, NANO sprawne, sprawdzalem na dwoch egzemplarzach. RE: Arduino NANO i czytnik microsd - kaczakat - 22-10-2022 Brakuje informacji jak zasilasz urządzenie z UNO/NANO, jeśli 3.3V z UNO/NANO to nie zasilaj z NANO, z UNO jeszcze ujdzie. Uno ma osobny stabilizator 3.3V, a NANO go nie ma, daje 3.3 V z konwertera USB, a tam jest bieda z prądem, coś do 50mA. Ale możesz też mieć źle podłączone kabelki. RE: Arduino NANO i czytnik microsd - Robson Kerman - 23-10-2022 Mam kilka czytników i wszystkie mają LDO ->3V3, więc można zasilać 5V jak i 3.3V Pobawiłem się tym trochę i na UNO jak i na NANO chodzi tak samo. RE: Arduino NANO i czytnik microsd - kaczakat - 24-10-2022 Jak ma LDO to raczej z 5V, bo o mysi wąs może już braknąć z 3.3V, a i różnica logiki będzie bez sensu. Czytnik z SD pobiera z 13mA, a z kartą, to już zależy od karty, Google zwraca dla SD card max current pierwsze trafienie max 163mA, https://electronics.stackexchange.com/questions/33472/how-much-current-does-a-microsd-card-use , choć wiele innych wpisów mówi o typowym poborze nie więcej niż 40mA. RE: Arduino NANO i czytnik microsd - Robson Kerman - 24-10-2022 U mnie siedzi bufor 74LVX125, więc można zasilać z 3.3V, oczywiście za LDO. |