bdring / FluidNC

The next generation of motion control firmware
Other
1.57k stars 379 forks source link

Problem: SD Card not work. #736

Closed zamby closed 8 months ago

zamby commented 1 year ago

Controller Board

WEMOS ESP32 LOLIN

Machine Description

I am only testwith board ESP32.

Input Circuits

No response

Configuration file

name: "ESP32 Dev Controller V4"
board: "ESP32 Dev Controller V4"

stepping:
  engine: RMT
  idle_ms: 250
  dir_delay_us: 1
  pulse_us: 2
  disable_delay_us: 0

axes:
  shared_stepper_disable_pin: gpio.13:low

  x:
    steps_per_mm: 40
    max_rate_mm_per_min: 500
    acceleration_mm_per_sec2: 5
    max_travel_mm: 1000
    homing:
      cycle: 2
      mpos_mm: 10
      positive_direction: false

    motor0:
      limit_all_pin: gpio.17:low:pu
      stepstick:
        direction_pin: gpio.14
        step_pin: gpio.12
    motor1:
      null_motor:

  y:
    steps_per_mm: 800
    max_rate_mm_per_min: 2000
    acceleration_mm_per_sec2: 25
    max_travel_mm: 1000
    homing:
      cycle: 2
      mpos_mm: 10
      positive_direction: false

    motor0:
      limit_all_pin: gpio.4:low:pu
      stepstick:
        direction_pin: gpio.15
        step_pin: gpio.26
    motor1:
      null_motor:

  z:
    steps_per_mm: 800
    max_rate_mm_per_min: 2000
    acceleration_mm_per_sec2: 25
    max_travel_mm: 1000
    homing:
      cycle: 1
      mpos_mm: 10
      positive_direction: true

    motor0:
      limit_all_pin: gpio.16:low:pu
      stepstick:
        direction_pin: gpio.33
        step_pin: gpio.27
    motor1:
      null_motor:

spi:
  miso_pin: gpio.19
  mosi_pin: gpio.23
  sck_pin: gpio.18

sdcard:
  cs_pin: gpio.5
  card_detect_pin: NO_PIN

coolant:
  flood_pin: gpio.25
  mist_pin:  gpio.21

probe:
  pin: gpio.32:low:pu

PWM:
  pwm_hz: 5000
  output_pin: gpio.2
  enable_pin: gpio.22
  direction_pin: NO_PIN
  disable_with_s0: false
  s0_with_disable: true
  spinup_ms: 0
  spindown_ms: 0
  tool_num: 0
  speed_map: 0=0% 10000=100%

Startup Messages

[MSG:INFO: FluidNC v3.6.4]
[MSG:INFO: Compiled with ESP32 SDK:v4.4.1-1-gb8050b365e]
[MSG:INFO: Local filesystem type is spiffs]
[MSG:INFO: Configuration file:config.yaml]
[MSG:INFO: Machine ESP32 Dev Controller V4]
[MSG:INFO: Board ESP32 Dev Controller V4]
[MSG:INFO: SPI SCK:gpio.18 MOSI:gpio.23 MISO:gpio.19]
[MSG:INFO: SD Card cs_pin:gpio.5 detect:NO_PIN]
[MSG:INFO: Stepping:RMT Pulse:2us Dsbl Delay:0us Dir Delay:1us Idle Delay:250ms]
[MSG:INFO: Axis count 3]
[MSG:INFO: Shared stepper disable gpio.13:low]
[MSG:INFO: Axis X (10.000,1010.000)]
[MSG:INFO:   Motor0]
[MSG:INFO:     stepstick Step:gpio.12 Dir:gpio.14 Disable:NO_PIN]
[MSG:INFO:  X All Limit gpio.17:low:pu]
[MSG:INFO:   Motor1]
[MSG:INFO: Axis Y (10.000,1010.000)]
[MSG:INFO:   Motor0]
[MSG:INFO:     stepstick Step:gpio.26 Dir:gpio.15 Disable:NO_PIN]
[MSG:INFO:  Y All Limit gpio.4:low:pu]
[MSG:INFO:   Motor1]
[MSG:INFO: Axis Z (-990.000,10.000)]
[MSG:INFO:   Motor0]
[MSG:INFO:     stepstick Step:gpio.27 Dir:gpio.33 Disable:NO_PIN]
[MSG:INFO:  Z All Limit gpio.16:low:pu]
[MSG:INFO:   Motor1]
[MSG:INFO: Kinematic system: Cartesian]
[MSG:INFO: PWM Spindle Ena:gpio.22 Out:gpio.2 Dir:NO_PIN Freq:5000Hz Period:8191]
[MSG:INFO: Using spindle PWM]
[MSG:INFO: Flood coolant gpio.25]
[MSG:INFO: Mist coolant gpio.21]
[MSG:INFO: Probe Pin: gpio.32:low:pu]
[MSG:INFO: STA SSID is not set]
[MSG:INFO: AP SSID FluidNC IP 192.168.0.1 mask 255.255.255.0 channel 1]
[MSG:INFO: AP started]
[MSG:INFO: WiFi on]
[MSG:INFO: Captive Portal Started]
[MSG:INFO: HTTP started on port 80]
[MSG:INFO: Telnet started on port 23]

