Skip to content

Commit

Permalink
USB speed testing and results
Browse files Browse the repository at this point in the history
The writes to cdc stall at first and then at the end it goes
really smoothly, wonder why that is...

DMA transfer size fits bulk packet size, 4kB overall buffer
  • Loading branch information
MrJake222 committed Nov 3, 2024
1 parent 2485405 commit 10f488b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/ice_usb_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ struct uart_wrap {
// uart -> rb (irq)
// rb -> cdc

#define DMA_TCNT 128
#define DMA_TCNT 512
#define DMA_ALARM_US (100*1000) // 100 ms

static void ice_usb_uart_rx_dma_irq0(struct uart_wrap* uart, int channel) {
Expand Down Expand Up @@ -106,7 +106,7 @@ static void ice_usb_uart_dma_flush_alarm(struct uart_wrap* uart) {
dma_channel_set_trans_count(ch_busy, DMA_TCNT, true);

uart->dma_last_transfer = get_absolute_time();
printf("elapsed %dms ack %d\n", elapsed_us/1000, tr_done);
// printf("elapsed %dms ack %d\n", elapsed_us/1000, tr_done);
}
// else printf("No\n");

Expand Down Expand Up @@ -164,11 +164,13 @@ static void ice_usb_uart_rx_to_cdc(struct uart_wrap* uart) {
if (bufsize == 0)
break; // cdc buffer full

printf("%lu %4d\n", time_us_32(), bufsize);

// ack data that was sent to cdc
rb_read_ack(&uart->rx_buf, bufsize);
// flush
tud_cdc_n_write_flush(uart->itf);
}

tud_cdc_n_write_flush(uart->itf);
}


Expand Down
2 changes: 1 addition & 1 deletion src/ice_usb_uart.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "tusb.h"
#include "tusb_config.h"

#define ICE_USB_UART_RBBITS 10
#define ICE_USB_UART_RBBITS 12
#define ICE_USB_UART_RBSIZE (1<<ICE_USB_UART_RBBITS)

void ice_usb_uart_init();
Expand Down

0 comments on commit 10f488b

Please sign in to comment.