[SOLVED] Problem while programming STM32F103RG

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

  • [SOLVED] Problem while programming STM32F103RG

    Whenever I try to program my device STM32F103RG with J-Link Plus & J-Flash, it throws the following error:

    Selected Data (0x8000000 - 0x8007823) does not fit into selected flash sectors.

    However, I'm able to program the same data file with ST's own programming utility STM32CubeProgrammer & ST-Link connection.

    The base address 0x8000000 is correct as it is getting selected as default in CubeProgrammer as well.

    Attached image shows my project settings.
    Are there any additional settings I should look after?
    Images
    • J-Flash_STM32F103RG_Project_Settings.png

      73.24 kB, 924×709, viewed 724 times
  • Hello,

    Thank you for your inquiry.
    The memory map in that J-Flash program is simply completely wring, this is why it does not work correctly.
    Attached you can find how it should look like.
    It seems that you are using a J-Link software that is quite old. We recommend using the latest one and create a new J-Flash project using the project wizard.
    Then everything should work as expected.

    One more thing I noticed. The project you set up here selects the "allow opt. bytes" versions of the F103. Do you want to program the option bytes? If not we recommend selecting the non "allow opt bytes" target device otherwise it can happen that you lock your device unintentionally by writing the option bytes.

    Best regards,
    Nino
    Images
    • Capture.PNG

      20.25 kB, 468×496, viewed 422 times
    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 your response!
    I tried with the latest JFlash software, but wasn't able to get rid of the issue.

    It still threw the "Selected Data (0x8000000 - 0x8007823) does not fit into selected flash sectors." error
    even after I ensured that the flash memory sectors being displayed in the Project Settings were same as the image which you had sent.

    However, later I was able to to make it work by choosing 'Production Programming' instead of 'Manual Programming'.
    This struck me that the memory should first be erased before flashing the program.
    So I also tried explicitly erasing the memory and then flashed the program using 'Manual Programming' option, and it worked!

    To conclude, the issue wasn't with the JFlash software version. I was able to me it work with the older version as well.

    Thanks for your support anyway!
  • Hello,

    Great to hear that you are up and running again.
    As you correctly found out the Flash must be erased before programming new data. This is common on most Arm microcontrollers.
    Production Programming mode does all required steps automatically.

    We will consider this thread as solved now.

    Best regards,
    Nino
    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.