Is there a way to "reset" the Chipwhisperer?

When using the Chipwhisperer API, it seems there’s a lock on the USB side.
So let’s say I run a notebook and at some point the jupyter kernel crashes with an OOM. I restart the kernel, tweak my code to avoid the memory issue but I can’t re-open the Chipwhisperer because it wasn’t properly closed before and I lost the scope object. The only way I have right now is to physically unplug and replug it on USB (or a shell script hack that leverages sysfs on Linux to simulate this).

Isn’t there a way to recover from there without these hacks?
It’s ok-ish when the setup is nearby but when using a remote setup over SSH, this problem starts being really annoying :slight_smile:

Hi Jean-Michel,

We actually do try to reset the microcontroller if we encounter an error upon trying to connect in cw.scope(). If that doesn’t work, it likely means that either:

  1. The microcontroller has crashed/gotten stuck somewhere
  2. The old python instance is still connected and the OS won’t allow the new connection

I don’t think there’s really a good way to work around either of these (besides fixing whatever is causing the crash in situation 1.), as once you lose the original device reference from the python instance, we have no way to get it back and I don’t believe it’s possible to reset a USB device without being able to connect to it.

The only lock on the microcontroller is on reading/writing to the FPGA, which can become locked if an FPGA read/write is interrupted. This, however, has been fixed in ChipWhisperer v5.5 and the associated firmware.