[SOLVED] ERROR: Failed to download RAMCode error while flashing STM32L073xZ

  • [SOLVED] ERROR: Failed to download RAMCode error while flashing STM32L073xZ

    Hi,

    I am using Segger JLink Base version with JLink software V6.32D. I am trying to flash board AcSip S76S, its an SOC containing STM32L073RZ (192K flash + 20K RAM) controller with Semtech LoRa modem. I can connect to target, executed few register reads and writes to allow disable read out protection, but I am not able to access internal RAM either through command "Read 32bit" or if I try to enter programming (blank check, erase or flash). I am executing command through JFlash, below are logs when trying to read internal RAM through command "Read 32bit":

    Connecting ...
    - Connecting via USB to J-Link with SN 58006798
    - Target interface speed: 1334 kHz (Fixed)
    - VTarget = 4.995V
    - Executing init sequence ...
    - Executing Reset (0, 0 ms)
    - Executing Write 32bit (0x4002200C, 0x89ABCDEF)
    - Executing Write 32bit (0x4002200C, 0x02030405)
    - Executing Write 32bit (0x40022014, 0xFBEAD9C8)
    - Executing Write 32bit (0x40022014, 0x24252627)
    - Executing Write 32bit (0x40022018, 0x00000F00)
    - Executing Delay (1 ms)
    - Executing Write 32bit (0x1FF80000, 0xFF5500AA)
    - Executing Delay (1 ms)
    - Executing Delay (100 ms)
    - Executing Delay (100 ms)
    - Executing Write 32bit (0x40022004, 0x00040000)
    - Executing Delay (100 ms)
    - Executing Read 32bit (0x20000000)
    - ERROR: Could not read target memory
    - ERROR: Failed to connect.
    Could not perform custom init sequence.

    And below are logs when I try to do blank check:

    - Connecting via USB to J-Link with SN 58006798
    - Target interface speed: 1334 kHz (Fixed)
    - VTarget = 4.917V
    - Executing init sequence ...
    - Executing Reset (0, 0 ms)
    - Executing Write 32bit (0x4002200C, 0x89ABCDEF)
    - Executing Write 32bit (0x4002200C, 0x02030405)
    - Executing Write 32bit (0x40022014, 0xFBEAD9C8)
    - Executing Write 32bit (0x40022014, 0x24252627)
    - Executing Write 32bit (0x40022018, 0x00000F00)
    - Executing Delay (1 ms)
    - Executing Write 32bit (0x1FF80000, 0xFF5500AA)
    - Executing Delay (1 ms)
    - Executing Delay (100 ms)
    - Executing Delay (100 ms)
    - Executing Write 32bit (0x40022004, 0x00040000)
    - Executing Delay (100 ms)
    - Initialized successfully
    - Target interface speed: 1334 kHz (Fixed)
    - J-Link found 1 JTAG device. Core ID: 0x0BC11477 (None)
    - Connected successfully
    Blank checking target ...
    - 1542 of 1542 sectors selected, 2 ranges, 0x8000000 - 0x802FFFF, 0x8080000 - 0x80817FF
    - Start of preparing flash programming
    - ERROR: Failed to download RAMCode.
    - ERROR: Failed to prepare for programming.
    Failed to download RAMCode!
    - End of preparing flash programming
    - ERROR: Failed to check blank target
    Disconnecting ...

    Attaching .JFlash for reference. This is my first time programming SOC based STM32L0 controller. Let me know if I am missing something.

    Thanks,
    Harsha
    Files
  • Hello,

    Thank you for your inquiry.
    For the STM32 series devices we offer example JFlash projects for locking and unlocking this devices: wiki.segger.com/STM32
    Your project seems to differ in the init sequence.
    One thing we noticed from your logs is that VTref is nearly 5 V. According to the ST user guide the L07x series has a operating voltage of 1.8-3.6 V.
    If you supply more than that it might destroy the device or lead to unpredictable behaviour.
    Are you certain that voltage is correct? Keep in mind that J-Link will use the voltage level for his signals which he gets as reference from VTref. So J-Link will currently drive the SoC with 5 V as well.

    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.
  • Hi,

    Thanks for the reply. I created the init sequence taking the example from wiki.segger.com/STM32.

    To this sequence I added additional command to set watchdog to software in FLASH_OPTR register. AcSip module is powered by USB, only SWD lines of JTAG are connected to target board. JTAG pins 1 and 19 are shorted to simulate VTref. Target power supply is set VTGT in Project settings -> Production -> Power source, I will change this to 'NONE' and try again.

    Regards,
    Harsha
  • Hi Nino,

    Thanks for the tip. VTref was indeed the problem, from AcSip module I pulled a 3.3V signal and connected to pin 1 of Jlink and everything went fine (Project settings -> Production -> Power source = VTGT). Please close the thread.

    Regards,
    Harsha
  • Hi Harsha,

    Great to hear that you are up and running again.
    We will close this thread 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.