luc-github / ESP3D

FW for ESP8266/ESP8285/ESP32 used with 3D printer
GNU General Public License v3.0
1.73k stars 465 forks source link

[BUG] no SD CARD ESP32 #690

Closed Anion-anion closed 2 years ago

Anion-anion commented 2 years ago

luc Hi! I am used ESP3d v 3.0 with SD card.

I connected the sd reader to the esp32 to contacts CS D5 SCLK D17 MISO D19 MOSI D23

the configuration of the ESP3D is as follows. But he doesn't see the sd card. Writes NO SD CARD luc, what am I doing wrong?


[ESP780]/SD Directory on Global FS : /SD 0 file, 0 dir Total 0 B, Used 0 B, Available: 0 B [ESP780]/SD Directory on Global FS : /SD 0 file, 0 dir Total 0 B, Used 0 B, Available: 0 B [ESP790] Incorrect command! [ESP790]/SD Incorrect command! [ESP780] Directory on Global FS : /

FS SD 0 B 2021-11-09 00:00:41 1 file, 1 dir [ESP200] No SD card ESP700 [ESP700] ok [ESP715]FORMATSD Start Formating ------

terminal send: error: No SD card E (1124403) sdmmc_common: sdmmc_init_ocr: send_op_cond (1) returned 0x107

config.h - ESP3D configuration file

Copyright (c) 2014 Luc Lebosse. All rights reserved.

This code is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with This code; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */

ifndef _CONFIGURATION_H

define _CONFIGURATION_H

//FEATURES - comment to disable //////////////////////////////////////////////////////////

//WiFi setup station as default, use AP mode first if not done //Note: need both defined to enable it //#define STATION_WIFI_SSID "" //#define STATION_WIFI_PASSWORD "" //you can also use a different config file for SSID/password //this file is ignored by github

if defined __has_include

if __has_include ("myconfig.h")

include "myconfig.h"

endif

endif

//SERIAL_COMMAND_FEATURE: allow to send command by serial

define SERIAL_COMMAND_FEATURE

//AUTHENTICATION_FEATURE: protect pages by login password //#define AUTHENTICATION_FEATURE

//WIFI_FEATURE : enable WIFI function

define WIFI_FEATURE

//ETH_FEATURE : enable Ethernet function //#define ETH_FEATURE

//BLUETOOTH_FEATURE : enable BT Serial function //#define BLUETOOTH_FEATURE

//HTTP_FEATURE : enable HTTP function

define HTTP_FEATURE

//TELNET_FEATURE : enable Telnet function

define TELNET_FEATURE

//WS_DATA_FEATURE: allow to connect serial from Websocket

define WS_DATA_FEATURE

//DISPLAY_DEVICE: allow screen output //OLED_I2C_SSD1306 1 //OLED_I2C_SSDSH1106 2 //TFT_SPI_ILI9341_320X240 3 //TFT_SPI_ILI9488_480X320 4 //#define DISPLAY_DEVICE TFT_SPI_ILI9488_480X320

//UI_TYPE_BASIC 1 //UI_TYPE_ADVANCED 2 //#define DISPLAY_UI_TYPE UI_TYPE_ADVANCED

//UI_COLORED 1 //UI_MONOCHROME 2 //#define DISPLAY_UI_COLOR UI_COLORED

//BUZZER_DEVICE: allow to connect passive buzzer //#define BUZZER_DEVICE

if defined (DISPLAY_DEVICE)

//for ILI9143 edit User_Setup.h of TFT_eSPI library

if (DISPLAY_DEVICE == OLED_I2C_SSD1306) || (DISPLAY_DEVICE == OLED_I2C_SSDSH1106)

//#define DISPLAY_I2C_PIN_RST 16 //comment if not applicable //#define DISPLAY_I2C_ADDR 0x3c

endif //(DISPLAY_DEVICE == OLED_I2C_SSD1306) || (DISPLAY_DEVICE == OLED_I2C_SSDSH1106)

//#define DISPLAY_FLIP_VERTICALY 1 //comment to disable

if (DISPLAY_DEVICE == TFT_SPI_ILI9341_320X240) || (DISPLAY_DEVICE == TFT_SPI_ILI9488_480X320)

