Page 1 of 1

How to create a FAT error for testing?

Posted: Tue Jun 13, 2023 4:06 pm
by while(1);
I want to find out how our system responds when a FAT error occurs during the FAT initialization.

Is there a function or method for killing the FAT file system so that on power up or reboot the initialization process fails?

I tried just opening a file for writing and continuously writing data with no close. This doesn't seem to break things.

I am using IDF 4.4.4 with Arduino.

Thanks,

Mike.

Re: How to create a FAT error for testing?

Posted: Tue Jun 13, 2023 9:47 pm
by lbernstone
You can use esptool to target "damage" at a specific spot in the filesystem. For example, using the default fat partition scheme:

Code: Select all

./esptool.py erase_region 0x29000 8
This will clear (0xFF) the first 8 bytes of the partition.

Code: Select all

dd if=/dev/zero of=zeros bs=1 count=8
./esptool.py write_flash 0x29000 zeros
Is the same effect, but with zeros.

Re: How to create a FAT error for testing?

Posted: Wed Jun 14, 2023 2:27 am
by ESP_Sprite
lbernstone wrote:
Tue Jun 13, 2023 9:47 pm
You can use esptool to target "damage" at a specific spot in the filesystem. For example, using the default fat partition scheme:

Code: Select all

./esptool.py erase_region 0x29000 8
This will clear (0xFF) the first 8 bytes of the partition.
Note that this likely actually erases 4096 bytes, as that is the minimum quantity the flash chip allows you to erase.