Hi,
I am experiencing a different issue with UART triggering to my previous issue so I thought I’d start a new thread to capture it.
I seem to be getting into a situation where the UART trigger module is triggering, but a glitch isn’t being generated. It often (but not always) results in errors with the ADC and Glitch red LEDs flashing. Polling the error logs I seem to be getting "segmenting error” and “trigger too soon errors”.
From reading the docs it sounds like I can ignore the segmenting error as a glitch is occurring whilst it is capturing (as expected). But I am struggling to find much about dealing with the “trigger too soon errors”. Is there anything I can do to deal with this?
I’ve used an oscilloscope/logic analyser to confirm that the Husky is triggering on legitimate UART messages and I can see on the oscilloscope that it isn’t glitching on all the trigger out signals.
My code:
#!/home/user/.cwvenv/bin/python
import time
import chipwhisperer as cw
scope = cw.scope(name="Husky")
scope.clock.clkgen_src = 'system'
scope.clock.clkgen_freq = 20e6
scope.clock.adc_mul = 3
scope.glitch.enabled = True
scope.glitch.clk_src = 'pll'
scope.clock.fpga_vco_freq = 600e6
scope.glitch.trigger_src = "ext_continuous"
scope.glitch.ext_offset = 0
scope.glitch.output = "enable_only"
scope.glitch.repeat = [50]
scope.glitch.offset = 0
scope.io.glitch_lp = False
scope.io.glitch_hp = False
scope.UARTTrigger.enabled = True
scope.trigger.module = "UART"
scope.io.aux_io_mcx = 'high_z'
scope.trigger.triggers = 'aux'
scope.UARTTrigger.clock.fe_clock_src = "usb_clock" #you need to sleep for 0.2s after changing clock
time.sleep(0.2)
scope.UARTTrigger.baud = 4000000
pattern = [0x01, 0x02, 0x03, 0x04, 0x05, 0x06]
mask = [0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF]
scope.UARTTrigger.set_pattern_match(0,pattern, mask)
scope.UARTTrigger.trigger_source = 0
scope.glitch.reset_glitch_counter()
time.sleep(0.2)
countG = 0
countT = 0
print("Initial trigger count: %i" % scope.UARTTrigger.matched_pattern_counts[0])
scope.errors.clear()
scope.arm()
print(scope)
while True:
if (countG != scope.glitch.actual_num_glitches) or (countT != scope.UARTTrigger.matched_pattern_counts[0]):
print("Num triggers: %i | Number glitches %i" % (scope.UARTTrigger.matched_pattern_counts[0], scope.glitch.actual_num_glitches))
countG = scope.glitch.actual_num_glitches
countT = scope.UARTTrigger.matched_pattern_counts[0]
print(scope.errors)
scope.errors.clear()
Output:
$ ./update.py
Initial trigger count: 0
enabled = True
baud = 4000000.0
data_bits = 8
stop_bits = 1
parity = none
accept_parity_errors = False
sampling_clock = 192000000.0
trigger_source = rule #0
rules_enabled = [0]
rules = [{'rule': 0, 'patt': bytearray(b'\x00\x00\x01\x02\x03\x04\x05\x06'), 'mask': bytearray(b'\x00\x00\xff\x00\xff\xff\xff\xff')}]
matched_pattern_counts = [0, 0, 0, 0, 0, 0, 0, 0]
cwhusky Device
sn = ***
fpga_buildtime = 5/26/2026, 09:27
fw_version =
major = 1
minor = 7
debug = 0
gain =
mode = low
gain = 0
db = 15.0
adc =
state = False
basic_mode = rising_edge
timeout = 2
offset = 0
presamples = 0
samples = 131124
decimate = 1
trig_count = 0
stream_mode = False
test_mode = False
bits_per_sample = 12
segments = 1
segment_cycles = 0
segment_cycle_counter_en = False
clip_errors_disabled = False
lo_gain_errors_disabled = False
errors = False
clock =
clkgen_src = system
clkgen_freq = 20000000.0
adc_mul = 3
adc_freq = 60000000.0
adc_rate = 60000000.0
freq_ctr = 0
freq_ctr_src = extclk
clkgen_locked = True
adc_phase = 0.0
extclk_monitor_enabled = False
extclk_error = False
extclk_tolerance = 1144409.1796875
trigger =
sequencer_enabled = False
module = UART
triggers = sma
io =
tio1 = serial_tx
tio2 = serial_rx
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, 1, 0)
cdc_settings = [1, 0, 0, 0]
aux_io_mcx = high_z
glitch_trig_mcx = trigger
glitch =
enabled = True
num_glitches = 1
clk_src = pll
mmcm_locked = True
width = 0
offset = 0
trigger_src = ext_continuous
arm_timing = after_scope
ext_offset = 0
repeat = 50
output = enable_only
phase_shift_steps = 1680
SAD =
threshold = 0
interval_threshold = 1
trigger_sample = 256
sad_reference_length = 256
emode = False
multiple_triggers = False
num_triggers_seen = 0
always_armed = False
ADS4128 =
mode = normal
low_speed = True
hi_perf = 2
LA =
present = True
enabled = False
clkgen_enabled = True
locked = True
clk_source = pll
trigger_source = glitch
oversampling_factor = 2
sampling_clock_frequency = 192000000.0
downsample = 1
capture_group = glitch
capture_depth = 0
trace =
present = True
enabled = True
errors = False
trace_synced = True
trace_mode = parallel
trace_width = 4
clock =
fe_clock_alive = True
fe_clock_src = usb_clock
clkgen_enabled = True
fe_freq = 96000000.0
swo_clock_locked = True
swo_clock_freq = 192000000.0
capture =
trigger_source = trace trigger, rule #0
use_husky_arm = True
raw = True
rules_enabled = [0]
rules = [{'rule': 0, 'patt': bytearray(b'\x00\x00\x01\x02\x03\x04\x05\x06'), 'mask': bytearray(b'\x00\x00\xff\x00\xff\xff\xff\xff')}]
mode = off
count = 0
max_triggers = 1
triggers_generated = 0
record_syncs = True
matched_pattern_data = 0000000000000000
matched_pattern_counts = [0, 0, 0, 0, 0, 0, 0, 0]
XADC =
status = good
temp = 61.9 [C]
max_temp = 63.2 [C]
temp_trigger = 80.0 [C]
temp_reset = 59.9 [C]
ot_temp_trigger = 84.9 [C]
ot_temp_reset = 59.9 [C]
vccint = 1.010 [V]
vccaux = 1.800 [V]
vccbram = 1.009 [V]
userio =
mode = trace
direction = 3
clock_enabled = 0
clocks = Lister([None])
clock_source = usb
clocks_locked = True
drive_data = 0
status = 508
Individual pins =
D0 = TMS , output, status = 0, clock_enabled = 0, drive = 0, clock not supported
D1 = TCK , output, status = 0, clock_enabled = 0, drive = 0, clock not supported
D2 = TDO/SWO , input, status = 1, clock_enabled = 0, drive = 0, clock not supported
D3 = unused , input, status = 1, clock_enabled = 0, drive = 0, clock not supported
D4 = TRACEDATA[0], input, status = 1, clock_enabled = 0, drive = 0, clock not supported
D5 = TRACEDATA[1], input, status = 1, clock_enabled = 0, drive = 0, clock not supported
D6 = TRACEDATA[2], input, status = 1, clock_enabled = 0, drive = 0, clock not supported
D7 = TRACEDATA[3], input, status = 1, clock_enabled = 0, drive = 0, clock not supported
CK = TRACECLOCK , input, status = 1, clock_enabled = 0, drive = 0, clock not set
bitbanger =
data_pin = disabled
clock_pin = disabled
max_length = 512
max_record = 32
clk_div = 2
drive_edge = rising
check_edge = falling
inactive_state = high_z
inactive_data = 0
continuous_clk = 0
num_bits = 0
glitch_mode = drive_low
LEDs =
setting = 0 (default, as labelled)
errors =
sam_errors = False
sam_led_setting = Default
XADC errors = False
ADC errors = False
extclk error = False
trace errors = False
Num triggers: 2 | Number glitches 1
sam_errors = False
sam_led_setting = Default
XADC errors = False
ADC errors = False
extclk error = False
trace errors = False
Num triggers: 3 | Number glitches 1
sam_errors = False
sam_led_setting = Default
XADC errors = False
ADC errors = False
extclk error = False
trace errors = False
Num triggers: 4 | Number glitches 1
sam_errors = False
sam_led_setting = Default
XADC errors = False
ADC errors = False
extclk error = False
trace errors = False
Num triggers: 5 | Number glitches 1
sam_errors = False
sam_led_setting = Default
XADC errors = False
ADC errors = False
extclk error = False
trace errors = False
Num triggers: 6 | Number glitches 2
sam_errors = False
sam_led_setting = Default
XADC errors = False
ADC errors = trigger too soon error,
extclk error = False
trace errors = False
Num triggers: 7 | Number glitches 3
sam_errors = False
sam_led_setting = Default
XADC errors = False
ADC errors = trigger too soon error,
extclk error = False
trace errors = False
Num triggers: 8 | Number glitches 3
sam_errors = False
sam_led_setting = Default
XADC errors = False
ADC errors = trigger too soon error,
extclk error = False
trace errors = False
Num triggers: 9 | Number glitches 4
sam_errors = False
sam_led_setting = Default
XADC errors = False
ADC errors = trigger too soon error,
extclk error = False
trace errors = False