Tool/software:
Currently on the AM62A TI EVM, we have a OSPI Serial NAND Flash from Winbond.
The flash is: W35N01JWTBAG
Let us understand how the BBM is done with respect to some specific registers.
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software:
Currently on the AM62A TI EVM, we have a OSPI Serial NAND Flash from Winbond.
The flash is: W35N01JWTBAG
Let us understand how the BBM is done with respect to some specific registers.
Understand how and where BBM(bad block management) is implemented in our MCU+ SDK offering: [FAQ] AM62A7: Bad Block Implementation for NAND Flash Parts
For erase API:
I see that the user passes a block number to the function, then the function finds a next good block to erase. For example, if the current block passed is block number 5, and assume a scenario, where the blocks are as follows:
....., 5, 6, 7, 8, 9, 10, ......(Red denoting bad block and Green denoting good block).
Then the erase function will erase block number 7. While erasing block number 7, there are two scenarios:
For write API:
User passes offset and number of bytes to be written to the write function. Based on the two inputs, block number is calculated. Lets suppose the block number is 5, and assume the same scenario as above:
....., 5, 6, 7, 8, 9, 10, ......(Red denoting bad block and Green denoting good block).
On this note, the block to be written will be 7th one. There are two scenariois:
Please note, while inside an erase or a write API, the way we denote a block has gone bad, is by reading the status of the E-Fail and P-Fail registers.
For the flash: W35N01JWTBAG

As far as erase is concerned, the E-FAIL bit is checked.
Please browse through the file content at the following path: C:\ti\mcu_plus_sdk_am62ax_11_01_00_16\source\board\.meta\flash\serialFlash\W35N01JWTBAG.json
Here you would come across two variables/params: "srProgStatus" and "srEraseStatus".
They have values 3 and 2 respectively denoting the bit number. This value matches as what is shown in the datasheet snippet above.
When we do erase operation, Flash_nandOspiCheckEraseStatus is responsible for checking the E-FAIL bit. If it checks and finds out that the E-FAIL bit is 1, then we mark the block as bad.
Similarly, for write/program operation, Flash_nandOspiCheckProgStatus is responsible for checking the P-FAIL bit. If it is set to 1, then we mark the block as bad.