No Clk CWLITEARM can't be programmed

Hi,

I am trying to flash my CWLITEARM F3, but I can’t measure a clock signal on CLK_IN header. I successfully compilled the glitch1 hex file then I am trying to run this script:

#!/usr/bin/python3

import chipwhisperer as cw

PLATFORM=‘CWLITEARM’

cw.scope().gain.db = 45
cw.scope().adc.samples = 3000
cw.scope().adc.offset = 1250
cw.scope().adc.basic_mode = “rising_edge”
cw.scope().clock.clkgen_freq = 7370000
cw.scope().clock.adc_src = “clkgen_x4”
cw.scope().trigger.triggers = “tio4”
cw.scope().io.tio1 = “serial_rx”
cw.scope().io.tio2 = “serial_tx”
cw.scope().io.hs2 = “clkgen”

if “STM” in PLATFORM or PLATFORM == “CWLITEARM” or PLATFORM == “CWNANO”:
prog = cw.programmers.STM32FProgrammer
elif PLATFORM == “CW303” or PLATFORM == “CWLITEXMEGA”:
prog = cw.programmers.XMEGAProgrammer
else:
prog = None

fw_path = ‘C:\Users\XXXX\ChipWhisperer5_32\chipwhisperer\hardware\victims\firmware\simpleserial-base-lab1\simpleserial-base-CWLLITEARM.hex’

cw.program_target(cw.scope(), prog, fw_path)

Also, I installed windows drivers…

Hi,
1- which CLK_IN header exactly are you looking at?
2- what’s the output of: cw.scope().clock.adc_locked ?
3- what’s the output of your cw.program_target() call?

Jean-Pierre

1- I meant CLKIN header between J3 (red board) and CWLITEARM board.

2- It’s true

3-

Serial baud rate = 38400
Serial baud rate = 115200
Serial baud rate = 38400
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.
Traceback (most recent call last):
File "test_cw.py", line 37, in <module>
cw.program_target(scope, prog, fw_path)
File "C:\Users\14182\AppData\Local\Programs\Python\Python38-32\lib\site-packages\chipwhisperer\__init__.py", line 53, in program_target
prog.find()
File "C:\Users\14182\AppData\Local\Programs\Python\Python38-32\lib\site-packages\chipwhisperer\capture\api\programmers.py", line 70, in func_wrapper
val = func(self, *args, **kwargs)
File "C:\Users\14182\AppData\Local\Programs\Python\Python38-32\lib\site-packages\chipwhisperer\capture\api\programmers.py", line 303, in find
sig, chip = stm32f.find()
File "C:\Users\14182\AppData\Local\Programs\Python\Python38-32\lib\site-packages\chipwhisperer\hardware\naeusb\programmer_stm32fserial.py", line 38, in func_wrapper
return func(self, *args, **kwargs)
File "C:\Users\14182\AppData\Local\Programs\Python\Python38-32\lib\site-packages\chipwhisperer\hardware\naeusb\programmer_stm32fserial.py", line 162, in find
self.initChip()
File "C:\Users\14182\AppData\Local\Programs\Python\Python38-32\lib\site-packages\chipwhisperer\hardware\naeusb\programmer_stm32fserial.py", line 38, in func_wrapper
return func(self, *args, **kwargs)
File "C:\Users\14182\AppData\Local\Programs\Python\Python38-32\lib\site-packages\chipwhisperer\hardware\naeusb\programmer_stm32fserial.py", line 340, in initChip
raise IOError("Could not detect STM32F, check connections, BOOT MODE entry setup")
OSError: Could not detect STM32F, check connections, BOOT MODE entry setup

By the way, I have a blue led and green led blinking on the CW (black board) wich means usb enum and FPGA heart beat I think

Assuming that by “red board” you mean the CW308 UFO, check that your clock selection on J3 is set to HS2/OUT:
https://wiki.newae.com/CW308_UFO_Target#Clock_Selection

I am not sure what I did, but now it’s working fine!

	#!/usr/bin/python3

SCOPETYPE = "OPENADC"
PLATFORM = "CWLITEARM"
CRYPTO_TARGET = "NONE"
num_traces = 50

import chipwhisperer as cw
import time

def reset_target(scope):
	if PLATFORM == "CW303" or PLATFORM == "CWLITEXMEGA":
		scope.io.pdic = "low"
		time.sleep(0.05)
		scope.io.pdic = "high_z" #XMEGA doesn’t like pdic driven high
		time.sleep(0.05)
	else:
		scope.io.nrst = "low"
		time.sleep(0.05)
		scope.io.nrst = "high"
		time.sleep(0.05)

scope = cw.scope()
target = cw.target(scope)

scope.gain.db = 45
scope.adc.samples = 3000
scope.adc.offset = 1250
scope.adc.basic_mode = "rising_edge"
scope.clock.clkgen_freq = 7370000
scope.clock.adc_src = "clkgen_x4"
scope.trigger.triggers = "tio4"
scope.io.tio1 = "serial_rx"
scope.io.tio2 = "serial_tx"
scope.io.hs2 = "clkgen"

if "STM" in PLATFORM or PLATFORM == "CWLITEARM" or PLATFORM == "CWNANO":
	prog = cw.programmers.STM32FProgrammer
elif PLATFORM == "CW303" or PLATFORM == "CWLITEXMEGA":
	prog = cw.programmers.XMEGAProgrammer
else:
	prog = None

print(scope.clock.adc_locked)

fw_path = 'C:\\Users\\14182\\ChipWhisperer5_32\\chipwhisperer\\hardware\\victims\\firmware\\glitch-simple\\glitchsimple-CWLITEARM.hex'

cw.program_target(scope, prog, fw_path)

time.sleep(1)

target.flush()
scope.arm()
reset_target(scope)

ret = scope.capture()
if ret:
	print("Scope capture timed out")
response = target.read(timeout = 10)
print(response)