Do we need bad block management, and if so is there something in the API for it?

chris.f.rice
Posts: 7
Joined: Tue Jan 23, 2024 4:50 pm

Do we need bad block management, and if so is there something in the API for it?

Postby chris.f.rice » Sun Feb 18, 2024 3:17 pm

We are using a ESP-32 dev kit (ESP32-C6-DevKitC-1), and using the partitions API to read and write to FLASH, and it works well.

It's been a while since I've written code for nonvolatile FLASH... I seem to recall the need for a mechanism called bad block management, in which you scan for blocks that go bad over time, and mark them as "out of service" and skip past them going forward. Kind of a pain...

Is this necessary for the ESP32-C6-DevKitC-1 using the partitions API? Or (hopefully) has either the tech advanced and this isn't necessary, or does the ESP-IDF framework manage this somehow?

Thank you.

MicroController
Posts: 1707
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Do we need bad block management, and if so is there something in the API for it?

Postby MicroController » Sun Feb 18, 2024 8:29 pm

We use wear levelling so that we don't have to do bad block management ;-)

If you employ wear levelling but still expect to use significantly more than the typically specified ~1e5 writes to a single sector you may want to a) look into other storage than the internal flash, or b) actually come up with an error correction and bad block management system. Haven't seen anyone (have the need to) do this yet though.

chris.f.rice
Posts: 7
Joined: Tue Jan 23, 2024 4:50 pm

Re: Do we need bad block management, and if so is there something in the API for it?

Postby chris.f.rice » Mon Feb 19, 2024 12:17 am

Oh, great... no we are implementing a circular log over a span of blocks using the Partitions API, which will be sort of naturally wear-leveled. So I'm glad to hear that that eliminates the need for bad block management. I thought I remembered that the bad blocks could appear over time, and was a different mechanism than the 1e5 wearout. In fact I found an old article:

https://micron.com/-/media/client/globa ... _flash.pdf

that says NAND flash *ships* with some bad blocks, so you need a handling mechanism starting from day 1. But this should not be the case for us? If we wear level we are okay?

Thanks very much.

ESP_Sprite
Posts: 9730
Joined: Thu Nov 26, 2015 4:08 am

Re: Do we need bad block management, and if so is there something in the API for it?

Postby ESP_Sprite » Mon Feb 19, 2024 3:09 am

chris.f.rice wrote:
Mon Feb 19, 2024 12:17 am
that says NAND flash *ships* with some bad blocks, so you need a handling mechanism starting from day 1. But this should not be the case for us? If we wear level we are okay?
ESP32 generally uses NOR flash, not NAND flash.

Who is online

Users browsing this forum: Michael_mhr and 113 guests