Post Go back to editing

Error "The flash loader program reported an error"

Hi support team, 

I use IAR, and i got many board ( all exactly the same ) with sensors control by an ADUCM3029. All cards work very well, but two of them give me an error when i want to flash the code on the board :

"The flash loader program reported an error"

"A fatal error has occurred, the debugger will terminate"

I use a J-Link debugger, and i checked on J-link commander software ( and also manualy)  the voltage of different pin, and the supply  voltage, and all is correct, and the device is identified correctly.

I also tried to erase flash memory, but i didn't solve the problem.

The following line are my error message on IAR worspace :

Tue Aug 01, 2017 16:36:01: Loaded macro file: C:\Program Files (x86)\IAR Systems\Embedded Workbench 7.2\arm\config\flashloader\AnalogDevices\FlashADUCM3029.mac  Tue Aug 01, 2017 16:36:01: JLINK command: ProjectFile = C:\Users\avouaill\Desktop\workspace\Puck_project_debug_Beacon_Juillet_2017\Puck_project\settings\second_test_Debug.jlink, return = 0  Tue Aug 01, 2017 16:36:01: Device "ADUCM3029" selected.  Tue Aug 01, 2017 16:36:01: DLL version: V6.10c, compiled Sep 28 2016 18:45:15  Tue Aug 01, 2017 16:36:01: Firmware: J-Link Lite-ADI Rev.1 compiled Jan  7 2013 17:58:04  Tue Aug 01, 2017 16:36:01: Selecting SWD as current target interface.  Tue Aug 01, 2017 16:36:01: JTAG speed is initially set to: 1000 kHz  Tue Aug 01, 2017 16:36:01: Found SWD-DP with ID 0x2BA01477  Tue Aug 01, 2017 16:36:01: AP-IDR: 0x24770011, Type: AHB-AP  Tue Aug 01, 2017 16:36:01: Found Cortex-M3 r2p1, Little endian.  Tue Aug 01, 2017 16:36:01: FPUnit: 2 code (BP) slots and 0 literal slots  Tue Aug 01, 2017 16:36:01: CoreSight components:  Tue Aug 01, 2017 16:36:01: ROMTbl 0 @ E00FF000  Tue Aug 01, 2017 16:36:01: ROMTbl 0 [0]: FFF0F000, CID: B105E00D, PID: 000BB000 SCS  Tue Aug 01, 2017 16:36:01: ROMTbl 0 [1]: FFF02000, CID: B105E00D, PID: 003BB002 DWT  Tue Aug 01, 2017 16:36:01: ROMTbl 0 [2]: FFF03000, CID: B105E00D, PID: 002BB003 FPB  Tue Aug 01, 2017 16:36:01: Hardware reset with strategy 3 was performed  Tue Aug 01, 2017 16:36:01: Initial reset was performed  Tue Aug 01, 2017 16:36:02: -I- execUserFlashInit!  Tue Aug 01, 2017 16:36:02: 904 bytes downloaded (18.78 Kbytes/sec)  Tue Aug 01, 2017 16:36:02: Loaded debugee: C:\Program Files (x86)\IAR Systems\Embedded Workbench 7.2\arm\config\flashloader\AnalogDevices\FlashADUCM3029.out  Tue Aug 01, 2017 16:36:02: Target reset  Tue Aug 01, 2017 16:36:02: Unloaded macro file: C:\Program Files (x86)\IAR Systems\Embedded Workbench 7.2\arm\config\flashloader\AnalogDevices\FlashADUCM3029.mac  Tue Aug 01, 2017 16:36:02: The flash loader program reported an error. 

Any idea let me know,

Best regards,

Florent

