ST STM32F105RB JLink.exe Programming Error

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

  • ST STM32F105RB JLink.exe Programming Error

    Hi,

    I have not been able to successfully program the FLASH on a STM32F105RB (128kB FLASH) using JLink.exe. The load appears to complete ok, but the part fails validation.

    If I read the FLASH memory after programming, sections are written but others are left in their erased states. For example:
    address 0x8000000 to 0x80003FF blank
    address 0x8000400 to 0x80007FF programmed
    address 0x8000800 to 0x8000BFF blank
    address 0x8000C00 to 0x8000FFF programmed
    the pattern repeats for the remaining program space.

    I have tried running JLink.exe using a script and direct from the command line and I get the same results. The script is as follows:
    exec device = STM32F105RB
    exec EnableFlashDL
    r
    h
    loadbin "C:\Insite_Production\Programming Files\program_dir\srcFile.bin", 0x8000000
    r
    g
    exit

    Notes:
    I have tried replacing exec device = STM32F105RB with device = STM32F105RB, and I have tried removing the exec EnableFlashDL command.
    I can program the part through the IAR environment.
    If I have programmed the part using IAR and then try using JLink.exe, FLASH is not altered and it verifies at the end of programming.
    I have tried using JLink.exe v4.20 and v4.50
    I have updated the JLINK tool to the latest FW revision as prompted by JLink.exe v4.50
    I have used essentially the same script to successfully program an STM32F103R8.
    I have tried changing the device type to other 128kB FLASH STM32F parts and got similar, unsuccessfull results.

    Any idea what might be wrong?

    Thank You,
    Doug
  • Hi,

    Sounds weird, since for J-Link the R8 and RB devices are almost the same (except a different numbers of sectors).
    The same(!) algorithm is used to flash them.

    Can you provide the bin file you are trying to program?

    Moreover, it sounds like you really have a high-density device connected (STM32F105xC, STM32F105xD, STM32F105xE)
    which have a different sector size than the medium density (STM32F105xB) devices.

    High density: 2 KB sector size
    Medium density: 1 KB sector size
    (See ST user manual)

    It looks like the following happens:
    DLL erases sector 0 (0x08000000 - 0x080003FF)
    Program sector 0
    DLL erases sector 1 (0x08000400 - 0x080007FF)
    Program sector 1
    ...

    But if your device is really a high density device, the following would happen when the DLL performs the actions above:
    erase sector 0 really erases 0x08000000 - 0x080007FF
    programming 0x08000000 - 0x080003FF
    erase sector 1 really erases 0x08000000 - 0x080007FF
    programming 0x08000400 - 0x080007FF

    This would match what you are seeing after programming the flash.
    Did you try by just selecting STM32F105RC for testing?

    So far, we do not see a problem on the DLL side right now, since if your device is a RB device it should definitely have 1 KB sectors and not 2 KB ones.


    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,

    I ran some experiments and have had some success programming the part but it is not perfect. I have gotten these results when setting the device type to the actual microcontroller, the STM32F105RB. Here is what I have found:

    1. If I start with an erased part and use JLink.exe v4.50, the micro programs properly. During the program process the DLL appears to program the 128K of FLASH in 3 passes.

    2. If I start with a corrupt part (program results as outlined in my first post), use JLink.exe v4.50, the micro does not program properly. It appears the DLL is attempting to fill in the portions of FLASH that do not match the .bin file contents.

    3. I have not been successfull using JLink.exe v4.20.

    4. To ensure good programming, I start by loading all FF's to FLASH and then the application .bin file. This of course takes twice as long as loading a single file. Is there a method to force an erase and program of all FLASH sectors instead of just those sectors that are different from the .bin file?

    5. When I try to assign the device in my script file, JLink.exe v4.50 reports the device type STM32F105RB is not recognized and is treated as an unknown command by v4.20 (perhaps this is the cause of the error with v4.20?). With v4.50 a prompt appears to select the microcontroller. I select the STM32F105RB from the menu. There must be something wrong with my script but I don't know what it is. I have tried the following script for device assignment, both give the same results:

    exec device=STM32F105RB
    device STM32F105RB

    6. When I type in "device STM32F105RB" from the JLink.exe v4.50 command line, the device is assigned properly.

    Thank you again for your support.
    Sincerely,
    Doug Young
  • Hi,

    I just tested it with a simple script and selection via script works fine.
    (See attachment)

    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,

    I tried the same experiments and go the same results (no surprises there!) and then found when my original script was being created a couple of blank (or non-printing) characters were being added after the device name. This was the source of my problem.

    Thanks again! I consider this to be sufficiently solved to go forward using JLink.exe.

    Sincerely,
    Doug Young
  • Hi Doug,

    Thanks for letting us know.
    Good to hear that everything is fine now.
    When passing the device name please always make sure that is is terminated correctly by a new line since blanks etc. need to be taken into consideration since they can be part of a valid device name.
    For example: "STM32F103ZG (allow opt. bytes)"


    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.