CWNano programming error


#1

Hi,

I recently got a Chip Whisperer Nano board at CHES.
I am running the “PA_Intro_1-Firmware_Build_Setup” jupyter notebook tutorial to test it.
I changed the parameters to SCOPETYPE = ‘CWNANO’
PLATFORM = ‘CWNANO’
CRYPTO_TARGET = ‘TINYAES128C’

But when I try to program the device I get the following output:

Detected unknown STM32F ID: 0x444
Extended erase (0x44), this can take ten seconds or more
Attempting to programming 4335 bytes at 0x8000000
STM32F Programming flash…

IndexError Traceback (most recent call last)
~/Documents/Cosic/CW/chipwhisperer/software/chipwhisperer/hardware/naeusb/programmer_stm32fserial.py in _wait_for_ask(self, info)
282 try:
–> 283 ask = self.sp.read(1)[0]
284 except:

IndexError: list index out of range

During handling of the above exception, another exception occurred:

CmdException Traceback (most recent call last)
in
----> 1 cw.program_target(scope, prog, fw_path)

~/Documents/Cosic/CW/chipwhisperer/software/chipwhisperer/init.py in program_target(scope, prog_type, fw_path)
45 prog.find()
46 prog.erase()
—> 47 prog.program(fw_path, memtype=“flash”, verify=True)
48 prog.close()
49

~/Documents/Cosic/CW/chipwhisperer/software/chipwhisperer/capture/api/programmers.py in func_wrapper(self, *args, **kwargs)
68 self.scope.io.nrst = ‘high_z’
69 try:
—> 70 val = func(self, *args, **kwargs)
71 finally:
72 logging.debug(‘Restoring pdic, pdid, and nrst pin configuration’)

~/Documents/Cosic/CW/chipwhisperer/software/chipwhisperer/capture/api/programmers.py in program(self, filename, memtype, verify)
316 stm32f = self.stm32prog()
317 stm32f.scope = self.scope
–> 318 stm32f.program(filename, memtype, verify)
319
320 @save_and_restore_pins

~/Documents/Cosic/CW/chipwhisperer/software/chipwhisperer/hardware/naeusb/programmer_stm32fserial.py in program(self, filename, memtype, verify, logfunc, waitfunc)
182 logfunc(“STM32F Programming %s…” % memtype)
183 if waitfunc: waitfunc()
–> 184 self.writeMemory(startaddr, fdata) # , erasePage=True
185
186 logfunc(“STM32F Reading %s…” % memtype)

~/Documents/Cosic/CW/chipwhisperer/software/chipwhisperer/hardware/naeusb/programmer_stm32fserial.py in writeMemory(self, addr, data)
603 while lng > 256:
604 logging.debug(“Write %(len)d bytes at 0x%(addr)X” % {‘addr’: addr, ‘len’: 256})
–> 605 self.cmdWriteMemory(addr, data[offs:offs + 256])
606 updateUI()
607 if self.slow_speed:

~/Documents/Cosic/CW/chipwhisperer/software/chipwhisperer/hardware/naeusb/programmer_stm32fserial.py in cmdWriteMemory(self, addr, data)
414 self.delay_func(5)
415 self.sp.write(chr(crc))
–> 416 self._wait_for_ask(“0x31 programming failed”)
417 logging.debug(" Write memory done")
418 else:

~/Documents/Cosic/CW/chipwhisperer/software/chipwhisperer/hardware/naeusb/programmer_stm32fserial.py in _wait_for_ask(self, info)
283 ask = self.sp.read(1)[0]
284 except:
–> 285 raise CmdException(“Can’t read port or timeout (%s)” % traceback.format_exc())
286 else:
287 if ask == 0x79:

CmdException: Can’t read port or timeout (Traceback (most recent call last):
File “/Users/laurendemeyer/Documents/Cosic/CW/chipwhisperer/software/chipwhisperer/hardware/naeusb/programmer_stm32fserial.py”, line 283, in _wait_for_ask
ask = self.sp.read(1)[0]
IndexError: list index out of range

Thanks,
Lauren


#2

Hi Lauren,

We’ve typically seen this issue when the baud rate used by the programmer is too high. We’re still working out a cause, but in the meantime can you try changing cw.program_target(...) to cw.program_target(..., baud=38400) (and if that doesn’t work, continue decreasing the baud rate).

Alex


#3

Thanks you Alex!

Cheers,
Lauren