On and off for the last week, I have been following the tutorial at https://github.com/newaetech/CW305-Arm-DesignStart. I have now generated the .bit
file and it seems to be working. I am using the CW305 as an FPGA target and the CW-Lite Part 2 for capture. Whenever I open the connection with the following script:
import chipwhisperer as cw
scope = cw.scope()
# program target:
bitstream = r"/home/gijsb/Documents/cw305-files/src/hardware/CW305_DesignStart/CW305_DesignStart.bit"
ftarget = cw.target(scope, cw.targets.CW305, bsfile=bitstream, force=False)
# set clock:
ftarget.vccint_set(1.0)
# we only need PLL1:
ftarget.pll.pll_enable_set(True)
ftarget.pll.pll_outenable_set(False, 0)
ftarget.pll.pll_outenable_set(True, 1)
ftarget.pll.pll_outenable_set(False, 2)
# run at 20 MHz:
ftarget.pll.pll_outfreq_set(20E6, 1)
# ensure ADC is locked:
scope.clock.reset_adc()
assert (scope.clock.adc_locked), "ADC failed to lock"
scope.gain.gain = 60
scope.gain.mode = "high"
scope.adc.samples = 20000
scope.adc.offset = 0
scope.adc.basic_mode = "rising_edge"
scope.clock.clkgen_freq = 7370000
scope.clock.adc_src = "extclk_x4"
scope.trigger.triggers = "tio4"
scope.io.tio1 = "serial_rx"
scope.io.tio2 = "serial_tx"
scope.io.hs2 = "disabled"
import time
time.sleep(10)
As long as the script continues to sleep, everything seems fine. The clock LED7 is blinking, if I press the SW4 to reset the LED5 blinks. However, when I try to program the target with the following script afterwards:
from chipwhisperer.capture.api.programmers import STM32FProgrammer
import os
program = STM32FProgrammer
aes_firmware_dir = os.path.dirname(os.path.realpath(__file__))
aes_hex_path = os.path.join(aes_firmware_dir, r"simpleserial-aes.hex")
print("Programming target...")
cw.program_target(scope, program, aes_hex_path, baud = 38400)
print("Programmed target")
It will return the error:
Programming Target...
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: Could not detect STM32F, check connections, BOOT MODE entry setup
I am new to the whole FPGA thing, but I have done some ChipWhisperer on a CWLITE-ARM before. Is there something I am clearly doing wrong here? Maybe I am not supposed to use STM32FProgrammer
? Perhaps my setup is incorrect? I have been searching for hours through the forum and documentation, but I cannot seem to find anything which hints at a solution or example. Does anyone have an idea?
Maybe for debugging purposes, here is my scope just before programming the target:
cwlite Device
sn = 50203120324136503130313134323031
fw_version =
major = 0
minor = 30
debug = 0
gain =
mode = high
gain = 60
db = 44.171875
adc =
state = False
basic_mode = rising_edge
timeout = 2
offset = 0
presamples = 0
samples = 20000
decimate = 1
trig_count = 335756915
fifo_fill_mode = normal
clock =
adc_src = extclk_x4
adc_phase = 0
adc_freq = 117796142
adc_rate = 117796142.0
adc_locked = True
freq_ctr = 17111206
freq_ctr_src = extclk
clkgen_src = system
extclk_freq = 10000000
clkgen_mul = 2
clkgen_div = 26
clkgen_freq = 7384615.384615385
clkgen_locked = True
trigger =
triggers = tio4
module = basic
io =
tio1 = serial_rx
tio2 = serial_tx
tio3 = high_z
tio4 = high_z
pdid = high_z
pdic = high_z
nrst = high_z
glitch_hp = False
glitch_lp = False
extclk_src = hs1
hs2 = None
target_pwr = True
tio_states = (1, 1, 0, 0)
cdc_settings = array('B', [1, 1])
glitch =
clk_src = target
width = 10.15625
width_fine = 0
offset = 10.15625
offset_fine = 0
trigger_src = manual
arm_timing = after_scope
ext_offset = 0
repeat = 1
output = clock_xor
At the top, you can see the setup I am using. And yes, I did plug in the devices when testing
Thank you in advance,
Gijs