CW305 reprograming bitstream issue

FPGA buildtime for attempt2 bitfile: 10/20/2023, 09:50
FPGA buildtime for attempt4 bitfile: 10/20/2023, 09:50

LED was initially HIGH. After the first programming, it goes to LOW. Then, it resumes LOW.

So to be 100% clear: you program a bitfile; FPGA_DONE LED turns off.
Then, after running target.fpga.eraseFPGA(), the FPGA_DONE LED remains off? Is that correct?

Yes, it is correct. Whenever it programs the first bitfile, FPGA_DONE LED turns off. Then, it remains off.

Hi,

Do you think you could try running this code? It should erase the FPGA with a longer IO pin toggle than the default:

fpga = cw.target.fpga
fpga.sendCtrl(fpga.CMD_FPGA_PROGRAM, fpga._prog_mask)
time.sleep(0.5)
fpga.sendCtrl(fpga.CMD_FPGA_PROGRAM, fpga._prog_mask | 0x01)
time.sleep(0.5)

If that doesn’t work, you can manually reset the USB connection by running:

target._naeusb.reset()

Which should do the same thing as pressing the usb reset button.

Worst case, I should be able to send you custom firmware that can power the FPGA on/off to reset.

Alex

Hi Alex,

Thank you so much :grinning:.
The second one “target._naeusb.reset()” is solved my problem. After running this command “target._naeusb.reset()”, I added scope initialization because it showed that scope is disconnected.

I used the following code:

import chipwhisperer as cw

fpga_id = '35t'
attempt = 'attempt2'
bsfile = '../hardware/firmware/cw305/ECDSA256v1_pmul_{}_{}.bit'.format(attempt, fpga_id)
target = cw.target(None, cw.targets.CW305_ECC, force=True, bsfile=bsfile, platform='cw305')
print('FPGA buildtime for %s bitfile: %s' % (attempt, target.fpga_buildtime))

target._naeusb.reset()

scope = cw.scope()
scope.default_setup()
if scope._is_husky:
    scope.adc.samples = 80
else:
    scope.adc.samples = 129
scope.adc.offset = 0
scope.adc.basic_mode = "rising_edge"
scope.trigger.triggers = "tio4"
scope.io.tio1 = "serial_rx"
scope.io.tio2 = "serial_tx"
scope.io.hs2 = "disabled"

attempt = 'attempt4'
bsfile = '../hardware/firmware/cw305/ECDSA256v1_pmul_{}_{}.bit'.format(attempt, fpga_id)
target = cw.target(None, cw.targets.CW305_ECC, force=True, bsfile=bsfile, platform='cw305')
print('FPGA buildtime for %s bitfile: %s' % (attempt, target.fpga_buildtime))

I received the following output correctly:
FPGA buildtime for attempt2 bitfile: 10/20/2023, 09:50
FPGA buildtime for attempt4 bitfile: 10/20/2023, 10:17


The first one gave the following error.

fpga = cw.target.fpga
fpga.sendCtrl(fpga.CMD_FPGA_PROGRAM, fpga._prog_mask)
time.sleep(0.5)
fpga.sendCtrl(fpga.CMD_FPGA_PROGRAM, fpga._prog_mask | 0x01)
time.sleep(0.5)

AttributeError Traceback (most recent call last)
Cell In[2], line 11
8 target = cw.target(None, cw.targets.CW305_ECC, force=True, bsfile=bsfile, platform=‘cw305’)
9 print(‘FPGA buildtime for %s bitfile: %s’ % (attempt, target.fpga_buildtime))
—> 11 fpga = cw.target.fpga
12 fpga.sendCtrl(fpga.CMD_FPGA_PROGRAM, fpga._prog_mask)
13 time.sleep(0.5)
AttributeError: ‘function’ object has no attribute ‘fpga’


I also want to thank @jpthibault for trying to help me a lot over the past few days—I really appreciate the effort."

Oh sorry, that should’ve been fpga = target.fpga. Glad to hear that worked for you.