CW Lite FPGA programming issues (macos)

Hi,

I just got a CW lite I’m having issues with the FPGA programming under MacOS 10.14.6 (Mojave). I’m using a newer MacBook pro, so it only has usb-c, so I’m connecting the the CW through an usb-c to usb-a adapter (https://www.apple.com/shop/product/MJ1M2AM/A/usb-c-to-usb-adapter).

I have tried running it both natively and in the virtual machine, same issue (5.1.1 release/tag).

I have tried using another laptop with windows 10 and had no issues then, so the hardware works, it is just something with the macbook, but I can’t use the win 10 PC in the long run.

Do you have any idea on how I can proceed with this issue?

This is the output from when it fails:

pedro$ python
Python 3.7.3 (default, Mar 27 2019, 09:23:15) 
[Clang 10.0.1 (clang-1001.0.46.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import chipwhisperer as cw
>>> scope = cw.scope()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/pedro/git/chipwhisperer/software/chipwhisperer/__init__.py", line 211, in scope
    scope.con(sn)
  File "/Users/pedro/git/chipwhisperer/software/chipwhisperer/capture/scopes/base.py", line 58, in con
    if self._con(sn):
  File "/Users/pedro/git/chipwhisperer/software/chipwhisperer/capture/scopes/OpenADC.py", line 203, in _con
    self.scopetype.con(sn)
  File "/Users/pedro/git/chipwhisperer/software/chipwhisperer/capture/scopes/openadc_interface/naeusbchip.py", line 97, in con
    self.getFWConfig().loadRequired()
  File "/Users/pedro/git/chipwhisperer/software/chipwhisperer/capture/scopes/cwhardware/ChipWhispererFWLoader.py", line 240, in loadRequired
    self.loader.loadRequired(self.loadFPGA, forceFirmware)
  File "/Users/pedro/git/chipwhisperer/software/chipwhisperer/capture/scopes/cwhardware/ChipWhispererFWLoader.py", line 186, in loadRequired
    callback()
  File "/Users/pedro/git/chipwhisperer/software/chipwhisperer/capture/scopes/cwhardware/ChipWhispererFWLoader.py", line 267, in loadFPGA
    self.loader.loadFPGA()
  File "/Users/pedro/git/chipwhisperer/software/chipwhisperer/capture/scopes/cwhardware/ChipWhispererFWLoader.py", line 193, in loadFPGA
    self.driver.FPGAProgram(self.fpga_bitstream())
  File "/Users/pedro/git/chipwhisperer/software/chipwhisperer/hardware/naeusb/fpga.py", line 84, in FPGAProgram
    raise IOError("FPGA Done pin failed to go high, bad bitstream?", bitstream)
OSError: [Errno FPGA Done pin failed to go high, bad bitstream?] <zipfile.ZipExtFile [closed]>
>>>

Hi @pedro,

Can you try a different adapter? Apple doesn’t show any specs so it’s hard to pinpoint definitively, but the reviews page for that Apple adapter has lots of complaints about certain devices not working. I don’t think anyone has mentioned a CW-lite – yet :wink:

CW-lite is a USB 2.0 HS device, nothing esoteric. I’d find a well-reviewed adapter and try that.

Jean-Pierre

Hi Jean-Pierre,

I have tried another adapter as well, same problem. The USB communication seems to be workin, since it can read out the serial number and such, so I’m not sure that USB is the problem.

Have you got any tips for debugging it further?

BR
Pedro

Hi Pedro,

I just tried a fresh install from git master on an older 10.13.6 Macbook with USB-A ports, and it works.
I’ll try to upgrade to Mojave soon and see if that changes anything.
In the meantime, have you tried with a Linux VM? I know that introduces another variable, but this works for me as well.

Jean-Pierre

Yeah, I tried with the vagrant VM that you supply, 5.1.1 release. Works fine under windows, but not on my MacBook. Same issue, can talk to the CW but not program the FPGA.

Really odd. Do you do any checksum verification on the fly to see that the FPGA binary is correct, or is that only done by the FPGA as part of the programming?

/P

Hi, no CW itself doesn’t validate the bitstream.
@coflynn reports that it’s not uncommon for USB-C ports to cause problems, the root cause hasn’t been identified but using a hub instead of an adapter usually fixes the issue.

Jean-Pierre

So I got hold of a Macbook with a USB-C port (running MacOS 10.14). Installed CW from Git. Using a cheap USB-C / A adapter. Guess what: with the first USB cable I tried, I get either the same symptoms you describe (FPGA Done failed to go high) or flashing red/blue lights and “USB Device not found”.

Credit to @Wess: his thread gave me the idea to try a different USB cable… same USB-C adapter; success!

What’s strange is that the first cable (which doesn’t work with this Macbook) does work on a different laptop with native USB-A port.

Conclusion: always try with a different cable :slight_smile:

Jean-Pierre

Alright, so I finally got around to try it with a USB hub, and like magic, it now worked!

Thanks for the support Jean-Pierre!
Are you going to investigate the root cause? Its probably got something to do with the USB design towards the Atmel.
It was quite infuriating trying to understand if it was me being a dufus or not due to it being the first time I used a CW…

Anywho… lets get glitching!

Sorry for the problems! We’ve got an open issue working on that exactly (https://github.com/newaetech/chipwhisperer/issues/237)… still not sure what it happens (yet).

But it also happens on Windows host with USBC-USBA adapter, so it’s some odd corner-case. I assume it’s some config on the SAM3U as you say, so can be fixed with a firmware update in the future.