Top Replies

  • Hi ,

    Is it the first time that you tried to download the code on these two boards?

    How did you tried to do the mass erase? Via IAR, right?

    Try to open the the J-Link Control Panel by clicking the icon below,. The icon appears when a Jlink session is opened (e.g. from IAR).

    Check that the device and the voltage are properly detected by the JLink as shown 

    If it is not recognized properly, please send us the information on the Log tab of the Control panel, as well as a screenshot with the General tab.

    Another thing that you can try is to download your code using the UART bootloader (instead of using the Serial Wire).

    You can download the flash programmer here CrossCore Serial Flash Programmer | Analog Devices 

    In order to force the kernel to execute the UART bootloader you need:

    1) Press BOOT button (BMODE shall be zero)

    2) Press RESET button

    3) Release RESET button

    4) Release BOOT button

    I hope this helps,

  • Hi, thanks for your answer.

    In fact I have ten cards that are identical, and I flashed my code on the others ( through IAR ) and it worked very well, however two of these cards make me this problem, and yes i have already flash some code on these and it worked, but not now.

    I tried to erase Flash memory through J-Link commander, but i can't unlock Kinetis, so i can't erase flash. 

    I checked the J-link control panel and all is correct ( at least same configuration that the other card, and good supply voltage) : 

    I still believe that it is and hardware problem, but i quickly checked pin's connection solder, and they work.

    Best regards,

    Florent

  • Hi,

    two quick things:

    • is 3.7 the voltage you want?
    • the communication interface should be Serial Wire instead JTAG. You can try to change it from the project options and erase the part again.

    The method @moreseg suggested to erase the memory is a bit different, it doesn't require a jlink device, so maybe if you program a while(1) program through this, the part can be recovered.

    Best regards.

  • Hi, thanks for your help.

    Yes 3.7 is the correct voltage, and i tried with a SW interface connection and i had the same problem. 

    I also tried to program a while(1) program and it doesn't work. I still believe that the problem came from the hardware device, because my method work effectively with the other boards. Nevertheless, i didn't find any mistakes on my board when i checked the different pin's voltage.

    Best regards,

    Florent

  • Hi,

    ok, let's see some things on the hardware side.

    • Can you measure the voltage on pin Vldo_out (pin 12)? at least with two decimal digits of resolution.
    • You also can try to capture with the oscilloscope this voltage in order to see some variations.
    • Can you measure the voltage on pin SYS_HWRST (pin 25)?
    • Could you measure the current consumption of the MCU? try to keep GPIO floating and the JLINK disconnected in all those measures.

    and now from the programmer, connect the JLINK programmer and go to C:\Program Files (x86)\IAR Systems\Embedded Workbench 7.5\arm\bin\jlink.exe. This is a command line interface to the programmer. You have to type (underlined in red in the picture):

    • "connect"
    • select the part, in your case "ADUcM3029"
    • select the interface to the programmer: "S" for Serial Wire
    • and speed, for instance "1000"

    In the core and the programmer interface is ok, the SWD-DP and the core should be identified (marked in blue).

    is this your case?

    Apart from that, did you configure CRC correctly on the linker tab on IAR? You can check it as shown here: IAR CRC configuration 

    When you tried to download the while(1) program, did you use the serial flash programmer?

    Best regards.

  • Hi,

    Thanks for these measures, it's interesting. It seems the programming environment is ok, the hardware is ok and the programmer is ok.

    We can try a quick trick I've used from time to time: connect via jlink command line as before, and write "r" (reset), then I came back to IAR and download/erase memory. Let's see if it works.

    If the command line recognizes the MCU, it will be really useful, we can extract information from there, for instance:

    • write "h" (hold)
      • note the PC value. It shows where the MCU is executing instructions. Then, you can go to IAR and search into the disassembly window this address.
      • note the IPSR value. It will say if there was an exception (maybe the most useful and easy thing will be a screenshot).
    • testing the memory:
      • write "mem32 0x800,1" (read 1 32-bits word) it will read a word from the flash memory.
      • write "mem32 0x20000000,1" it will read a word from the first bank of SRAM.
      • write "w4 0x20000300, 2" (write a word) it will write a value into SRAM. What we expect is a correct access to SRAM (read and write) and Flash (read).

    Let me know the result of these experiments.

    Best regards.

  • Hi,

    First of all, my J-Link commander window is exactly the same than yours, so the problem is not here because J-Link recognize my device. I also have the same CRC configuration than you.

    When i download the while(1) i used the the serial flash programmer indeed.

    On the hardware side, i tested what you said :

    - I measured the voltage on VIdo_out, and there is the same voltage than the board which work ( 1.20 V), but i didn't see any variations.

    - The voltage on SYS_HWRST is also the same that the boards which work.

    - I didn't have the time to try the current measurement but i will test it as soon as possible.

    I tried to compare the defective board voltage to the boards which work, i didn't find any difference. So it might be a memory problem.

    Thanks a lot for your help.

    Regards,

    Florent. 

  • Hi,

    I followed the different step that you told me. So I connect my device to J-link as usually and I reset the device, and then i erase the flash memory through IAR and it work effectively. Then I typed the different command that you gave me. Here is the result : 

    • First step :

    I can't access to the disassembly window as you suggested, because I am not able to enter in debug mode due to my error. 

     

    • Second step :

    What can I deduce from these results? 

    Again thank for your help, best regards,

    Florent

  • Hi ,

    if you erased the flash memory, do you get the same error when you try to program? Have you done a power cycle after erasing?

    PC address is 0x1..., this is not Flash, it's instruction SRAM. I assume you don't want to execute from SRAM but from Flash, doesn't it?. The error when you read 0x800 is consistent with the previous screenshot: you can't read from Flash. The flash memory is locked somehow. Now, we know what's the problem and we have to discover why. This typically can occurs due to a CRC error.

    I think it should work after erasing and power cycling, maybe you can try to program a while(1) after that. If it continues showing the flash error when programming, we can try this from the command line:

    1. we can read the Flash controller status register (figure 8-21 http://www.analog.com/media/en/dsp-documentation/processor-manuals/ADuCM302x-mixed-signal-control-processor-hardware-reference.pdf , address 0x40018000), Signature (0x4001802C) and ECC status (0x40018048). The way to do that is the same as before: mem32 0x400180.., 1.
    2. Read the position of the CRC for the user code (mem32 0x7FC, 1). It should match to the IAR generated checksum after linking (see build tab in IAR after rebuilding).
    3. I hope this could give us a clue: if there is some command fail, it's sleeping, a ECC error, a sign error, etc. and taking some actions.
    4. And if we don't know how to continue, we could try a mass erase (page 8-26)
      1. Write the USERKEY in FLCC_KEY (0x40018020).
      2. Write 7 in FLCC_CMD to erase the flash memory.
      3. Read status again to check the operation it's ok.
      4. Reset.

    Best regards.

  • Hi, 

    I finally found a solution to my problem. The flash memory was wrongly erased. I did it correctly this time and then i did 'nrh' command and it work, i am now able to flash program on my board.

    Many thanks for all your help, it was really usefull.

    Best regards,

    Florent