Reply
Posts: 19
Registered: ‎01-10-2016
Accepted Solution

Failed to program flash

I have several custom happy gecko boards that I am trying to flash and debug in Simplicity Studio. I am using a Giant Gecko STK with debug mode set to out, and I have the debug interface connected via the 20 pin header to the happy gecko boards. I have verified that the programming signals have good continuity from the 20 pin header to the happy gecko pins, and I have measured a valid Vcc.

 

In Simplicity Studio, I am able to detect the happy gecko parts using the "Detect" button under "Select Target Part...". When detected, in "Kit Manager" I see all the correct remote MCU information: Name, flash size, unique ID, etc...However, when I try to start a debugger in the IDE, I get:

 

"Failed to program flash

...

Error Text: Flash loader: Unknown

Error code: 131073"

 

and another error box that states: "Connection with device lost. This is likely due to a loss of power or unplugged debug adapter."

 

Another interesting note is that when I am trying to detect the device, I get another pop-up message box stating: "Second debugger connection to the same J-Link detected. J-Link currently uses target interface SWD while current debugger tries to select target interface C2. Should interface be changed?" in which I have tried multiple iterations of yes and no. I have tried forcing the J-link speed to a high, medium, and low freq, and tried switching the STK from serial addressing mode to USB addressing mode. 

 

I did try updating the STK firmware as well, but no luck.

 

Any tips on how to get the program loaded?

 

Posts: 2,081
Registered: ‎10-14-2014

Re: Failed to program flash

Hi rossboss ,
Which pin are you referring to by VCC, if you could provide a picture of your setup, that would be helpful in determining the issue. 

Is this issue 100% happen and you never succeed to debug or flash the target MCU. Do you have a try on another GG STK and HG?

I think the message to suggest switch to C2 is ok because now the J-LINK support both C2 and SWD.

 

We have a knowledge base article that details how to debug an external target with an EFM32 STK. See the link below:
http://community.silabs.com/t5/Simplicity-Studio-and-Software/Using-an-EFM32-Starter-Kit-as-an-exter...

WeiguoLu
Posts: 19
Registered: ‎01-10-2016

Re: Failed to program flash

hello delu, thanks for the response.

 

I called it "VCC" out of habit, but that really means all the power pins into the happy gecko device. I have attached an image of my setup (everything power and programming related). 

 

It is happening 100% of the time. I have tried several different happy gecko target boards but they all act identical. I don't have another Giant Gecko STK, but wouldn't the fact that it is able to detect the part number and chip ID indicate that the communication is fine? If you want you can donate another one to me , I will try it! Robot Happy

 

The C2 message seems like a strange bug, because if I click yes, I then get a message asking me to switch back to SWD, and then C2, and then SWD, and so on.

 

I took a look at your link, but ever since I updated the firmware on my STK, I am no longer able to get the legacy energyAware Commander to detect and connect to my Giant Gecko STK. Using the Simplicity Studio "Kit Manager", I am able to set the Giant Gecko STK to Debug OUT mode (as indicated by the STK's LED).

Posts: 8,078
Registered: ‎08-13-2003

Re: Failed to program flash

 but wouldn't the fact that it is able to detect the part number and chip ID indicate that the communication is fine? 

 

yes, BUT, after that the power consumption goes up (erase).  So, is your power supply able to support the increased power and is the chip decoupled right (no more than 5 mm traces to decoupling caps

erik
Posts: 19
Registered: ‎01-10-2016

Re: Failed to program flash

I've powered with a bench top power supply capable of 2 amps, and yes the coupling capacitors are placed within 5 mm of the chip.

 

Is the fact that the C2/SWD J-Link error message is popping up every 5 seconds an indication of what is wrong? I select one and it tells me to select the other, in an infinite loop? Surely this isn't normal behavior...

Posts: 3,021
Registered: ‎02-07-2002

Re: Failed to program flash

Maybe you should try to disable auto-detection of the target. I seem to remember there was an option for that. But I don't remember exactly how and where. I suggest to search the forum for this.

Posts: 2,081
Registered: ‎10-14-2014

Re: Failed to program flash

Though my wild guess is that the device is not correctly detected with C2 and SWD interface and that is the reason you see it try retry the detection again and again.

But I think you could have a try as vanmierlo suggested.

You could disable the auto detection with below:

1 press the drop down arrow on the right side of "refresh detected hardware".

2. you see "configure device scanning"

3. choose device manager-->TCF Device Discovery.

4. try to choose 'never'.

Denver

 

My views are my own and do not necessarily represent the views of Silicon Labs

WeiguoLu
Posts: 19
Registered: ‎01-10-2016

Re: Failed to program flash

Success! After changing the settings to "never" as you suggested, I am now able to program and debug the happy geckos! Even stepping through code.

 

Although I still had a little bit of trouble. Basically, if I clicked "detect" on device discovery, I could never get it to work, but if I go in and set the part number and interface manually, it would work. Weird

Posts: 17
Registered: ‎07-29-2015

Re: Failed to program flash

I can confirm this problem too, along with the solution.

 

I also can add that I did not had this problem while trying to debug a small (blinker) test program (probably everything happens in less than 5s device detection interval).

Posts: 9
Registered: ‎05-20-2016

Re: Failed to program flash

Hi,

 

I'm trying to program a EFM32PGB100 (on a custom board) using the SWD link from a EDM32WG-STK3800 dev board but keep getting the same error messages. I've disabled "auto refresh menus" and I've set the refresh interval for all devices to "never". However I'm still getting the same error when trying to detect the mcu. To keep the debug connector as small as possible I'm only using the GND, VREF, SWCLK, SWDIO lines (no reset line connected since it was stated that it's optional).

 

Can you please point me in the right direction to debug the problem?

Posts: 28
Registered: ‎11-07-2015

Re: Failed to program flash

@delu

 

Thamks for your solution!

 

But in SSv4 no TCF Device Discovery option group. Where is it?

Best regards,
Danil Borchevkin

Posts: 2,081
Registered: ‎10-14-2014

Re: Failed to program flash

@DanilBorchevkin

I see you create a separate post. If sometimes the programming success sometimes it failed. I guess that is a different issue.

http://community.silabs.com/t5/32-bit-MCU/Problem-with-debug-and-flashing-EFM32G210F128-by-J-Link-on...

WeiguoLu
Highlighted
Posts: 28
Registered: ‎11-07-2015

Re: Failed to program flash

@deluyes, I created the different thread.

 

Thanks!

Best regards,
Danil Borchevkin