I did the training last year with a Chipwhisrer lite. I’m going back through it with a CWNANO.
- I’m having a problem on the Connecting to Hardware.
a. I can get everything to work up to 1.7
b. I cannot get 1.7 to work
Environment
VirtualBox using ChipWhisperer.Jupyter.7z (v5.5.2) downloaded yesterday
Code that I’m using
I re run through 1.6 then in 1.7
print("arm")
scope.arm()
print("running")
target.simpleserial_write('p', msg)
print("ran")
scope.capture()
print("capture done")
where msg is being set in previous steps.
Output
arm
running
ran
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
~/.pyenv/versions/3.7.7/envs/cw/lib/python3.7/site-packages/pyusb-1.1.1-py3.7.egg/usb/core.py in get_interface_and_endpoint(self, device, endpoint_address)
235 try:
--> 236 return self._ep_info[endpoint_address]
237 except KeyError:
KeyError: None
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last)
<ipython-input-62-61d59d6b15b7> in <module>
4 target.simpleserial_write('p', msg)
5 print("ran")
----> 6 scope.capture()
7 print("capture done")
8
~/work/projects/chipwhisperer/software/chipwhisperer/capture/scopes/cwnano.py in capture(self)
694 return True
695
--> 696 self._lasttrace = self._cwusb.cmdReadMem(0, self.adc.samples)
697
698 # can just keep rerunning this until it works I think
~/work/projects/chipwhisperer/software/chipwhisperer/hardware/naeusb/naeusb.py in cmdReadMem(self, addr, dlen)
798 """
799
--> 800 return self.usbseralizer.cmdReadMem(addr, dlen)
801
802 def cmdWriteMem(self, addr, data):
~/work/projects/chipwhisperer/software/chipwhisperer/hardware/naeusb/naeusb.py in cmdReadMem(self, addr, dlen)
202 cmdpacket = self.make_cmd(self.CMD_READ_MEM, payload)
203
--> 204 return self.process_rx(self.txrx(tx=cmdpacket))
205
206 def cmdWriteMem(self, addr, data):
~/work/projects/chipwhisperer/software/chipwhisperer/hardware/naeusb/naeusb.py in txrx(self, tx)
311 addr = payload[0]
312 dlen = payload[1]
--> 313 response = self.cmdReadMem(addr, dlen)
314 naeusb_logger.debug("CMD_READ_MEM: addr: {:08X}, dlen: {:08X}, response: {}".format(addr, dlen, response))
315 elif cmd == self.CMD_WRITE_MEM:
~/work/projects/chipwhisperer/software/chipwhisperer/hardware/naeusb/naeusb.py in cmdReadMem(self, addr, dlen)
531 # Get data
532 if cmd == self.CMD_READMEM_BULK:
--> 533 data = self.usbdev().read(self.rep, dlen, timeout=self._timeout)
534 # XXX Husky debug:
535 naeusb_logger.info('YYY BULK rep=%d, dlen=%d, got len=%d' % (self.rep, dlen, len(data)))
~/.pyenv/versions/3.7.7/envs/cw/lib/python3.7/site-packages/pyusb-1.1.1-py3.7.egg/usb/core.py in read(self, endpoint, size_or_buffer, timeout)
1009 }
1010
-> 1011 intf, ep = self._ctx.setup_request(self, endpoint)
1012 fn = fn_map[util.endpoint_type(ep.bmAttributes)]
1013
~/.pyenv/versions/3.7.7/envs/cw/lib/python3.7/site-packages/pyusb-1.1.1-py3.7.egg/usb/core.py in wrapper(self, *args, **kwargs)
111 try:
112 self.lock.acquire()
--> 113 return f(self, *args, **kwargs)
114 finally:
115 self.lock.release()
~/.pyenv/versions/3.7.7/envs/cw/lib/python3.7/site-packages/pyusb-1.1.1-py3.7.egg/usb/core.py in setup_request(self, device, endpoint)
226 endpoint_address = endpoint
227
--> 228 intf, ep = self.get_interface_and_endpoint(device, endpoint_address)
229 self.managed_claim_interface(device, intf)
230 return (intf, ep)
~/.pyenv/versions/3.7.7/envs/cw/lib/python3.7/site-packages/pyusb-1.1.1-py3.7.egg/usb/core.py in wrapper(self, *args, **kwargs)
111 try:
112 self.lock.acquire()
--> 113 return f(self, *args, **kwargs)
114 finally:
115 self.lock.release()
~/.pyenv/versions/3.7.7/envs/cw/lib/python3.7/site-packages/pyusb-1.1.1-py3.7.egg/usb/core.py in get_interface_and_endpoint(self, device, endpoint_address)
242 return intf, ep
243
--> 244 raise ValueError('Invalid endpoint address ' + hex(endpoint_address))
245
246 @synchronized
TypeError: 'NoneType' object cannot be interpreted as an integer
As troubleshooting I went back and ran the upgrade firmware code
import chipwhisperer as cw
scope = cw.scope()
prog = cw.SAMFWLoader(scope)
prog.auto_program()
this is what I got
Entering bootloader mode...
Please wait until the ChipWhisperer shows up as a serial port. Once it has, call
the program(COMPORT, FWPATH) to program the ChipWhisperer
Default firmware can be found at chipwhisperer/hardware/capture/chipwhisperer-lite/sam3u_fw/SAM3U_VendorExample/Debug/SAM3U_CW1173.bin
Detected com port /dev/ttyACM1
Loading cwnano firmware...
Opened!
Connecting...
b'\n\r'
Connected!
Erasing...
Erased!
Programming file SAM3U_CWNANO.bin...
Programmed!
Verifying...
Verify OK!
Bootloader disabled. Please power cycle device.
then came back and tried again, same thing.
Since I have about 20 of these I tried a second on and got the same problem. I upgraded the firmware on that one too.