Skip to content

Commit

Permalink
adapt the default firmware to v1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
josuah committed Jul 17, 2023
1 parent 51dc8e6 commit f0bcdb4
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 26 deletions.
40 changes: 23 additions & 17 deletions Docs/ice_usb.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ Examples listed [at the bottom](#examples).
The pico-ice-sdk allows to configure forwarding from an USB CDC interface to an
UART interface with the two defines below:

Dependencies: `ICE_USB_USE_DEFAULT_CDC`, `ICE_USB_UART_CDC`, `ICE_USB_UART_NUM`
[`ITF_NUM_CDCx`](https://github.com/tinyvision-ai-inc/pico-ice-sdk/blob/main/examples/pico_usb_uart/usb_descriptors.c#L30),
[`ITF_NUM_DATAx`](https://github.com/tinyvision-ai-inc/pico-ice-sdk/blob/main/examples/pico_usb_uart/usb_descriptors.c#L30),
[`CFG_TUD_CDC`](https://github.com/tinyvision-ai-inc/pico-ice-sdk/blob/main/examples/pico_usb_uart/tusb_config.h#L44),
[`TUD_CDC_DESCRIPTOR`](https://github.com/tinyvision-ai-inc/pico-ice-sdk/blob/main/examples/pico_usb_uart/usb_descriptors.c#L38),
[`STRID_CDC+x`](https://github.com/tinyvision-ai-inc/pico-ice-sdk/blob/main/examples/pico_usb_uart/usb_descriptors.c#L49)
To enable:
1. Define `ICE_USB_UART0_CDC` or `ICE_USB_UART1_CDC` to the CDC interface number to use.
2. Adjust these as needed:
[`ITF_NUM_CDCx`](https://github.com/tinyvision-ai-inc/pico-ice-sdk/blob/main/examples/pico_usb_uart/usb_descriptors.c#L30),
[`ITF_NUM_DATAx`](https://github.com/tinyvision-ai-inc/pico-ice-sdk/blob/main/examples/pico_usb_uart/usb_descriptors.c#L30),
[`CFG_TUD_CDC`](https://github.com/tinyvision-ai-inc/pico-ice-sdk/blob/main/examples/pico_usb_uart/tusb_config.h#L44),
[`TUD_CDC_DESCRIPTOR`](https://github.com/tinyvision-ai-inc/pico-ice-sdk/blob/main/examples/pico_usb_uart/usb_descriptors.c#L38),
[`STRID_CDC+x`](https://github.com/tinyvision-ai-inc/pico-ice-sdk/blob/main/examples/pico_usb_uart/usb_descriptors.c#L49)

See the
[`pico_usb_uart`](https://github.com/tinyvision-ai-inc/pico-ice-sdk/tree/main/examples/pico_usb_uart/)
Expand All @@ -41,12 +43,14 @@ from the USB CDC interface using the
to the FPGA SPI interface using the
[wishbone-spi](https://wishbone-utils.readthedocs.io/en/latest/wishbone-tool/#spi-bridge) protocol..

Dependencies: `ICE_USB_USE_DEFAULT_CDC`, `ICE_USB_FPGA_CDC`,
[`ITF_NUM_CDCx`](https://github.com/tinyvision-ai-inc/pico-ice-sdk/blob/main/examples/pico_usb_uart/usb_descriptors.c#L30),
[`ITF_NUM_DATAx`](https://github.com/tinyvision-ai-inc/pico-ice-sdk/blob/main/examples/pico_usb_uart/usb_descriptors.c#L30),
[`CFG_TUD_CDC`](https://github.com/tinyvision-ai-inc/pico-ice-sdk/blob/main/examples/pico_usb_uart/tusb_config.h#L44),
[`TUD_CDC_DESCRIPTOR`](https://github.com/tinyvision-ai-inc/pico-ice-sdk/blob/main/examples/pico_usb_uart/usb_descriptors.c#L38),
[`STRID_CDC+x`](https://github.com/tinyvision-ai-inc/pico-ice-sdk/blob/main/examples/pico_usb_uart/usb_descriptors.c#L49)
To enable:
1. Define `ICE_USB_FPGA_CDC` to the CDC interface number to use.
2. Adjust these as needed:
[`ITF_NUM_CDCx`](https://github.com/tinyvision-ai-inc/pico-ice-sdk/blob/main/examples/pico_usb_uart/usb_descriptors.c#L30),
[`ITF_NUM_DATAx`](https://github.com/tinyvision-ai-inc/pico-ice-sdk/blob/main/examples/pico_usb_uart/usb_descriptors.c#L30),
[`CFG_TUD_CDC`](https://github.com/tinyvision-ai-inc/pico-ice-sdk/blob/main/examples/pico_usb_uart/tusb_config.h#L44),
[`TUD_CDC_DESCRIPTOR`](https://github.com/tinyvision-ai-inc/pico-ice-sdk/blob/main/examples/pico_usb_uart/usb_descriptors.c#L38),
[`STRID_CDC+x`](https://github.com/tinyvision-ai-inc/pico-ice-sdk/blob/main/examples/pico_usb_uart/usb_descriptors.c#L49)

See the
[`pico_usb_fpga`](https://github.com/tinyvision-ai-inc/pico-ice-sdk/tree/main/examples/pico_usb_fpga/)
Expand All @@ -60,11 +64,13 @@ This means no Zadig driver setup needed on Windows.

You would need something like the [`uf2-utils`](https://github.com/tinyvision-ai-inc/uf2-utils) to generate the UF2-formatted files.

Dependencies: `ICE_USB_USE_TINYUF2_MSC`, `ICE_USB_FPGA_CDC`,
[`ITF_NUM_MSCx`](https://github.com/tinyvision-ai-inc/pico-ice-sdk/blob/main/examples/pico_usb_uart/usb_descriptors.c#L30),
[`CFG_TUD_MSC`](https://github.com/tinyvision-ai-inc/pico-ice-sdk/blob/main/examples/pico_usb_uart/tusb_config.h#L45),
[`TUD_MSC_DESCRIPTOR`](https://github.com/tinyvision-ai-inc/pico-ice-sdk/blob/main/examples/pico_usb_uf2/usb_descriptors.c#L37),
[`STRID_MSC+x`](https://github.com/tinyvision-ai-inc/pico-ice-sdk/blob/main/examples/pico_usb_uf2/usb_descriptors.c#L49)
To enable:
1. Define `ICE_USB_USE_TINYUF2_MSC`
2. Adjust these as needed:
[`ITF_NUM_MSCx`](https://github.com/tinyvision-ai-inc/pico-ice-sdk/blob/main/examples/pico_usb_uart/usb_descriptors.c#L30),
[`CFG_TUD_MSC`](https://github.com/tinyvision-ai-inc/pico-ice-sdk/blob/main/examples/pico_usb_uart/tusb_config.h#L45),
[`TUD_MSC_DESCRIPTOR`](https://github.com/tinyvision-ai-inc/pico-ice-sdk/blob/main/examples/pico_usb_uf2/usb_descriptors.c#L37),
[`STRID_MSC+x`](https://github.com/tinyvision-ai-inc/pico-ice-sdk/blob/main/examples/pico_usb_uf2/usb_descriptors.c#L49)

See the
[`pico_usb_uf2`](https://github.com/tinyvision-ai-inc/pico-ice-sdk/tree/main/examples/pico_usb_uf2/)
Expand Down
2 changes: 2 additions & 0 deletions Firmware/pico-ice-default/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ target_include_directories(${CMAKE_PROJECT_NAME} PUBLIC
${CMAKE_CURRENT_LIST_DIR}
)
pico_add_extra_outputs(${CMAKE_PROJECT_NAME})
pico_enable_stdio_usb(${CMAKE_PROJECT_NAME} 0)
pico_enable_stdio_uart(${CMAKE_PROJECT_NAME} 0)
2 changes: 1 addition & 1 deletion Firmware/pico-ice-default/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ int main(void) {
gpio_set_function(UART_TX_PIN, GPIO_FUNC_UART);
gpio_set_function(UART_RX_PIN, GPIO_FUNC_UART);

// Configure the piping as configured in <tusb_config.h>
// Configure the piping as defined in <tusb_config.h>
ice_usb_init();

// Let the FPGA start
Expand Down
10 changes: 3 additions & 7 deletions Firmware/pico-ice-default/tusb_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,11 @@
#define CFG_TUD_MIDI 0
#define CFG_TUD_VENDOR 0

// Use implementation from the pico-ice-sdk or not
#define ICE_USB_USE_DEFAULT_DESCRIPTOR 1
#define ICE_USB_USE_DEFAULT_CDC 1
#define ICE_USB_USE_DEFAULT_DFU 1
// Configure the TinyUF2 drag-and-drop to USB drive for FPGA-programming
#define ICE_USB_USE_TINYUF2_MSC 1

// Configure forwarding between USB CDC and UART
#define ICE_USB_UART_CDC 1
#define ICE_USB_UART_NUM 0
// Configure 2-way forwarding between USB CDC and UART
#define ICE_USB_UART0_CDC 1

// CDC FIFO size of TX and RX and Endpoint buffer size
#define CFG_TUD_CDC_RX_BUFSIZE 512
Expand Down

0 comments on commit f0bcdb4

Please sign in to comment.