Issues about cw huskyplus

Hello,

I recently purchased a CW HuskyPlus.There was a problem with the sca101 test.
The problem I identified was that there was no new hardware version and name, so I added “0xace6” and “ChipWhisperer Husky Plus” to util.py. I thought it would work that way, but an error occurred while downloading the firmware using simple-serial.

What could be the problem? Attach the log.

– -step1 —
PLATFORM=“CW308_SAM4S”
%run Setup_Scripts/Setup_Generic.ipynb

— result of step1 —
INFO: Found ChipWhisperer😍
scope.gain.gain changed from 0 to 22
scope.gain.db changed from 15.0 to 25.091743119266056
scope.adc.samples changed from 327828 to 5000
scope.clock.clkgen_freq changed from 0 to 7370129.87012987
scope.clock.adc_freq changed from 0 to 29480519.48051948
scope.clock.extclk_monitor_enabled changed from True to False
scope.clock.extclk_tolerance changed from 1144409.1796875 to 13096723.705530167
scope.io.tio1 changed from serial_tx to serial_rx
scope.io.tio2 changed from serial_rx to serial_tx
scope.io.hs2 changed from None to clkgen
scope.glitch.phase_shift_steps changed from 0 to 4592
scope.trace.capture.trigger_source changed from trace trigger, rule #0 to firmware trigger

— step2 —
scope.dis()
target.dis()

— step3 —
import chipwhisperer as cw
scope = cw.scope()

— step4 —
target = cw.target(scope, cw.targets.SimpleSerial) #cw.targets.SimpleSerial can be omitted

— step5 —
scope.default_setup()

— result of step5 —
scope.gain.gain changed from 0 to 22
scope.gain.db changed from 15.0 to 25.091743119266056
scope.adc.samples changed from 327828 to 5000
scope.clock.clkgen_freq changed from 0 to 7370129.87012987
scope.clock.adc_freq changed from 0 to 29480519.48051948
scope.clock.extclk_monitor_enabled changed from True to False
scope.clock.extclk_tolerance changed from 1144409.1796875 to 13096723.705530167
scope.io.tio1 changed from serial_tx to serial_rx
scope.io.tio2 changed from serial_rx to serial_tx
scope.io.hs2 changed from None to clkgen
scope.glitch.phase_shift_steps changed from 0 to 4592
scope.trace.capture.trigger_source changed from trace trigger, rule #0 to firmware trigger

— step6 —
%%bash
cd …/hardware/victims/firmware/simpleserial-base/
make PLATFORM=‘CW308_SAM4S’ CRYPTO_TARGET=NONE

— result of step6 —
SS_VER set to SS_VER_1_1
SS_VER set to SS_VER_1_1
SS_VER set to SS_VER_1_1
SS_VER set to SS_VER_1_1
make[1]: ‘.dep’ is up to date.
SS_VER set to SS_VER_1_1
SS_VER set to SS_VER_1_1
.
Welcome to another exciting ChipWhisperer target build!!
arm-none-eabi-gcc (GNU Arm Embedded Toolchain 10-2020-q4-major) 10.2.1 20201103 (release)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

.
Compiling:
simpleserial-base.c …Done!
.
Compiling:
…/./simpleserial/simpleserial.c …Done!
.
Compiling:
…/./hal/sam4s/startup_sam4s.c …Done!
.
Compiling:
…/./hal/sam4s/sam4s_hal.c …Done!
.
Compiling:
…/./hal/sam4s/uart.c …Done!
.
Compiling:
…/./hal/sam4s/pio.c …Done!
.
Compiling:
…/./hal/sam4s/system_sam4s.c …Done!
.
Compiling:
…/./hal/sam4s/sysclk.c …Done!
.
Compiling:
…/./hal/sam4s/pmc.c …Done!
.
LINKING:
simpleserial-base-CW308_SAM4S.elf …Done!
.
Creating load file for Flash: simpleserial-base-CW308_SAM4S.hex
arm-none-eabi-objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature simpleserial-base-CW308_SAM4S.elf simpleserial-base-CW308_SAM4S.hex
.
Creating load file for Flash: simpleserial-base-CW308_SAM4S.bin
arm-none-eabi-objcopy -O binary -R .eeprom -R .fuse -R .lock -R .signature simpleserial-base-CW308_SAM4S.elf simpleserial-base-CW308_SAM4S.bin
.
Creating load file for EEPROM: simpleserial-base-CW308_SAM4S.eep
arm-none-eabi-objcopy -j .eeprom --set-section-flags=.eeprom=“alloc,load”
–change-section-lma .eeprom=0 --no-change-warnings -O ihex simpleserial-base-CW308_SAM4S.elf simpleserial-base-CW308_SAM4S.eep || exit 0
.
Creating Extended Listing: simpleserial-base-CW308_SAM4S.lss
arm-none-eabi-objdump -h -S -z simpleserial-base-CW308_SAM4S.elf > simpleserial-base-CW308_SAM4S.lss
.
Creating Symbol Table: simpleserial-base-CW308_SAM4S.sym
arm-none-eabi-nm -n simpleserial-base-CW308_SAM4S.elf > simpleserial-base-CW308_SAM4S.sym
SS_VER set to SS_VER_1_1
SS_VER set to SS_VER_1_1
Size after:
text data bss dec hex filename
2912 4 4388 7304 1c88 simpleserial-base-CW308_SAM4S.elf
±-------------------------------------------------------

  • Default target does full rebuild each time.
  • Specify buildtarget == allquick == to avoid full rebuild
    ±-------------------------------------------------------
    ±-------------------------------------------------------
  • Built for platform Microchip SAM4S with:
  • CRYPTO_TARGET = NONE
  • CRYPTO_OPTIONS = AES128C
    ±-------------------------------------------------------

