Cannot upload a CWHUSKY firmware

hello,

I recently followed chipwhisperer jupyter notebook tutorials,but I faced a problem in 1 - Connecting to Hardware.

I tried to upload a firmware to target, but failed.

Here is the error messages.

---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
Cell In[6], line 5
      1 #cw.program_target(scope, cw.programmers.XMEGAProgrammer, "path/to/firmware.hex")
      2 #cw.program_target(scope, cw.programmers.STM32FProgrammer, "path/to/firmware.hex")
      3 #cw.program_target(scope, cw.programmers.AVRProgrammer, "path/to/firmware.hex")
      4 #cw.program_target(scope, cw.programmers.SAM4SProgrammer, "path/to/firmware.hex")
----> 5 cw.program_target(scope, cw.programmers.SAM4SProgrammer, "~/ChipWhisperer/chipwhisperer/firmware/mcu/simpleserial-base/simpleserial-base-CWHUSKY.hex")

File ~\ChipWhisperer\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 ~\ChipWhisperer\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 ~\ChipWhisperer\chipwhisperer\software\chipwhisperer\capture\api\programmers.py:185, in SAM4SProgrammer.find(self, power_cycle)
    183 prog = self.get_prog()
    184 target_logger.info("Connecting to SAMBA")
--> 185 prog.con(self.scope)
    186 target_logger.info("Done!")

File ~\ChipWhisperer\chipwhisperer\software\chipwhisperer\hardware\naeusb\bootloader_sam3u.py:250, in Samba.con(self, port, usbmode)
    247 res = ser.read(2)
    248 # print(res)
--> 250 cid = self.chip_id()
    252 target_logger.info('FWUP: CID = %04x' % cid)
    254 #Originally this was used to limit to SAM3U
    255 #eproc = (cid >> 5) & 0x7
    256 #arch = (cid >> 20) & 0xff
    257 #if eproc == 3 and ((0x80 <= arch <= 0x8a) or (0x93 <= arch <= 0x9a)):
    258 #    target_logger.info('FWUP: Detected SAM3')

File ~\ChipWhisperer\chipwhisperer\software\chipwhisperer\hardware\naeusb\bootloader_sam3u.py:308, in Samba.chip_id(self)
    305 def chip_id(self):
    306     """ Read chip-id """
--> 308     vector = self.read_word(0x00)
    310     # If the vector is a ARM7TDMI branch, then assume Atmel SAM7 registers
    311     if ((vector & 0xff000000) == 0xea000000):

File ~\ChipWhisperer\chipwhisperer\software\chipwhisperer\hardware\naeusb\bootloader_sam3u.py:333, in Samba.read_word(self, addr)
    331 if len(resp) < 4:
    332     target_logger.debug("Timeout on read from {:04X}".format(addr))
--> 333     raise IOError("timeout")
    335 value = (resp[3] << 24 | resp[2] << 16 | resp[1] << 8 | resp[0] << 0)
    336 target_logger.debug("Read {:04X} from {:02X}".format(value, addr))

OSError: timeout

I used ChipWhisperer Husky, ChipWhisperer CW313, SAM4S Target Board.

How do I solve it?

Have you connected the SAM4S target to Husky, and the 20-pin cable between the two correctly? Check your Husky user manual: there is a picture.

If it’s still not working, post a picture of your setup.