newaetech / cw340-luna-board

0 stars 1 forks source link

New CW340 board is non-functional #3

Closed AndySecqai closed 7 months ago

AndySecqai commented 7 months ago

We have fresh-out-of-the-box CW340 card that appears to be non-functional and require some assistance with debugging.

Once connected to the host computer, we can successfully run the OpenTitan set-pll command, which I think indicates that USB communications are working to the SAM3X, and I2C communications are working from the SAM3X to the PLL.

dmesg -Hw is not showing any errors, and lsusb appears to be detecting things as I would expect:

Bus 003 Device 004: ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC
Bus 003 Device 005: ID 2b3e:c340 NewAE Technology Inc. ChipWhisperer CW340 - Luna Board
Bus 003 Device 002: ID 0424:2534 Microchip Technology, Inc. (formerly SMSC)

However, from this point, nothing seems to be able to communicate correctly:

At this point, it looks to me like there is something wrong with the FTDI-to-FPGA connection, and/or the FPGA itself is dead (particularly due to the Vivado Hardware Manager not being able to see it), but hopefully someone has an idea of some other tests to try before I RMA it back to the distributer...

Thanks, Andy

jpcrypt commented 7 months ago

How are you powering the board, what are the positions of all the power delivery switches, and what LEDs are on or blinking?

AndySecqai commented 7 months ago

Please see attached for a picture of the board configuration with the various leds showing: signal-2024-04-25-141837

We are mostly following the OpenTitan getting started guide here, however we have SW7 to the left as the board seems unpowered with it to the right as stated in that guide.

If it is possible to tell from the attached pictures, do our jumpers look correctly configured? They've been left as-was from taking it out of the box...

colinoflynn commented 7 months ago

Some quick notes for troubleshooting:

1) The FPGA JTAG only goes to the header on the FPGA card - it will require an external programmer if you want it to be detected in Vivado (the four FTDI channels were already fully subscribed, so there wasn't a spare one). So you don't expect anything in Vivado.

2) Not 100% sure on OTT is detecting (or if it's a permissions issue?). FYI there is another test note book ( here ), although it seems it needs to be updated (@jpcrypt was confirming). But if you wanted you could try at least the connection line which can program a bitfile.

3) The SAM3X F/W update could be a permission thing- there is an example udev rules file for our generic products here, need to double-check it captures all sides of the CW340 (may need more for the FTDI).

If you're willing to be bold could run it as sudo. Note that you can force the FW update mode by shorting the 'erase' pin, you'll need to specify the serial port. If you don't want to mess with permissions, a safer way (without doing sudo) is to force the serial bootloader, then chmod a+rw /dev/ttyACMn (check the ACMn from dmesg, when you plug in the board in bootloader mode it will come up as a Microchip VID/PID device).

Double-checking some more stuff here, but to quickly explain what you are seeing hopefully above is helpful!

AndySecqai commented 7 months ago

Hi @colinoflynn - I just took a quick look at the test note book you linked to, but it seems like maybe something isn't right in my python environment:

<user>:~/cw340-luna-board/fpga/vivado/cw341.runs/impl_1$ python3
Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import chipwhisperer as cw
>>> bsfile = 'cw341_top.bit'
>>> target = cw.target(None, cw.targets.CW340, bsfile=bsfile, force=True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'chipwhisperer.capture.targets.CW310' has no attribute 'CW340'. Did you mean: 'CW310'?
jpcrypt commented 7 months ago

Can you update your ChipWhisperer installation to the develop branch? It should then work. Then you can try the test notebook here to do basic validation. You should see blinking blue and red LEDs to indicate that clocks are alive. A single additional jumper is required to run the tests, as explained in the notebook.

AndySecqai commented 7 months ago

@jpcrypt sorry - probably a dumb question on my part, but I'm not much of a python user - how would I change the installation to the develop branch? I just installed it with pip3 install chipwhisperer

AndySecqai commented 7 months ago

Sorry - ignore the above, I found the install instructions in the chipwhisperer repo. I'm pretty sure I got the the develop branch set up correctly, but the Python instructions still don't seem right:

:~/cw340-luna-board/fpga/vivado/cw341.runs/impl_1$ python
3
Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import chipwhisperer as cw
>>> bsfile='cw341_top.bit'
>>> target = cw.target(None, cw.targets.CW340, bsfile=bsfile, force=True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'chipwhisperer' has no attribute 'target'
>>>
AndySecqai commented 7 months ago

Ah - sorry for the stream of consciousness here: the python issue was that I was missing the pyenv activate cw step...

Following that, I've managed to do the firmware update process, and the chipwhisperer target.fpga_write() / target.fpga_read() seems to be writing and reading back correctly (so I think this means that the board is now alive and working).

Unfortunately, the opentitantool is still refusing to program the board, but it now seems to be a host-software / permissions thing on that side of things.

Thanks for the help everyone!