//#define DISPLAY_TOUCH_DRIVER XPT2046_SPI //#define DISPLAY_LED_PIN 27 //-1 if none

endif //(DISPLAY_DEVICE == TFT_SPI_ILI9341_320X240) || (DISPLAY_DEVICE == TFT_SPI_ILI9488_480X320)

endif //DISPLAY_DEVICE

//INPUT_DEVICE: allow input //ROTARY_ENCODER 1 //#define INPUT_DEVICE ROTARY_ENCODER

//SENSOR_DEVICE: send info based on defined sensor //DHT11_DEVICE 1 //DHT22_DEVICE 2 //ANALOG_DEVICE 3 //BMP280_DEVICE 4 //BME280_DEVICE 5 //#define SENSOR_DEVICE BMP280_DEVICE

ifdef BUZZER_DEVICE

define ESP3D_BUZZER_PIN 15

endif //BUZZER_DEVICE

ifdef SENSOR_DEVICE

//pin

define ESP3D_SENSOR_PIN 22

define SENSOR_ADDR 0x76

//Conversion coefficient

define SENSOR_CONVERTER(v) v*0.588

//Unit to use, if not applicaple for sensor will use default one //it is used also for the output format //C for Celsius / F for Fahrenheit / V for volt

define SENSOR__UNIT "C"

endif //SENSOR_DEVICE

//PIN_RESET_FEATURE : allow to reset settings by setting low a pin

define PIN_RESET_FEATURE

if defined (PIN_RESET_FEATURE)

define ESP3D_RESET_PIN 2

endif //PIN_RESET_FEATURE

//SD_DEVICE: to access SD Card files directly instead of access by serial using printer Board FW //ESP_SD_NATIVE 1 //esp32 / esp8266 //ESP_SDIO 2 //esp32 only //ESP_SDFAT 3 //esp8266 (same as native) / esp32

define SD_DEVICE ESP_SDIO //ESP_SDFAT

//SDIO mode

define SD_ONE_BIT_MODE true

//SD Device Connection type (default is direct) //ESP_DIRECT_SD //ESP_SHARED_SD

define SD_DEVICE_CONNECTION ESP_DIRECT_SD

//pin if reader has insert detection feature //let -1 or comment if none

define ESP_SD_DETECT_PIN -1

//value expected for ESP_SD_DETECT_PIN

define ESP_SD_DETECT_VALUE 1

//FILESYSTEM_FEATURE: to host some files on flash //ESP_SPIFFS_FILESYSTEM 0 //ESP_FAT_FILESYSTEM 1 //ESP_LITTLEFS_FILESYSTEM 2

define FILESYSTEM_FEATURE ESP_SPIFFS_FILESYSTEM

//Allows to mount /FS and /SD under / for FTP server

define GLOBAL_FILESYSTEM_FEATURE

//FTP_FEATURE : enable FTP feature //FS_ROOT mount all FS //FS_FLASH mount Flash FS //FS_SD mount SD FS //FS_USBDISK mount USB disk FS

define FTP_FEATURE FS_ROOT

//DIRECT_PIN_FEATURE: allow to access pin using ESP201 command

define DIRECT_PIN_FEATURE

//TIMESTAMP_FEATURE: set time system

define TIMESTAMP_FEATURE

//FILESYSTEM_TIMESTAMP_FEATURE: display last write time from Flash files

define FILESYSTEM_TIMESTAMP_FEATURE

//FILESYSTEM_TIMESTAMP_FEATURE:display last write time from SD files //#define SD_TIMESTAMP_FEATURE

//MDNS_FEATURE: this feature allow type the name defined //in web browser by default: http:\esp8266.local and connect //need bonjour protocol on windows

define MDNS_FEATURE

//SSDP_FEATURE: this feature is a discovery protocol, supported on Windows out of the box

define SSDP_FEATURE

//CAPTIVE_PORTAL_FEATURE: In SoftAP redirect all unknow call to main page

define CAPTIVE_PORTAL_FEATURE

//OTA_FEATURE: this feature is arduino update over the air //#define OTA_FEATURE

//WEB_UPDATE_FEATURE: allow to flash fw using web UI

define WEB_UPDATE_FEATURE

//NOTIFICATION_FEATURE : allow to push notifications

