cancel
Showing results for 
Search instead for 
Did you mean: 

STM32MP131C – SPI-NAND bad blocks at block 0 and DFU flashing fails on brand-new custom board

GaneshKPhytec
Associate II

Hi ST community,

We are bringing up a brand-new custom board based on STM32MP131C (Rev.Y) and are facing an issue while flashing SPI-NAND over USB DFU.

Boot status

  • TF-A (BL2/BL31) boots correctly

  • OP-TEE OS boots and hands off to normal world

  • U-Boot starts normally and detects SPI-NAND

So the full boot chain up to U-Boot looks healthy.

SPI-NAND details

  • Part: GigaDevice GD5F4GM8UExxG

  • Size: 512 MiB

  • Block size: 128 KiB

  • Page size: 2048

  • OOB: 128

Detected correctly by U-Boot.

Issue description

When flashing over USB DFU from U-Boot, erase/write operations fail due to many bad blocks at very low addresses, including block 0.

Example output:
Marking bad block at 0x00000000 (-5)
Skipping bad block at 0x00020000
Skipping bad block at 0x00040000
Skipping bad block at 0x00060000
Limit reached 0x80000 while erasing at offset 0x80000
Error: DFU write error

Because of this, DFU flashing fails consistently.

Are there specific U-Boot or TF-A configurations recommended for SPI-NAND on STM32MP13?
Please find the attached patches which all for the spi-nand configuration done in the yocto (scarthgap). 

Software versions

  • TF-A: v2.10-stm32mp1-r2.0

  • OP-TEE: 4.0.0-dev

  • U-Boot: 2023.10-stm32mp-r.

    Please do let me know if you need more information.

    Thanks & Regards
    Ganesh.K

1 REPLY 1
GaneshKPhytec
Associate II

Hi, Also please find the attached text file having the full log related to flashing over usb and also debug console while flashing the spi-nand.

Thanks & Regards

Ganesh.K