Skip to content

Commit b63ca11

Browse files
committed
FPGA target firmware fixes.
- update documentation for programming firmware, using the firmware that's now distributed with chipwhisperer - fix cw310/340 being identified as cw305's by cw.list_devices() - fix whitelist of accepted hardware_type by cw.program_sam_firmware() so that the firmware is actually found
1 parent 3f04778 commit b63ca11

File tree

5 files changed

+175
-68
lines changed

5 files changed

+175
-68
lines changed

docs/source/Targets/CW305 Artix FPGA.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,95 @@ make clean
470470
make
471471
```
472472

473+
---
474+
475+
## Firmware Upgrade
476+
477+
If you need to upgrade the firmware on the SAM3X (control microcontroller), simply run:
478+
479+
```
480+
import chipwhisperer as cw
481+
target = cw.target(None, cw.targets.CW305)
482+
target.upgrade_firmware()
483+
```
484+
485+
If this is successful you will see something like:
486+
487+
```
488+
Entering bootloader mode...
489+
Detected com port /dev/ttyACM0
490+
Loading cw305 firmware...
491+
Opened!
492+
Connecting...
493+
Connected!
494+
Erasing...
495+
Erased!
496+
Programming file cw305/mcufw.bin...
497+
Programmed!
498+
Verifying...
499+
Verify OK!
500+
Resetting...
501+
Upgrade successful
502+
```
503+
504+
If you don’t see the "Resetting..." line, you’ll need to power cycle the board.
505+
506+
### Incorrect Firmware
507+
508+
If your board has been programmed with incorrect firmware, the above method won't work. Instead you must do the following steps:
509+
510+
1. Erase the SAM3X, causing it to enter bootloader mode.
511+
2. Program the SAM3X with the new firmware.
512+
513+
#### Step 1: Erasing the SAM3X
514+
515+
This can be done in two ways. Via Python:
516+
517+
```
518+
import chipwhisperer as cw
519+
target = cw.target(None, cw.targets.CW305)
520+
programmer = cw.SAMFWLoader(scope=target)
521+
programmer.enter_bootloader(really_enter=True)
522+
```
523+
524+
Alternative, short the jumper holes marked "ERASE" (J20) with a paperclip, tweezers, etc.
525+
526+
If this part is successful, the leds D23 and D9 will be dimly lit. The CW305 will then **re-enumerate as a serial port**.
527+
528+
#### Step 2: Reprogramming the SAM3X
529+
530+
In the following step, you may need to add explicit permission for the bootloader serial port. This is a different USB interface than is normally used by the device.
531+
532+
Simply run:
533+
534+
```python
535+
import chipwhisperer as cw
536+
cw.program_sam_firmware(hardware_type='cw305')
537+
```
538+
539+
If this is successful you will see something like:
540+
541+
```
542+
Found /dev/ttyACM0
543+
Loading cw305 firmware...
544+
Opened!
545+
Connecting...
546+
Connected!
547+
Erasing...
548+
Erased!
549+
Programming file cw305/mcufw.bin...
550+
Programmed!
551+
Verifying...
552+
Verify OK!
553+
Resetting...
554+
Upgrade successful
555+
```
556+
557+
If you don’t see the "Resetting..." line, you’ll need to power cycle the board.
558+
559+
560+
561+
473562
---
474563

475564
## Application Note

docs/source/Targets/CW310 Bergen Board.md

Lines changed: 41 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -507,21 +507,43 @@ See [Page 27 of the Schematics](#reference-material-schematics) for more detail.
507507

508508
## Firmware Upgrade
509509

510-
If you need to upgrade the firmware on the SAM3X (control microcontroller), this is currently done through two steps:
510+
If you need to upgrade the firmware on the SAM3X (control microcontroller), simply run:
511511

512-
1. Erase the SAM3X, causing it to enter bootloader mode.
513-
2. Program the SAM3X with the new firmware.
512+
```
513+
import chipwhisperer as cw
514+
target = cw.target(None, cw.targets.CW310)
515+
target.upgrade_firmware()
516+
```
514517

515-
See the following for details of these steps.
518+
If this is successful you will see something like:
516519

517-
```{admonition} Automatic Bootloader
518-
:class: tip
519-
Our other devices have a simplified "automatic" bootloader programmer -
520-
currently the CW310 firmware isn't distributed with ChipWhisperer, so for now
521-
use the following manual method.
522520
```
521+
Entering bootloader mode...
522+
Detected com port /dev/ttyACM0
523+
Loading cwbergen firmware...
524+
Opened!
525+
Connecting...
526+
Connected!
527+
Erasing...
528+
Erased!
529+
Programming file cwbergen/mcufw.bin...
530+
Programmed!
531+
Verifying...
532+
Verify OK!
533+
Resetting...
534+
Upgrade successful
535+
```
536+
537+
If you don’t see the "Resetting..." line, you’ll need to power cycle the board.
538+
539+
### Incorrect Firmware
540+
541+
If your board has been programmed with incorrect firmware, the above method won't work. Instead you must do the following steps:
542+
543+
1. Erase the SAM3X, causing it to enter bootloader mode.
544+
2. Program the SAM3X with the new firmware.
523545