define NOTIFICATION_FEATURE

//For ESP8266 Only, it define which secure client to use AXTls or BearSSL //#define USING_AXTLS

//if not using AXTLS need to decrease size of packet to not be OOM

define BEARSSL_MFLN_SIZE 512

define BEARSSL_MFLN_SIZE_FALLBACK 4096

//CAMERA_DEVICE: Enable the support of connected camera //CAMERA_MODEL_CUSTOM 0 //Edit the pins in include/pins.h //CAMERA_MODEL_ESP_EYE 1 //CAMERA_MODEL_M5STACK_PSRAM 2 //CAMERA_MODEL_M5STACK_WIDE 3 //CAMERA_MODEL_AI_THINKER 4 e.g. used by ESP32-CAM //CAMERA_MODEL_WROVER_KIT 5 //#define CAMERA_DEVICE CAMERA_MODEL_AI_THINKER //#define CAMERA_DEVICE_FLIP_VERTICALY //comment to disable //#define CAMERA_DEVICE_FLIP_HORIZONTALY//comment to disable //#define CUSTOM_CAMERA_NAME "ESP32-CAM"

//Allow remote access by enabling cross origin access //check https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS //this should be enabled only in specific cases //like show the camera in web page different than device web server //if you do not know what is that then better left it commented //#define ESP_ACCESS_CONTROL_ALLOW_ORIGIN

//ESP_GCODE_HOST_FEATURE : allow to send GCODE with ack

define ESP_GCODE_HOST_FEATURE

//ESP_AUTOSTART_SCRIPT : to do some actions / send GCODE at start, need ESP_GCODE_HOST_FEATURE enabled //can be a line od several GCODES separated by \n e.g. "M21\nM117 SD mounted\n" //can be a file name, if exists, commands inside will be processed, e.g "/FS:/autostart.esp" //#define ESP_AUTOSTART_SCRIPT "M117 Mouning SD\nM21\n"

//ESP_LUA_INTERPRETER_FEATURE : add lua scripting feature //#define ESP_LUA_INTERPRETER_FEATURE

//Extra features ///////////////////////////////////////////////////////////////////////// /**** *

ifdef ESP_DEBUG_FEATURE

define DEBUG_ESP3D_OUTPUT_PORT 8000

endif //ESP_DEBUG_FEATURE

if defined (DISPLAY_DEVICE) && (DISPLAY_UI_TYPE == UI_TYPE_ADVANCED)

//allows to use [ESP216]SNAP to do screen capture

define DISPLAY_SNAPSHOT_FEATURE

define AUTO_SNAPSHOT_FEATURE

endif //DISPLAY_DEVICE

/**** *

//Serial rx buffer size is 256 but can be extended

define SERIAL_RX_BUFFER_SIZE 512

/**** *

/**** *

define NOTIFICATION_ESP_ONLINE "Hi, %ESP_NAME% is now online at %ESP_IP%"

define ESP_NOTIFICATION_TITLE "ESP3D Notification"

endif //_CONFIGURATION_H

github-actions[bot] commented 2 years ago

Thank your for submiting, please be sure you followed template or your issue may be dismissed. if you deleted the template it is here

luc-github commented 2 years ago

#define SD_DEVICE ESP_SDIO //ESP_SDFAT is incorrect you use SPI pins so you must use spi #define SD_DEVICE ESP_SD_NATIVE is the proper setting

Anion-anion commented 2 years ago

Thanks Luс! it works! I`am Happy)

Anion-anion commented 2 years ago

Luс! how to increase the speed of the sd card. Now an 8 MB file is copied for about 7 minutes - it's a long, long time. Is there a way to speed up writing and reading from the sd card by ftp?

Legsmaniac commented 2 years ago

@Anion-anion https://blog.prusaprinters.org/easy-wireless-printing-with-flashair-sd-cards_8603/

luc-github commented 2 years ago

@Anion-anion the esp32 webserver is not really fast at the moment to speed upload use webdav instead and sdio for SDCard instead of SPI and may be do some tuning : https://github.com/luc-github/ESP3D/issues/491#issuecomment-766157740

But what do you want to do with files uploaded on SDCard connected to ESP32 ? the printer cannot see it, so may I know the purpose to have fast upload on SD ?