Author Topic: Lost Code After Taking Out Debugger Adapter from Board (STM32F767)  (Read 1496 times)

0 Members and 1 Guest are viewing this topic.

Offline A.ErsozTopic starter

  • Regular Contributor
  • *
  • Posts: 75
  • Country: us
Hello,

I observe my signal after loading to my custom board. When the circuit still has power and taking out the debugger adapter from the board, the code is lost. Interesting thing is that while I keep the debugger adapter connection between PC and board, I do power on and power off; then I can get same signal. Eventually, I lost my signal with disconnection of the debugger adapter. So why is that happen and how can I keep the code in the microprocessor?

Thanks, 
 

Offline lty1993

  • Supporter
  • ****
  • Posts: 37
  • Country: us
    • LTY's Space
Re: Lost Code After Taking Out Debugger Adapter from Board (STM32F767)
« Reply #1 on: December 10, 2018, 10:59:11 am »
Did you link your code with semihosting flag enabled?
 

Offline A.ErsozTopic starter

  • Regular Contributor
  • *
  • Posts: 75
  • Country: us
Re: Lost Code After Taking Out Debugger Adapter from Board (STM32F767)
« Reply #2 on: December 10, 2018, 09:39:15 pm »
Actually, I don't know the semihosting flag. Is It in options of target menu?
 

Offline abraxa

  • Frequent Contributor
  • **
  • Posts: 377
  • Country: de
  • Sigrok associate
Re: Lost Code After Taking Out Debugger Adapter from Board (STM32F767)
« Reply #3 on: December 12, 2018, 09:49:40 pm »
Maybe you're running your program from RAM instead of storing it in flash and executing it from there. You could check the options of the IDE you're using if there's an option you can set - and if there's none, check the linker file and see where the .text segment goes.
 

Offline nick_d

  • Regular Contributor
  • *
  • Posts: 120
Re: Lost Code After Taking Out Debugger Adapter from Board (STM32F767)
« Reply #4 on: December 13, 2018, 11:46:50 am »
 I have had the same problem. I believe it occurs because the JTAG or SWD is in the middle of shifting out a command when the connection is interrupted and a garbage command is received. How this manages to corrupt the Flash is a mystery (such JTAG commands are complex and must be sent in a certain sequence to work), but it does for me. I found that replacing the ribbon cable from debugger to target impacted the issue significantly, the one I was using was worn from thousands of insert/remove cycles and felt quite loose on the mini 10 pin header, so perhaps the order of breaking the connections (clock, data, GND etc) matters. Since I am lazy I did not want to power system up and down just to make it safe to remove debugger. So I found a workaround that if debugger is running when disconnected and not stopped at prompt it is OK. Your mileage may vary.

cheers, Nick
 

Offline ogden

  • Super Contributor
  • ***
  • Posts: 3731
  • Country: lv
Re: Lost Code After Taking Out Debugger Adapter from Board (STM32F767)
« Reply #5 on: December 13, 2018, 12:16:22 pm »
I lost my signal with disconnection of the debugger adapter. So why is that happen and how can I keep the code in the microprocessor?

Did you try to put your code into flash instead of RAM? [kidding]

If you use flash, then code most likely is still there. Cause could be - debugger does proper reset but board itself w/o debugger does not. Startup code may fail for some reason which usually is - insufficient power rail voltage right after power on while startup code kicks in at full speed causing brownout. Check your reset circuit for errors. At the very beginning of init code *before* setting hi-speed clocks add ~0.1 sec delay and see - it helps or not.

Try to power-on your board and after second or so - reset it. Does it run then?
« Last Edit: December 13, 2018, 12:40:24 pm by ogden »
 

Offline ogden

  • Super Contributor
  • ***
  • Posts: 3731
  • Country: lv
Re: Lost Code After Taking Out Debugger Adapter from Board (STM32F767)
« Reply #6 on: December 20, 2018, 01:24:15 pm »
Did you resolve it? If yes then how? What was cause of the problem?
 

Offline A.ErsozTopic starter

  • Regular Contributor
  • *
  • Posts: 75
  • Country: us
Re: Lost Code After Taking Out Debugger Adapter from Board (STM32F767)
« Reply #7 on: February 07, 2019, 04:16:37 pm »
I found a solution with a power shut-down switch. In my previous case, I didn't use it, and I disconnect the power at power supply end. Now, I placed a shut-down switch (SPST DIP Switch) on the power line on my circuit board. When I am done, firstly, I switch off the power with this switch, then I close the power supply. With this way, I keep my codes.

Thank you guys for your responds!
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf