Flash a STM32F407VG with JLink EDU produces Errors

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

  • Flash a STM32F407VG with JLink EDU produces Errors

    Hi

    I would like flash my STM32F407VGT Board, but get Error-messages while flashing.

    My Script (i work under Linux):

    Source Code

    1. /usr/local/bin/JLinkExe << EOF
    2. exec EnableFlashDL
    3. exec Device=STM32F407VG
    4. speed 100
    5. h
    6. loadbin ./project.bin, 0x0000
    7. r
    8. g
    9. exit
    10. EOF


    Error-Messages:

    Brainfuck Source Code

    1. SEGGER J-Link Commander V4.50i ('?' for help)
    2. Compiled Jun 22 2012 19:00:38
    3. DLL version V4.50i, compiled Jun 22 2012 19:00:36
    4. Firmware: J-Link ARM V8 compiled Jul 20 2012 16:33:52
    5. Hardware: V8.00
    6. S/N: 268000082
    7. OEM: SEGGER-EDU
    8. Feature(s): FlashBP
    9. VTarget = 3.254V
    10. Info: TotalIRLen = 9, IRPrint = 0x0011
    11. Info: Found Cortex-M4 r0p1, Little endian.
    12. Info: TPIU fitted.
    13. Info: ETM fitted.
    14. Info: FPUnit: 6 code (BP) slots and 2 literal slots
    15. Found 2 JTAG devices, Total IRLen = 9:
    16. #0 Id: 0x4BA00477, IRLen: 04, IRPrint: 0x1, CoreSight JTAG-DP (ARM)
    17. #1 Id: 0x06413041, IRLen: 05, IRPrint: 0x1, STM32 Boundary Scan
    18. Cortex-M4 identified.
    19. JTAG speed: 100 kHz
    20. J-Link>exec EnableFlashDL
    21. J-Link>exec Device=STM32F407VG
    22. Info: Device "STM32F407VG" selected (1024 KB flash, 128 KB RAM).
    23. J-Link>speed 100
    24. JTAG speed: 100 kHz
    25. J-Link>h
    26. R0 = 00000000, R1 = 00000000, R2 = 00000000, R3 = 00000000
    27. R4 = 00000000, R5 = 00000000, R6 = 00000000, R7 = 00000000
    28. R8 = 00000000, R9 = 00000000, R10= 00000000, R11= 00000000
    29. R12= 00000000, R13= FFFFFFFC, MSP= FFFFFFFC, PSP= 00000000
    30. R14(LR) = FFFFFFFF, R15(PC) = FFFFFFFE
    31. XPSR 01000000, APSR 00000000, EPSR 01000000, IPSR 00000000
    32. CFBP 00010000, CONTROL 00, FAULTMASK 01, BASEPRI 00, PRIMASK 00
    33. FPS0 = 00000000, FPS1 = 00000000, FPS2 = 00000000, FPS3 = 00000000
    34. FPS4 = 00000000, FPS5 = 00000000, FPS6 = 00000000, FPS7 = 00000000
    35. FPS8 = 00000000, FPS9 = 00000000, FPS10= 00000000, FPS11= 00000000
    36. FPS12= 00000000, FPS13= 00000000, FPS14= 00000000, FPS15= 00000000
    37. FPS16= 00000000, FPS17= 00000000, FPS18= 00000000, FPS19= 00000000
    38. FPS20= 00000000, FPS21= 00000000, FPS22= 00000000, FPS23= 00000000
    39. FPS24= 00000000, FPS25= 00000000, FPS26= 00000000, FPS27= 00000000
    40. FPS28= 00000000, FPS29= 00000000, FPS30= 00000000, FPS31= 00000000
    41. FPSCR= 00000000
    42. J-Link>loadbin /home/a239368/personal/Mikrocontroller/Cortex/stm32f4/mikromedia/project.bin, 0x0000
    43. Loading binary file... [/home/a239368/personal/Mikrocontroller/Cortex/stm32f4/mikromedia/project.bin]
    44. Writing bin data into target memory @ 0x00000000.
    45. ****** Error: PC of target system has unexpected value after calculating CRC. (PC = 0x20000054)!
    46. ---------------------------------------------------------------------- Registers -------------------------------------------------------------------------------------
    47. PC = 20000054
    48. Current: R0 = 00000000, R1 = 08000000, R2 = 00004000, R3 = 00000003
    49. R4 = 20000358, R5 = 200003B8, R6 = 000000FF, R7 = 20000147
    50. ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    51. Info: J-Link: Flash download: Flash programming performed for 1 range (0 bytes)
    52. ****** Error: Failed to erase sectors 0 @ address 0x08000000 (erase error)
    53. Info: J-Link: Flash download: Total time needed: 7370.504s (Prepare: 1.692s, Compare: 0.078s, Program: 0.000s, Verify: 7367.605s, Restore: 1.126s)
    54. J-Link>r
    55. Reset delay: 0 ms
    56. Reset type NORMAL: Resets core & peripherals via SYSRESETREQ & VECTRESET bit.
    57. Info: Found Cortex-M4 r0p1, Little endian.
    58. Info: TPIU fitted.
    59. Info: ETM fitted.
    60. Info: FPUnit: 6 code (BP) slots and 2 literal slots
    61. J-Link>g
    62. J-Link>exit
    Display All


    What am i doing wrong ? On other boards with STM32F107, it works well.

    Thanks for any help

    Daniel
  • Hi Daniel,

    We are not aware of any flashing problems with STM32F4 devices in the current version.
    Is the bin file you are downloading a generic application which also runs on an eval board?
    If yes, would it be possible to attach the bin file to your answer?
    Moreover: Have any option bytes of the device been programmed previously?


    Best regards
    Alex
    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.
  • Hi Alex

    Thanks for the answer
    The target board is a mikroe.com/eng/products/view/869/mikromedia-for-stm32-m4/
    Connection is from the JLink-EDU over the ST-Link V2 Adapter (on the mikroe webpage below) to the JTAG-Header (solderd in by me) of the board.

    The binary is the working "Blinky" example from the st.com/internet/evalboard/product/252419.jsp STM32F4Discovery board.
    It's compiled by me, is flashable over the USB-port with the "stlink" utility on Linux, and it runs.

    I can attach the binary this afternoon, when i'am at home.

    But the longer i think the more i'am afraid that i killed my board. The first time when i tried my setup, i connected the board to the JLink-EDU in a wrong way.
    The power regulator went very hot, and i unpluged the hole thing. After changing the setup, the connection seems to be ok. A Cortex-M4 CPU is found by the
    JLink-EDU and i tried a couple of things to flash. After that, i recognised, that the bootloader on the board did not work anymore. I thought its because of my flash-tests, but it's also possible, that i destroyed something with my wrong setup.

    Do i have a change to check the CPU over the JLink-EDU with some commands, to see if its broken or not ?

    Regards,
    Daniel
  • Hi Daniel,

    Do i have a change to check the CPU over the JLink-EDU with some commands, to see if its broken or not ?


    You can perform several checks via J-Link Commander like Go ("g"), Halt ("h"), Step ("s"), ReadMem() WriteMem(), ...
    Just type "?" to get a list of all supported commands.


    Best regards
    Alex
    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.
  • [Solved]Flash a STM32F407VG with JLink EDU produces Errors

    Hi

    I solved the problem for me.

    Solution: I changed to the original ST-LINK/V2 adapter, and this adapter (or better the ST-Link Utility Software) told me
    after the first connect, that the "ReatOut Protection" was set to "Level 1: memory read protection enabled" in the so called "Option Bytes".
    Reset that to "Level 0: no protection", and everything works fine.
    Information: microcodes.info/stm32f4-how-to…-option-bytes-135151.html

    Maybe your software does not cover that, or i didn't find the hint in the error messages or in your documents ?

    Regards,

    Daniel
  • Hi Daniel,

    Maybe your software does not cover that, or i didn't find the hint in the error messages or in your documents ?

    Currently, J-Link indeed does not check for the device security being active since it makes no sense to activate it while still debugging the device...

    Nevertheless, we will add a mechanism for the STM32 devices which also checks the device security at connect and allows a unsecure (if possible depends on the security level).
    This mechanism will be available if the correct device is selected in the debugger / J-Link Commander.


    Best regards
    Alex
    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.