Skip to content

Trying to get SD card information using SDFS.info64 function leads to a crash. #8822

@BrokeStudio

Description

@BrokeStudio

Basic Infos

  • This issue complies with the issue POLICY doc.
  • I have read the documentation at readthedocs and the issue is not addressed there.
  • I have tested that the issue is present in current master branch (aka latest git).
  • I have searched the issue tracker for a similar issue.
  • If there is a stack dump, I have decoded it.
  • I have filled out all fields below.

Platform

  • Hardware: ESP-12E
  • Core Version: 3.1.1 (using platform = [email protected] in platformio.ini file)
  • Development Env: Platformio (with -DDEBUG_ESP_CORE -DDEBUG_ESP_PORT=Serial build flags)
  • Operating System: Windows

Settings in IDE

  • Module: Generic ESP8266 Module
  • Flash Mode: qio (I guess)
  • Flash Size: 4MB
  • lwip Variant: v2 Lower Memory
  • Reset Method: nodemcu
  • Flash Frequency: 26MHz
  • CPU Frequency: 80MHz
  • Upload Using: Serial
  • Upload Speed: 921600

Problem Description

Trying to get SD card information using SDFS.info64 function leads to a crash.

It works fine using Core version 3.0.2 (using platform = [email protected] in platformio.ini file).

MCVE Sketch

#include <Arduino.h>
#include <LittleFS.h>
#include <SD.h>

// source: https://github.com/yoursunny/PriUint64/blob/main/src/PriUint64.h
#include "PriUint64.h"

void setup() {
  Serial.begin(115200);
  Serial.println("\nSetup...");

  if (!SD.begin(D0)) {
    Serial.println("Initialization failed!");
  }
  else
  {
    Serial.println("Initialization successful!");
    FSInfo64 sd_info;
    SDFS.info64(sd_info);
    Serial.print(F("File system total space: "));
    Serial.print(PriUint64<DEC>(sd_info.totalBytes));
    Serial.println();

    Serial.print(F("File system used space: "));
    Serial.print(PriUint64<DEC>(sd_info.usedBytes));
    Serial.print(F(" ("));
    Serial.print(PriUint64<DEC>(round((sd_info.usedBytes * 100) / sd_info.totalBytes)));
    Serial.println(F("%)"));

    Serial.print(F("File system free space: "));
    Serial.print(PriUint64<DEC>(sd_info.totalBytes - sd_info.usedBytes));
    Serial.print(F(" ("));
    Serial.print(PriUint64<DEC>(round(((sd_info.totalBytes - sd_info.usedBytes) * 100) / sd_info.totalBytes)));
    Serial.println(F("%)"));
  }
}

void loop() {
}

Debug Messages

SDK:2.2.2-dev(38a443e)/Core:3.1.1=30101000/lwIP:STABLE-2_1_3_RELEASE/glue:1.2-65-g06164fb/BearSSL:b024386

Setup...

Initialization successful!

--------------- CUT HERE FOR EXCEPTION DECODER ---------------

Soft WDT reset

>>>stack>>>

ctx: cont
sp: 3ffffcb0 end: 3fffffd0 offset: 01a0
3ffffe50:  00000040 3ffefab8 00000000 402091c4  
3ffffe60:  00000040 00000000 00000010 00000001  
3ffffe70:  000001c0 3ffef938 00000000 402091a2
3ffffe80:  00000040 00000000 00000010 00000001
3ffffe90:  00000000 00000cc1 3ba5e353 3ffefb20
3ffffea0:  00000200 3ffef8f8 00000dec 40207b9c
3ffffeb0:  00000200 3ffef8f8 00000dec 40207390
3ffffec0:  3ffef8f8 00003181 3ffefb20 00000001
3ffffed0:  3ffef8f8 00000000 3ffefb20 40207a3d  
3ffffee0:  00003180 00000002 3ffefb20 00003182
3ffffef0:  00003181 00000002 3ffef8e8 40207c6f
3fffff00:  3ffef8c4 00198aa2 00042979 402070f9
3fffff10:  3ffef8e8 00000100 3ffe885d 40204204
3fffff20:  3ffe8d00 fffffffc feefeffe 00000000
3fffff30:  00000001 001db420 3fffff60 4020195c
3fffff40:  3fffdad0 0000001a 3ffeeac0 3ffeeb2c
3fffff50:  3fffdad0 3ffeea94 3ffeeac0 402011a8
3fffff60:  6d080000 00000000 003d0900 feefeffe
3fffff70:  00004000 00000000 000003e7 000000ff
3fffff80:  feefeffe feefeffe feefeffe feefeffe
3fffff90:  feefeffe feefeffe feefeffe feefeffe
3fffffa0:  feefeffe feefeffe feefeffe 3ffeeb2c
3fffffb0:  3fffdad0 00000000 3ffeeb18 402032fc  
3fffffc0:  feefeffe feefeffe 3fffdab0 40101431
<<<stack<<<

0x402091c4 in SPIClass::transferBytes(unsigned char const*, unsigned char*, unsigned int) at ??:?
0x402091a2 in SPIClass::transferBytes(unsigned char const*, unsigned char*, unsigned int) at ??:?
0x40207b9c in SdSpiArduinoDriver::receive(unsigned char*, unsigned int) at ??:?
0x40207390 in SharedSpiCard::readData(unsigned char*, unsigned int) at ??:?
0x40207a3d in DedicatedSpiCard::readSectors(unsigned int, unsigned char*, unsigned int) at ??:?
0x40207c6f in FsCache::prepare(unsigned int, unsigned char) at ??:?
0x402070f9 in FatPartition::freeClusterCount() at ??:?
0x40204204 in uart_write at ??:?
0x4020195c in sdfs::SDFSImpl::info64(fs::FSInfo64&) at ??:?
0x402011a8 in setup at ??:?
0x402032fc in loop_wrapper() at core_esp8266_main.cpp:?
0x40101431 in cont_wrapper at ??:?


--------------- CUT HERE FOR EXCEPTION DECODER ---------------

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions