Skip to content

ExFat VolumeBegin hangs when SD card is full #535

@swanah

Description

@swanah

I am using SDFat on a Teensy board.

When initialising a SdExFat instance using

sd.cardBegin(SDIO_CONFIG);
sd.volumeBegin();

while a SD card without empty clusters is inserted , the code hangs in volumeBegin.

Checking deeper, it seems that there is an infinite loop in ExFatPartition::bitmapFind

Exmaple code (also available in my example repo

#define DISABLE_FS_H_WARNING
#include "Arduino.h"
#include "SdFat.h"

void setup() {

    Serial.begin(115200);
    while (not Serial) ;
    Serial.println("start");

    auto sd = SdExFat{};
    if (not sd.cardBegin(SdioConfig(FIFO_SDIO))) {
        sd.initErrorHalt(&Serial);
    }
    Serial.println("card begin success");
    if (not sd.volumeBegin()) {
        sd.initErrorHalt(&Serial);
    }
    Serial.println("volume begin success");
    if (sd.fatType() != FAT_TYPE_EXFAT) {
        Serial.println("sd card not exfat");
    }

    Serial.println("end");
}

void loop() {}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions