Issues when programming target using Chipwhisperer-Lite with STM32F4 Target board only works once

Hello,

I am trying to flash the CW308_STM32F4 on Ubuntu (Using the Instruction Power Differences Hardware lab as a test, but I have used others ones just to make sure).

I set PLATFORM = ‘CW308_STM32F4’ am getting the following error when executing:

cw.program_target(scope, prog, "../../../firmware/mcu/simpleserial-base-lab2/simpleserial-base-{}.hex".format(PLATFORM))

Failed to detect chip. Check following: 
   1. Connections and device power. 
   2. Device has valid clock (or remove clock entirely for internal osc).
   3. On Rev -02 CW308T-STM32Fx boards, BOOT0 is routed to PDIC.

---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
Cell In[7], line 1
----> 1 cw.program_target(scope, prog, "../../../firmware/mcu/simpleserial-base-lab2/simpleserial-base-{}.hex".format(PLATFORM))

File ~/MasterThesis/chipwhisperer/software/chipwhisperer/__init__.py:181, in program_target(scope, prog_type, fw_path, **kwargs)
    179 prog._logging = None
    180 prog.open()
--> 181 prog.find()
    182 prog.erase()
    183 prog.program(fw_path, memtype="flash", verify=True)

File ~/MasterThesis/chipwhisperer/software/chipwhisperer/capture/api/programmers.py:129, in save_and_restore_pins.<locals>.func_wrapper(self, *args, **kwargs)
    126 target_logger.debug('Changing {} pin configuration'.format(pin_setup))
    128 try:
--> 129     val = func(self, *args, **kwargs)
    130 finally:
    131     target_logger.debug('Restoring {} pin configuration'.format(pin_setup))

File ~/MasterThesis/chipwhisperer/software/chipwhisperer/capture/api/programmers.py:420, in STM32FProgrammer.find(self)
    418         target_logger.warning("(tio1, tio2) != ('serial_rx', 'serial_tx')")
    419         target_logger.warning("Did you forget to call scope.default_setup()?")
--> 420 sig, chip = stm32f.find()

File ~/MasterThesis/chipwhisperer/software/chipwhisperer/hardware/naeusb/programmer_stm32fserial.py:38, in close_on_fail.<locals>.func_wrapper(self, *args, **kwargs)
     35 @wraps(func)
     36 def func_wrapper(self, *args, **kwargs):
     37     try:
---> 38         return func(self, *args, **kwargs)
     39     except:
     40         self.close_port()

File ~/MasterThesis/chipwhisperer/software/chipwhisperer/hardware/naeusb/programmer_stm32fserial.py:174, in STM32FSerial.find(self, logfunc)
    171     logfunc = print_fun
    173 try:
--> 174     self.initChip()
    175 except IOError:
    176     logfunc("Failed to detect chip. Check following: ")

File ~/MasterThesis/chipwhisperer/software/chipwhisperer/hardware/naeusb/programmer_stm32fserial.py:38, in close_on_fail.<locals>.func_wrapper(self, *args, **kwargs)
     35 @wraps(func)
     36 def func_wrapper(self, *args, **kwargs):
     37     try:
---> 38         return func(self, *args, **kwargs)
     39     except:
     40         self.close_port()

File ~/MasterThesis/chipwhisperer/software/chipwhisperer/hardware/naeusb/programmer_stm32fserial.py:354, in STM32FSerial.initChip(self)
    351         fails += 1
    353 self.releaseChip()
--> 354 raise IOError("Could not detect STM32F, check connections, BOOT MODE entry setup")

OSError: Could not detect STM32F, check connections, BOOT MODE entry setup

When doing a fresh reinstall the target will flash once and execute normally, however after unplugging the cw it always breaks. I have tried to reinstall cw, tried older versions and even completely reinstalled my ubuntu dual boot.

Suprisingly, I didn’t have this issue when using the STM32F3 target. It also works on the same machine in a windows dual boot installation.

I also went through several posts on here with the same error and tried those solutions(mostly wrong jumpers) but that did not help.

I have no idea anymore what could be wrong since it works on a different machine, on the same machine with Windows WSL and on Ubuntu with the STM32F3 target(last I tested)


.

Looking at your picture, the 1.2V LED on your CW308 looks dim. Try flipping the 1.2V LDO source switch on the right side of the board.

Hey,
That didn’t solve the issue unfortunately. On some reboots it actually builds once and upon usb reconnect it doesnt work again. Any more ideas?

That’s very strange. There shouldn’t be any differences between programming the F3/F4, and there shouldn’t be any long term side effects that would necessitate reinstalling/rebooting. Can you try shorting SHUNTH/SHUNTL using a jumper and seeing if that fixes the issue?

You’ve said you’re using WSL on Windows. What exactly do you mean by this? USB devices aren’t accessible in WSL, so are you connecting from Windows natively (like we do with our Windows installer), or are you using something like WSL USB?

Sorry I should have clarified. I’m running a dual boot. The Ubuntu side has the issues and the Windows side works correctly. I just mentioned WSL because it was required in the Windows install. There should not be anything out of the ordinary about either setup.

My best guess is that its connected to how the usb connection is handled, maybe differences in firmware? Just to confirm again, I tried with the f3 and it works perfectly and the f4 works perfectly on another device and on windows but not my (basically stock) ubuntu.

My only clue is that dmesg tells “usbfs: process 12752 (python) did not claim interface 0 before use”. Not sure if that is normal.

Hi, sorry for the late reply here,

Everything is exactly the same between the F3 and F4 from our end (all the Python and C code are identical). The F4 does require

I don’t think the interface message is an issue.

Can you try running the following code, then posting the result:

cw.target_logger.setLevel(cw.logging.INFO)
cw.program_target(scope, prog, "../../../firmware/mcu/simpleserial-base-lab2/simpleserial-base-{}.hex".format(PLATFORM))

Alex