524-
### Step 1: Erasing the SAM3X
546+
#### Step 1: Erasing the SAM3X
525547

526548
This can be done in two ways. Via Python:
527549

@@ -536,49 +558,36 @@ Alternative, short the jumper holes marked "ERASE" (J20) with a paperclip, tweez
536558

537559
If this part is successful, the leds D23 and D9 will be dimly lit. The CW310 will then **re-enumerate as a serial port**.
538560

539-
### Step 2: Reprogramming the SAM3X
561+
#### Step 2: Reprogramming the SAM3X
540562

541563
In the following step, you may need to add explicit permission for the bootloader serial port. This is a different USB interface than is normally used by the device.
542564

543-
Get the latest firmware from GIT:
544-
545-
```
546-
wget https://github.com/newaetech/cw310-bergen-board/raw/main/microfw/CW310/Debug/CW310.bin
547-
```
548-
549-
And then:
565+
Simply run:
550566

551567
```python
552568
import chipwhisperer as cw
553-
programmer = cw.SAMFWLoader(scope=None)
554-
programmer.program('COM3', 'CW310.bin')
569+
cw.program_sam_firmware(hardware_type='cwbergen')
555570
```
556571

557572
If this is successful you will see something like:
558573

559574
```
560-
Opening firmware...
575+
Found /dev/ttyACM0
576+
Loading cwbergen firmware...
561577
Opened!
562578
Connecting...
563-
b'\n\r'
564579
Connected!
565580
Erasing...
566581
Erased!
567-
Programming file CW310.bin...
582+
Programming file cwbergen/mcufw.bin...
568583
Programmed!
569584
Verifying...
570585
Verify OK!
571-
Bootloader disabled. Please power cycle device.
586+
Resetting...
587+
Upgrade successful
572588
```
573589

574-
Press the "USB RST" button (SW5) on the board or power cycle it.
575-
576-
```{admonition} No Touch Bootloader
577-
:class: tip
578-
The latest git will support an automatic bootloader which does not require you
579-
to power cycle or touch the physical board. If your board automatically
580-
re-enumerates, you do not need to do the "USB RST" command.
581-
```
590+
If you don’t see the "Resetting..." line, you’ll need to power cycle the board.
582591

583592
## Reference Material (Schematics)
584593

docs/source/Targets/CW340 Luna Board.md

Lines changed: 41 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -159,22 +159,43 @@ Most other jumpers on the CW340 will not need to be touched by the user. They do
159159

160160
## Firmware Upgrade
161161

162-
If you need to upgrade the firmware on the SAM3X (control microcontroller), this is currently done through two steps:
162+
If you need to upgrade the firmware on the SAM3X (control microcontroller), simply run:
163163

164-
1. Erase the SAM3X, causing it to enter bootloader mode.
165-
2. Program the SAM3X with the new firmware.
164+
```
165+
import chipwhisperer as cw
166+
target = cw.target(None, cw.targets.CW340)
167+
target.upgrade_firmware()
168+
```
166169

167-
See the following for details of these steps.
170+
If this is successful you will see something like:
168171