— step7 ----
import os

#current working path
print(os.getcwd())

#cw.program_target(scope, cw.programmers.XMEGAProgrammer, “path/to/firmware.hex”)
#cw.program_target(scope, cw.programmers.STM32FProgrammer, “path/to/firmware.hex”)
#cw.program_target(scope, cw.programmers.AVRProgrammer, “path/to/firmware.hex”)

cw.program_target(scope, cw.programmers.AVRProgrammer, “…/hardware/victims/firmware/simpleserial-base/simpleserial-base-CW308_SAM4S.hex”)

— result of step7 —
C:\Users\user\ChipWhisperer5_64\cw\home\portable\chipwhisperer\jupyter

OSError Traceback (most recent call last)
Cell In[5], line 10
4 print(os.getcwd())
6 #cw.program_target(scope, cw.programmers.XMEGAProgrammer, “path/to/firmware.hex”)
7 #cw.program_target(scope, cw.programmers.STM32FProgrammer, “path/to/firmware.hex”)
8 #cw.program_target(scope, cw.programmers.AVRProgrammer, “path/to/firmware.hex”)
—> 10 cw.program_target(scope, cw.programmers.AVRProgrammer, “…/hardware/victims/firmware/simpleserial-base/simpleserial-base-CW308_SAM4S.hex”)

File c:\users\user\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer_init_.py:179, in program_target(scope, prog_type, fw_path, **kwargs)
177 prog._logging = None
178 prog.open()
→ 179 prog.find()
180 prog.erase()
181 prog.program(fw_path, memtype=“flash”, verify=True)

File c:\users\user\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer\capture\api\programmers.py:129, in save_and_restore_pins..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 c:\users\user\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer\capture\api\programmers.py:268, in AVRProgrammer.find(self)
265 @save_and_restore_pins
266 def find(self):
267 avr = self.scope.scopetype.avr
→ 268 sig, chip = avr.find(self.slow_clock)
269 if chip is None:
270 self.log(“AVR: Detected unknown device with signature=%2x %2x %2x” % (sig[0], sig[1], sig[2]))

File c:\users\user\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\programmer_avr.py:236, in AVRISP.find(self, slow_delay)
229 def find(self, slow_delay = False):
230 # Attempts to find a connected AVR device
231 # Returns a pair of (signature, device)
(…)
234
235 # Read signature
→ 236 self.enableISP(True, slow_delay)
237 sig = self.readSignature()
239 # Compare to our known signatures

File c:\users\user\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\programmer_avr.py:377, in AVRISP.enableISP(self, status, slow_clock)
375 self._chip.stabdelay = 100
376 self._chip.cmdexedelay = 25
→ 377 self._avrDoWrite(self.ISP_CMD_ENTER_PROGMODE_ISP, [self._chip.timeout, self._chip.stabdelay, self._chip.cmdexedelay, self._chip.synchloops,
378 self._chip.bytedelay, self._chip.pollvalue, self._chip.pollindex, 0xAC, 0x53, 0, 0])
379 else:
380 try:

File c:\users\user\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\programmer_avr.py:345, in AVRISP._avrDoWrite(self, cmd, data, checkStatus)
342 if status[1] in self.STATUS_TEXT_DESC:
343 status_txt = status_txt + " (%s)"%self.STATUS_TEXT_DESC[status[1]]
→ 345 raise IOError(“AVR-ISP Command 0x%02x failed: err=%s” % (status[0],status_txt))

OSError: AVR-ISP Command 0x10 failed: err=0xc0 (Command Failed)


In addition, if you anticipate any other problems with HuskyPlus, please update the manual.

Thanks,
Jeseok

I solved it myself and am sharing it.

First, I added SCOPETYPE = ‘OPENADC’ (I didn’t know this was a necessary element even before capturing).
And it works when I set the program type to SAM4SProgrammer, like this, cw.program_target(scope, cw.programmers.SAM4SProgrammer, “path/to/firmware.hex”).

Thanks.

I’m glad you resolved your issues! Sorry for the rocky start.
There were two things here. For the first (“no new hardware version and name”), this is because the Husky Plus is very new and requires the “develop” branch of the chipwhisperer repository; it’s not yet supported in our releases.

For the second (programming the target), as you found out, chipwhisperer needs to be explicitly told about the target type in order to use the correct programmer. We recommend that you go through the notebooks in our Jupyter repository, starting with 0 - Introduction to Jupyter Notebooks.ipynb and 1 - Connecting to Hardware.ipynb to avoid running into these types of problems.