STM32F Reading flash... failed


#1

Hi, I am using the CW5 software and trying to program the STM32F3 target.
I get the following error:

Detected known STMF32: STM32F302xB©/303xB©
Extended erase (0x44), this can take ten seconds or more
Attempting to program 6035 bytes at 0x8000000
STM32F Programming flash…
STM32F Reading flash…

---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-23-b876eeece5c0> in <module>
----> 1 cw.program_target(scope, prog, fw_path)

~/work/projects/chipwhisperer/software/chipwhisperer/__init__.py in program_target(scope, prog_type, fw_path, **kwargs)
     53     prog.find()
     54     prog.erase()
---> 55     prog.program(fw_path, memtype="flash", verify=True)
     56     prog.close()
     57 

~/work/projects/chipwhisperer/software/chipwhisperer/capture/api/programmers.py in func_wrapper(self, *args, **kwargs)
     68             self.scope.io.nrst = 'high_z'
     69         try:
---> 70             val = func(self, *args, **kwargs)
     71         finally:
     72             logging.debug('Restoring pdic, pdid, and nrst pin configuration')

~/work/projects/chipwhisperer/software/chipwhisperer/capture/api/programmers.py in program(self, filename, memtype, verify)
    310         stm32f = self.stm32prog()
    311         stm32f.scope = self.scope
--> 312         stm32f.program(filename, memtype, verify)
    313 
    314     @save_and_restore_pins

~/work/projects/chipwhisperer/software/chipwhisperer/hardware/naeusb/programmer_stm32fserial.py in program(self, filename, memtype, verify, logfunc, waitfunc)
    187 
    188         try:
--> 189             self.verifyMemory(startaddr, fdata, self.small_blocks)
    190         except CmdException:
    191             logfunc("Error during verify. Retrying with small blocks...")

~/work/projects/chipwhisperer/software/chipwhisperer/hardware/naeusb/programmer_stm32fserial.py in verifyMemory(self, addr, fdata, smallblocks)
    533                     logging.info("Verify failed at 0x%04x, %x != %x" % (i, fdata[i+fdata_idx], data[i]))
    534                     if fails > 3:
--> 535                         raise IOError("Verify failed at 0x%04x, %x != %x" % (i, fdata[i+fdata_idx], data[i]))
    536                     else:
    537                         #Redo this block

OSError: Verify failed at 0x007f, 0 != 47

Any idea why?
Thanks for any hint.


#2

I just tried it with the NANO target and got a similiar error:

Detected unknown STM32F ID: 0x444
Extended erase (0x44), this can take ten seconds or more
Attempting to program 5771 bytes at 0x8000000
STM32F Programming flash…
STM32F Reading flash…


OSError Traceback (most recent call last)
in
----> 1 cw.program_target(scope, prog, fw_path)

~/work/projects/chipwhisperer/software/chipwhisperer/init.py in program_target(scope, prog_type, fw_path, **kwargs)
53 prog.find()
54 prog.erase()
—> 55 prog.program(fw_path, memtype=“flash”, verify=True)
56 prog.close()
57

~/work/projects/chipwhisperer/software/chipwhisperer/capture/api/programmers.py in func_wrapper(self, *args, **kwargs)
68 self.scope.io.nrst = ‘high_z’
69 try:
—> 70 val = func(self, *args, **kwargs)
71 finally:
72 logging.debug(‘Restoring pdic, pdid, and nrst pin configuration’)

~/work/projects/chipwhisperer/software/chipwhisperer/capture/api/programmers.py in program(self, filename, memtype, verify)
310 stm32f = self.stm32prog()
311 stm32f.scope = self.scope
–> 312 stm32f.program(filename, memtype, verify)
313
314 @save_and_restore_pins

~/work/projects/chipwhisperer/software/chipwhisperer/hardware/naeusb/programmer_stm32fserial.py in program(self, filename, memtype, verify, logfunc, waitfunc)
187
188 try:
–> 189 self.verifyMemory(startaddr, fdata, self.small_blocks)
190 except CmdException:
191 logfunc(“Error during verify. Retrying with small blocks…”)

~/work/projects/chipwhisperer/software/chipwhisperer/hardware/naeusb/programmer_stm32fserial.py in verifyMemory(self, addr, fdata, smallblocks)
533 logging.info(“Verify failed at 0x%04x, %x != %x” % (i, fdata[i+fdata_idx], data[i]))
534 if fails > 3:
–> 535 raise IOError(“Verify failed at 0x%04x, %x != %x” % (i, fdata[i+fdata_idx], data[i]))
536 else:
537 #Redo this block

OSError: Verify failed at 0x0083, 0 != 10


#3

Can you try reducing the baud rate as detailed in this post?
The only time I’ve ever seen this error is when running inside a Linux VM, with the USB controller set to 2.0.
Reducing the baud rate worked; changing to the USB 3.0 controller also worked.