Grbl 3.6 [FluidNC v3.6.4 (wifi) '$' for help]
[MSG:INFO: '$H'|'$X' to unlock]
E (20073) sdmmc_sd: sdmmc_check_scr: send_scr returned 0x108
[MSG:ERR: sdmmc_card_init failed code 0x108]
No SD card
error:60
E (27021) sdmmc_io: sdmmc_io_reset: unexpected return: 0x109
[MSG:ERR: sdmmc_card_init failed code 0x109]
No SD card
error:60
E (31181) sdmmc_io: sdmmc_io_reset: unexpected return: 0x109
[MSG:ERR: sdmmc_card_init failed code 0x109]
No SD card
error:60
[MSG:ERR: sdmmc_card_init failed code 0x107]
No SD card
error:60
[MSG:ERR: sdmmc_card_init failed code 0x107]
No SD card
error:60

User Interface Software

No response

What happened?

I configured a LOLIN ESP32 board with the SdCard (Micro SD TF Card Memory Shield Module SPI Micro SD Adapter) From Web interface I only see NO SDCARD, or from terminal: [MSG:ERR: sdmmc_card_init failed code 0x107]

I tested the SD card with the standard ESP examples and it works fine. Am I doing something wrong?

Thanks.

Other Information

No response

bdring commented 1 year ago

Are the pin numbers correctly connected to the SD card?

MitchBradley commented 1 year ago

Please provide a pointer to "the standard ESP examples" so we know exactly what you mean, along with any extra SDK configuration files that you used, and information about the compilation environment that you used with those examples.

zamby commented 1 year ago

Arduino test:

/** This program tests the SD card module is working */
#include <Arduino.h>
#include <SPI.h>
#include <SD.h>

/** The clock select pin for the SD card module */
#define CS_PIN 5

void setup() {

  // Initialize the Serial (it'll tell us if the program runned correctly)
  Serial.begin(115200);
  while (!Serial) { }

  // Check the module is connected
  if (!SD.begin(CS_PIN)) {
    Serial.println("Error, SD Initialization Failed");
    return;
  }

  File testFile = SD.open("/SDTest.txt", FILE_WRITE);
  if (testFile) {
    testFile.println("Hello ESP32 SD");
    testFile.close();
    Serial.println("Success, data written to SDTest.txt");
  } else {
    Serial.println("Error, couldn't not open SDTest.txt");
  }
}

// Do nothing, sd card operations run on setup()
void loop() {}

Serial Debug

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:1 load:0x3fff0018,len:4 load:0x3fff001c,len:1044 load:0x40078000,len:10124 load:0x40080400,len:5856 entry 0x400806a8 Success, data written to SDTest.txt

It's Work!

msg170025511-62917

Reinstall FluidNC

install e load config.yaml

> install-wifi.bat
> install-fs.bat

Select a COM port 0: COM1 (\Device\Serial0) 1: COM7 (\Device\Silabser0) Choice: 1 FluidNC v1.2.0 using COM7 Exit: Ctrl-C, Ctrl-Q or Ctrl-], Clear screen: CTRL-W Upload: Ctrl-U, Reset ESP32: Ctrl-R, Send Override: Ctrl-O FluidNC filename [config.yaml]: XModem Upload C:\Users\zamby\Documents\config.yaml config.yaml $Xmodem/Receive=config.yaml [MSG:INFO: Received 1759 bytes to file /spiffs/config.yaml] ok $Config/Filename=config.yaml ok

reboot...

FluidNC v1.2.0 using COM7 Exit: Ctrl-C, Ctrl-Q or Ctrl-], Clear screen: CTRL-W Upload: Ctrl-U, Reset ESP32: Ctrl-R, Send Override: Ctrl-O $Alarm/Disable [MSG:INFO: Caution: Unlocked] ok $SD/Status E (579883) sdmmc_sd: sdmmc_init_sd_if_cond: send_if_cond (1) returned 0x108 [MSG:ERR: sdmmc_card_init failed code 0x108] No SD card error:60 ------------------------ REMOVE CARD $SD/Status
[MSG:ERR: sdmmc_card_init failed code 0x107] No SD card error:60 ------------------------ INSERT CARD $SD/Status E (607094) sdmmc_sd: sdmmc_init_sd_if_cond: send_if_cond (1) returned 0x108 [MSG:ERR: sdmmc_card_init failed code 0x108] No SD card error:60

Not Working.

MitchBradley commented 1 year ago

What size is the card, and is it SD or MMC?

zamby commented 1 year ago

photo1670272668

Both SD 1GB and 16GB not working.

MitchBradley commented 1 year ago

I ordered one of those adapter cards. When it arrives I will look into the problem.

zamby commented 1 year ago

Oh thanks. I didn't want you to spend money!

MitchBradley commented 1 year ago

I ordered it some time ago. My time is much more valuable than the cost of the adapter card. Did you want me to spend that instead?

FlashMiks commented 1 year ago

2022-12-09-15-23-01-840~01 This is mod will work with this SD adapter. I think it is becouse too hight frequency SPI in new builds. I connect directly without buffer chip and 3.3 voltage regulator.

Alpusa commented 1 year ago

2022-12-09-15-23-01-840~01 This is mod will work with this SD adapter. I think it is becouse too hight frequency SPI in new builds. I connect directly without buffer chip and 3.3 voltage regulator.

You can also power VCC of the SD adapter using VIN or 5+.