2024-01-09 12:44 AM
Solved! Go to Solution.
2024-01-16 02:50 AM
Solution: use Jlink instead of unreliable ST-Link. It solved this problem
2024-01-09 12:59 AM
In the meantime, there is already a much newer version of the STM32CubeProgr, which you should definitely install to possibly solve your problem. However, I would like to draw your attention to the Terms of Use for ST-LINK/V3SET, which do not permit use in production:
The Evaluation Board shall not be, in any case, directly or indirectly assembled as a part in any production of Yours as it is solely developed to serve evaluation an d testing purposes and has no direct function and is not a finished product. [...]
You shall not use, in whole or in part, the Evaluation Board in a production system.
Hope that helps anyway?
Regards
/Peter
2024-01-09 01:17 AM
Hi,
Your problem might be hardware related, i had similar problems with st-link V3 .
It catches some glitch or spike over ground connection and gets error, need reconnect.
Try: from [ (mains)plug ->PC -> USB -> st-link -> target <- supply <- (mains)plug ]
using same mains outlet (+ground) and keep cables for USB to target and mains(+gnd) to target close together,
to keep induced spikes at low level.
Since i did it this way, no more sporadic errors on st-link communication. Try it.
2024-01-09 02:06 AM
Hi,
But what else would you recommend for me to use as an alternative to STLink? I know I might use Segger, but I need to use a debugging tool, no components like Asix and such can be utilized in my case.
Thank you.
2024-01-09 05:46 AM
When debug does not work, tripple check wiring, keep wires short and provide sufficient short ground connection. hertz:~> tin -g netnews
Reading config file...
2024-01-09 10:40 AM
New version didn't help at all, it's the same. The issue is that it works but often malfunctions and disconnects. Maybe it's caused by some interference on the SWD pins, but why does the entire STlink need to freeze because of that?
2024-01-09 11:22 AM
Consider also bad USB cables, hubs or connectors.
2024-01-11 12:14 AM - edited 2024-01-11 12:26 AM
Thank you for all help, but problem remains. There is maybe problem in my code.
The problem almost never occurs when Erasing or Flashing MCU, but sometimes when I write or read from RAM mem.
Code In Python for writeU32:
def writeU32ToMem(self,addr,u32,verify = True):
with self.swdLock:
tm = 0.2
prcs = [self.cubeProgPath+'/STM32_Programmer_CLI.exe',
'-c',
'port=SWD',
'mode=hotplug',
'freq='+SWD_FREQ,
#'speed=Reliable',
'-w32',
hex(addr),
hex(u32)
]
if verify == True:
prcs.append('-v')
try:
out = str(subprocess.check_output(prcs, stderr=subprocess.STDOUT, timeout=tm,creationflags=subprocess.CREATE_NO_WINDOW))
break
except:
out = ''
def readU32Mem(self,addr):
with self.swdLock:
tm = 1
prcs = [self.cubeProgPath+'/STM32_Programmer_CLI.exe',
'-c',
'port=SWD',
'mode=UR',
#'speed=Reliable',
'-r32',
hex(addr),
'12',
]
for _ in range(3):
try:
out = str(subprocess.check_output(prcs, stderr=subprocess.STDOUT, timeout=tm,creationflags=subprocess.CREATE_NO_WINDOW))
break
except:
out = ''
try:
if 'Reading 32-bit memory content' in out:
hexAddr = "0x{:08X}".format(addr)
start=out.find(hexAddr+' : ')+len(hexAddr+' : ')
end = start + 8
res = out[start:end]
res=int(res,16)
return res
except:
pass
Whe try to connect via ST-Utility:
and in STM32Propgramer:
2024-01-16 02:50 AM
Solution: use Jlink instead of unreliable ST-Link. It solved this problem