STM32L476QE, verification error after flashing

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • STM32L476QE, verification error after flashing

    Hi,
    We are using Jlink commander in combination with J-Link LITE Cortex-M to flash STM32l476qe device
    STM32L476QE has 512KB (Bank1- 256K, Bank2-256K), Everything was working fine till the binary was limited to 256K, recently it crossed 256K, then at the time of flashing , verification started failing and application goes to hardfault.
    Below is Jlink commander output while flashing

    Source Code

    1. SEGGER J-Link Commander V5.02f ('?' for help)
    2. Compiled Oct 2 2015 20:52:00
    3. Script file read successfully.
    4. Info: Device "STM32L476QE" selected.
    5. DLL version V5.02f, compiled Oct 2 2015 20:51:34
    6. Firmware: J-Link Lite-Cortex-M V8 compiled Aug 20 2015 17:57:19
    7. Hardware: V8.00
    8. S/N: 518110336
    9. Feature(s): GDB
    10. Emulator has Trace capability
    11. VTarget = 3.300V
    12. Info: Found SWD-DP with ID 0x2BA01477
    13. Info: Found SWD-DP with ID 0x2BA01477
    14. Info: Found Cortex-M4 r0p1, Little endian.
    15. Info: FPUnit: 6 code (BP) slots and 2 literal slots
    16. Info: CoreSight components:
    17. Info: ROMTbl 0 @ E00FF000
    18. Info: ROMTbl 0 [0]: FFF0F000, CID: B105E00D, PID: 000BB00C SCS
    19. Info: ROMTbl 0 [1]: FFF02000, CID: B105E00D, PID: 003BB002 DWT
    20. Info: ROMTbl 0 [2]: FFF03000, CID: B105E00D, PID: 002BB003 FPB
    21. Info: ROMTbl 0 [3]: FFF01000, CID: B105E00D, PID: 003BB001 ITM
    22. Info: ROMTbl 0 [4]: FFF41000, CID: B105900D, PID: 000BB9A1 TPIU
    23. Info: ROMTbl 0 [5]: FFF42000, CID: B105900D, PID: 000BB925 ETM
    24. Found 1 JTAG device, Total IRLen = 4:
    25. Cortex-M4 identified.
    26. Target interface speed: 100 kHz
    27. Processing script file...
    28. Firmware: J-Link Lite-Cortex-M V8 compiled Aug 20 2015 17:57:19
    29. Hardware: V8.00
    30. Target interface speed: 2000 kHz
    31. Reset delay: 0 ms
    32. Reset type NORMAL: Resets core & peripherals via SYSRESETREQ & VECTRESET bit.
    33. PC = 080065B0, CycleCnt = 00000000
    34. R0 = 00000000, R1 = 00000000, R2 = 00000000, R3 = 00000000
    35. R4 = 00000000, R5 = 00000000, R6 = 00000000, R7 = 00000000
    36. R8 = 00000000, R9 = 00000000, R10= 00000000, R11= 00000000
    37. R12= 00000000
    38. SP(R13)= 20017FFC, MSP= 20017FFC, PSP= 00000000, R14(LR) = FFFFFFFF
    39. XPSR = 01000000: APSR = nzcvq, EPSR = 01000000, IPSR = 000 (NoException)
    40. CFBP = 00000000, CONTROL = 00, FAULTMASK = 00, BASEPRI = 00, PRIMASK = 00
    41. FPU regs: FPU not enabled / not implemented on connected CPU.
    42. Downloading file [debug/BikeSensor.bin]...
    43. **************************
    44. WARNING: CPU is running at low speed (4026 kHz).
    45. **************************
    46. Info: J-Link: Flash download: Total time needed: 6.847s (Prepare: 0.114s, Compare: 0.103s, Erase: 3.023s, Program: 3.594s, Verify: 0.000s, Restore: 0.010s)
    47. Info: J-Link: Flash download: Restarting flash programming due to program error (possibly skipped erasure of half-way erased sector).
    48. Info: J-Link: Flash download: Skip optimizations disabled for second try.
    49. Error while programming flash: Programming failed.
    50. Loading binary file debug/xxxx.bin
    51. Reading 285336 bytes data from target memory @ 0x08000000.
    52. Verify failed @ address 0x08040000.
    53. Expected 02 read 00
    54. Reset delay: 0 ms
    55. Reset type NORMAL: Resets core & peripherals via SYSRESETREQ & VECTRESET bit.
    56. Script processing completed.
    Display All


    I read 0x800 bytes from flash address start from 0x8040000 which falls in BANK2, it returns all zeros , but i checked actual binary its different at that particular addresses.
    J-Link>mem 0x8040000 0x800
    08040000 = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    08040010 = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    08040020 = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    08040030 = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    08040040 = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    08040050 = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    08040060 = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    08040070 = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    08040080 = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    08040090 = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    080400A0 = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    080400B0 = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    080400C0 = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    080400D0 = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    080400E0 = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    080400F0 = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    08040100 = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    Actual Binary start from 0x8040000
    02 f0 0f 03 03 fa 20 f3 a5 42 48 ea 03 08 19 d2 14 f8 01 2c 52 45 04 f1 ff 39 e9 d1 09 eb 0c 03 9d 42 e5 d8 02 99 03 9a cd f8 20 c0 18 46 01 93 fb f7 8e f9 01 99 dd f8 20 c0 20 28 d8 d1 0c 46 a5 42 e5 d3 4b f8 04 8b 08 9d 04 99 c5 eb 0b 0b 4f ea ab 07 40 46 0f 61 01 f0 2a f8 06 9c 7d 01 24 68 28 1a a0 42 20 f3 34 81 c0 f2 5a 81 20 25 06 9b 05 99 9f 68 b9 42 20 f3 05 81 06 98 05 9a 43 68 9a 42 80 f2 0f 81 9e 1a b4 42 72 dc c7 68 02 2f 20 f0 81 81 03 2f 20 f0 bb 81 01 2f 20 f0 a9 81 07 98 04 99 20 f0 dd fe 14 98 20 27 07 60 .....................
    Can you please help us , what may be the problem? Does JLink commander is not able to flash in Bank2 ?
  • Hi,


    could your provide us with a reproduction project / binary? I will try to reproduce this issue tomorrow.
    Until then: Could the 2nd bank possible be secured (nWRP = 0 or RDP > 0)?

    Best regards,
    Niklas
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • I did some experiment on STM32l476 eval kit
    Controller STM32L476ZG

    Case1: Binary size less than 256K
    Jlink Commander Output
    Device "STM32L476ZG" selected.


    Found SWD-DP with ID 0x2BA01477
    Found SWD-DP with ID 0x2BA01477
    Found Cortex-M4 r0p1, Little endian.
    FPUnit: 6 code (BP) slots and 2 literal slots
    CoreSight components:
    ROMTbl 0 @ E00FF000
    ROMTbl 0 [0]: FFF0F000, CID: B105E00D, PID: 000BB00C SCS
    ROMTbl 0 [1]: FFF02000, CID: B105E00D, PID: 003BB002 DWT
    ROMTbl 0 [2]: FFF03000, CID: B105E00D, PID: 002BB003 FPB
    ROMTbl 0 [3]: FFF01000, CID: B105E00D, PID: 003BB001 ITM
    ROMTbl 0 [4]: FFF41000, CID: B105900D, PID: 000BB9A1 TPIU
    ROMTbl 0 [5]: FFF42000, CID: B105900D, PID: 000BB925 ETM
    Cortex-M4 identified.
    Reset delay: 0 ms
    Reset type NORMAL: Resets core & peripherals via SYSRESETREQ & VECTRESET bit.

    PC = 08023454, CycleCnt = 00000000
    R0 = 00000000, R1 = 00000000, R2 = 00000000, R3 = 00000000
    R4 = 00000000, R5 = 00000000, R6 = 00000000, R7 = 00000000
    R8 = 00000000, R9 = 00000000, R10= 00000000, R11= 00000000
    R12= 00000000
    SP(R13)= 20017FFC, MSP= 20017FFC, PSP= 00000000, R14(LR) = FFFFFFFF
    XPSR = 01000000: APSR = nzcvq, EPSR = 01000000, IPSR = 000 (NoException)
    CFBP = 00000000, CONTROL = 00, FAULTMASK = 00, BASEPRI = 00, PRIMASK = 00
    FPU regs: FPU not enabled / not implemented on connected CPU.

    Downloading file [OpenRTOS_STM32L4_Demo.bin]...
    **************************
    WARNING: CPU is running at low speed (4026 kHz).
    **************************

    J-Link: Flash download: Flash programming performed for 7 ranges (18432 bytes)
    J-Link: Flash download: Total time needed: 3.275s (Prepare: 0.123s, Compare: 2.658s, Erase: 0.204s, Program: 0.252s, Verify: 0.024s, Restore: 0.011s)
    O.K.

    Loading binary file OpenRTOS_STM32L4_Demo.bin
    Reading 261456 bytes data from target memory @ 0x08000000.
    Verify successful.

    Reset delay: 0 ms
    Reset type NORMAL: Resets core & peripherals via SYSRESETREQ & VECTRESET bit.


    Script processing completed.
    Case 2: Binary size more than 256K, Verification fails
    Jlink Commander Output
    Device "STM32L476ZG" selected.


    Found SWD-DP with ID 0x2BA01477
    Found SWD-DP with ID 0x2BA01477
    Found Cortex-M4 r0p1, Little endian.
    FPUnit: 6 code (BP) slots and 2 literal slots
    CoreSight components:
    ROMTbl 0 @ E00FF000
    ROMTbl 0 [0]: FFF0F000, CID: B105E00D, PID: 000BB00C SCS
    ROMTbl 0 [1]: FFF02000, CID: B105E00D, PID: 003BB002 DWT
    ROMTbl 0 [2]: FFF03000, CID: B105E00D, PID: 002BB003 FPB
    ROMTbl 0 [3]: FFF01000, CID: B105E00D, PID: 003BB001 ITM
    ROMTbl 0 [4]: FFF41000, CID: B105900D, PID: 000BB9A1 TPIU
    ROMTbl 0 [5]: FFF42000, CID: B105900D, PID: 000BB925 ETM
    Cortex-M4 identified.
    Reset delay: 0 ms
    Reset type NORMAL: Resets core & peripherals via SYSRESETREQ & VECTRESET bit.

    PC = 08023454, CycleCnt = 00000000
    R0 = 00000000, R1 = 00000000, R2 = 00000000, R3 = 00000000
    R4 = 00000000, R5 = 00000000, R6 = 00000000, R7 = 00000000
    R8 = 00000000, R9 = 00000000, R10= 00000000, R11= 00000000
    R12= 00000000
    SP(R13)= 20017FFC, MSP= 20017FFC, PSP= 00000000, R14(LR) = FFFFFFFF
    XPSR = 01000000: APSR = nzcvq, EPSR = 01000000, IPSR = 000 (NoException)
    CFBP = 00000000, CONTROL = 00, FAULTMASK = 00, BASEPRI = 00, PRIMASK = 00
    FPU regs: FPU not enabled / not implemented on connected CPU.

    Downloading file [OpenRTOS_STM32L4_Demo.bin]...
    **************************
    WARNING: CPU is running at low speed (4027 kHz).
    **************************

    J-Link: Flash download: Flash programming performed for 6 ranges (18432 bytes)
    J-Link: Flash download: Total time needed: 3.246s (Prepare: 0.123s, Compare: 2.676s, Erase: 0.200s, Program: 0.230s, Verify: 0.000s, Restore: 0.014s)

    ****** Error: Programming failed @ address 0x08040198 (block verification error)
    Verification failed @ address 0x08008000
    Error while programming flash: Verify failed.

    Loading binary file OpenRTOS_STM32L4_Demo.bin
    Reading 263856 bytes data from target memory @ 0x08000000.
    Verify failed @ address 0x08040199.
    Expected 02 read 00
    Reset delay: 0 ms
    Reset type NORMAL: Resets core & peripherals via SYSRESETREQ & VECTRESET bit.


    Script processing completed.

    Jlink Version: JLink_V510h
    Command: jlink -device stm32l476ZG -CommanderScript CommandFile.jlink

    CommandFile.jlink file
    f
    Speed 12000
    r
    h
    loadbin xxxx.bin 0x08000000
    verifybin xxxx.bin 0x08000000
    r
    qc
    Files
  • Hi,

    both files work for me with version v5.10h.

    Source Code

    1. Downloading file [C:\Work\Support\2016_Q1\STM32L4_2ndBank_Forum2899\Demo_moreThan256K.bin]...
    2. **************************
    3. WARNING: CPU is running at low speed (4018 kHz).
    4. **************************
    5. J-Link: Flash download: Flash programming performed for 6 ranges (18432 bytes)
    6. J-Link: Flash download: Total time needed: 3.171s (Prepare: 0.079s, Compare: 2.616s, Erase: 0.199s, Program: 0.252s, Verify: 0.015s, Restore: 0.006s)
    7. O.K.
    8. Loading binary file C:\Work\Support\2016_Q1\STM32L4_2ndBank_Forum2899\Demo_moreThan256K.bin
    9. Reading 263856 bytes data from target memory @ 0x08000000.
    10. Verify successful.
    11. Reset delay: 0 ms
    12. Reset type NORMAL: Resets core & peripherals via SYSRESETREQ & VECTRESET bit.
    13. Script processing completed.
    14. Type "connect" to establish a target connection, '?' for help
    Display All


    Could the 2nd bank possible be secured (nWRP = 0 or RDP > 0)?

    Best regards,
    Niklas
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Thanks for help,

    we never touched nWRP = 0 or RDP > 0, and also I read the nWRP it's factory default.


    Flash memory address: 0x1FFF 7800
    Value read from device
    1FFF7800 = AA F8 EF FF
    0xAA: Level 0, read protection not active

    Bank 1 PCROP Start address option bytes
    1FFF7808 = FF FF FF FF

    Bank 1 PCROP End address option bytes
    1FFF7810 = 00 00 00 00

    Bank 1 WRP Area A address option bytes
    1FFF7818 = FF 00 00 00

    Bank 1 WRP Area B address option bytes
    1FFF7820 = FF 00 00 00

    Bank 2 PCROP Start address option bytes
    1FFFF808 = FF FF FF FF

    Bank 2 PCROP End address option bytes
    1FFFF810 = 00 00 00 00

    Bank 2 WRP Area A address option bytes
    1FFFF818 = FF 00 00 00

    Bank 2 WRP Area B address option bytes
    1FFFF820 = FF 00 00 00


    Sorry my fault , can you please check STM32L476QE.bin for STM32l476QE (512KB flash) , please try 2-3 times


    Right now we are stuck and not able to proceed.
    Files
    • STM32L476QE.bin

      (352.56 kB, downloaded 615 times, last: )

    The post was edited 5 times, last by Horaira ().

  • Hi,


    the new files also works fine for me, i did multiple attempts, every single one worked:

    Downloading file [C:\Work\Support\2016_Q1\STM32L4_2ndBank_Forum2899\STM32L476QE.bin]...
    **************************
    WARNING: CPU is running at low speed (4018 kHz).
    **************************

    J-Link: Flash download: Flash programming performed for 2 ranges (243712 bytes)
    J-Link: Flash download: Total time needed: 7.300s (Prepare: 0.075s, Compare: 1.178s, Erase: 2.625s, Program: 3.338s, Verify: 0.076s, Restore: 0.005s)
    O.K.

    Loading binary file C:\Work\Support\2016_Q1\STM32L4_2ndBank_Forum2899\STM32L476QE.bin
    Reading 352560 bytes data from target memory @ 0x08000000.
    Verify successful.

    Reset delay: 0 ms
    Reset type NORMAL: Resets core & peripherals via SYSRESETREQ & VECTRESET bit.

    Script processing completed.



    Type "connect" to establish a target connection, '?' for help


    Downloading file [C:\Work\Support\2016_Q1\STM32L4_2ndBank_Forum2899\STM32L476QE.bin]...
    **************************
    WARNING: CPU is running at low speed (4019 kHz).
    **************************

    J-Link: Flash download: Flash programming performed for 1 range (354304 bytes)
    J-Link: Flash download: Total time needed: 5.238s (Prepare: 0.077s, Compare: 0.185s, Erase: 0.000s, Program: 4.858s, Verify: 0.109s, Restore: 0.006s)
    O.K.

    Loading binary file C:\Work\Support\2016_Q1\STM32L4_2ndBank_Forum2899\STM32L476QE.bin
    Reading 352560 bytes data from target memory @ 0x08000000.
    Verify successful.

    Reset delay: 0 ms
    Reset type NORMAL: Resets core & peripherals via SYSRESETREQ & VECTRESET bit.

    Script processing completed.


    please try 2-3 times

    Does it fail every time for you or "just" every 2nd - 3rd time?

    Best regards,
    Niklas
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.