Skip to content

Commit

Permalink
usb: fix most/all dfu-util related problems
Browse files Browse the repository at this point in the history
  • Loading branch information
josuah committed Dec 20, 2023
1 parent 0ccc070 commit 6ab78bc
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
6 changes: 3 additions & 3 deletions Docs/programming_the_fpga.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ You can skip step 1 if this is the case.
This should list the pico-ice as a DFU device:

```
Found DFU: [1209:b1c0] ver=0100, devnum=105, cfg=1, intf=0, path="1-4.4", alt=1, name="iCE40 DFU (flash)", serial="DE62A435436F5939"
Found DFU: [1209:b1c0] ver=0100, devnum=105, cfg=1, intf=0, path="1-4.4", alt=0, name="iCE40 DFU (CRAM)", serial="DE62A435436F5939"
Found DFU: [1209:b1c0] ver=0100, devnum=105, cfg=1, intf=0, path="1-4.4", alt=0, name="iCE40 DFU (flash)", serial="DE62A435436F5939"
Found DFU: [1209:b1c0] ver=0100, devnum=105, cfg=1, intf=0, path="1-4.4", alt=1, name="iCE40 DFU (CRAM)", serial="DE62A435436F5939"
```

4. Download the FPGA bin file to the pico-ice.
The Pico can be rebooted as soon as the download succeeds with the `-R` flag.

```
$ dfu-util -a 1 -D rgb_blink.bin
$ dfu-util -R -a 0 -D rgb_blink.bin
```

## Using APIO
Expand Down
4 changes: 0 additions & 4 deletions Firmware/pico-ice-default/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@ static int repl_getchar(void)
// busy-wait with a slow delay: this is for interactive I/O, no need to be fast
while ((c = getchar_timeout_us(10000)) == PICO_ERROR_TIMEOUT) {
// call tud_task() since we are blocking
ice_led_blue(1);
tud_task();
ice_led_blue(0);
}

if (c == '\r' || c == '\n') {
Expand Down Expand Up @@ -131,9 +129,7 @@ int main(void)
ice_led_init();

while (true) {
ice_led_green(1);
tud_task();
ice_led_green(0);

printf("\x1b[1mpico-ice>\x1b[m ");

Expand Down
4 changes: 2 additions & 2 deletions Firmware/pico-ice-default/usb_descriptors.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ char const *tud_string_desc[STRID_NUM_TOTAL] = {
[STRID_CDC+1] = "iCE40 UART",
[STRID_CDC+2] = "SPI",
[STRID_MSC+0] = "iCE40 MSC (Flash)",
[STRID_DFU+0] = "iCE40 DFU (CRAM)",
[STRID_DFU+1] = "iCE40 DFU (Flash)",
[STRID_DFU+0] = "iCE40 DFU (Flash)",
[STRID_DFU+1] = "iCE40 DFU (CRAM)",
};
2 changes: 1 addition & 1 deletion Firmware/pico-ice-sdk

0 comments on commit 6ab78bc

Please sign in to comment.