169-
```{admonition} Automatic Bootloader
170-
:class: tip
171-
Our other devices have a simplified "automatic" bootloader programmer -
172-
currently the CW340 firmware isn't distributed with ChipWhisperer, so for now
173-
use the following manual method.
174172
```
173+
Entering bootloader mode...
174+
Detected com port /dev/ttyACM0
175+
Loading cwluna firmware...
176+
Opened!
177+
Connecting...
178+
Connected!
179+
Erasing...
180+
Erased!
181+
Programming file cwluna/mcufw.bin...
182+
Programmed!
183+
Verifying...
184+
Verify OK!
185+
Resetting...
186+
Upgrade successful
187+
```
188+
189+
If you don’t see the "Resetting..." line, you’ll need to power cycle the board.
190+
191+
### Incorrect Firmware
175192

193+
If your board has been programmed with incorrect firmware, the above method won't work. Instead you must do the following steps:
194+
195+
1. Erase the SAM3X, causing it to enter bootloader mode.
196+
2. Program the SAM3X with the new firmware.
176197

177-
### Step 1: Erasing the SAM3X
198+
#### Step 1: Erasing the SAM3X
178199

179200
This can be done in two ways. Via Python:
180201

@@ -189,49 +210,38 @@ Alternative, short the jumper holes marked "ERASE" (J20) with a paperclip, tweez
189210

190211
If this part is successful, the leds D23 and D9 will be dimly lit. The CW340 will then **re-enumerate as a serial port**.
191212

192-
### Step 2: Reprogramming the SAM3X
213+
#### Step 2: Reprogramming the SAM3X
193214

194215
In the following step, you may need to add explicit permission for the bootloader serial port. This is a different USB interface than is normally used by the device.
195216

196-
Get the latest firmware from GIT, note that the file is stored as part of the CW340 repo:
197-
198-
```
199-
wget https://github.com/newaetech/cw310-bergen-board/raw/main/microfw/CW310/src/CW340.bin
200-
```
201-
202-
And then:
217+
Simply run:
203218

204219
```python
205220
import chipwhisperer as cw
206-
programmer = cw.SAMFWLoader(scope=None)
207-
programmer.program('COM3', 'CW340.bin')
221+
cw.program_sam_firmware(hardware_type='cwluna')
208222
```
209223

210224
If this is successful you will see something like:
211225

212226
```
213-
Opening firmware...
227+
Found /dev/ttyACM0
228+
Loading cwluna firmware...
214229
Opened!
215230
Connecting...
216-
b'\n\r'
217231
Connected!
218232
Erasing...
219233
Erased!
220-
Programming file CW340.bin...
234+
Programming file cwluna/mcufw.bin...
221235
Programmed!
222236
Verifying...
223237
Verify OK!
224-
Bootloader disabled. Please power cycle device.
238+
Resetting...
239+
Upgrade successful
225240
```
226241

227-
Press the "USB RST" button (SW5) on the board or power cycle it.
242+
If you don’t see the "Resetting..." line, you’ll need to power cycle the board.
243+
228244

229-
```{admonition} No Touch Bootloader
230-
:class: tip
231-
The latest git will support an automatic bootloader which does not require you
232-
to power cycle or touch the physical board. If your board automatically
233-
re-enumerates, you do not need to do the "USB RST" command.
234-
```
235245

236246
## Reference Material (Schematics)
237247

software/chipwhisperer/capture/scopes/cwhardware/ChipWhispererSAM3Update.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,9 @@ def program(self, port, fw_path=None, hardware_type=None, bypass_warning=False):
219219
'cwlite',
220220
'cwnano',
221221
'cw305',
222-
'cw310',
223-
'cw340',
224-
'cw1200',
225222
'cwbergen',
223+
'cwluna',
224+
'cw1200',
226225
'cwhusky',
227226
'cwhuskyplus'
228227
]

software/chipwhisperer/hardware/naeusb/naeusb.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,8 @@ def make_len_addr(dlen, addr):
358358
0xACE2: {'name': "ChipWhisperer-Lite", 'fwver': fwver("cwlite")},
359359
0xACE3: {'name': "ChipWhisperer-CW1200", 'fwver': fwver("cw1200")},
360360
0xC305: {'name': "CW305 Artix FPGA Board", 'fwver': fwver("cw305")},
361-
0xC310: {'name': "CW305 Artix FPGA Board", 'fwver': fwver("cwbergen")},
362-
0xC340: {'name': "CW305 Artix FPGA Board", 'fwver': fwver("cwluna")},
361+
0xC310: {'name': "CW310 Bergen FPGA Board", 'fwver': fwver("cwbergen")},
362+
0xC340: {'name': "CW340 Luna FPGA Board", 'fwver': fwver("cwluna")},
363363
0xACE0: {'name': "ChipWhisperer-Nano", 'fwver': fwver("cwnano")},
364364
0xACE5: {'name': "ChipWhisperer-Husky", 'fwver': fwver("cwhusky")},
365365
0xACE6: {'name': "ChipWhisperer-Husky-Plus", 'fwver': fwver("cwhuskyplus")},

0 commit comments

Comments
 (0)